Printing to Locally Attached Printers


About this document
    Related documentation
Testing communication
Troubleshooting communication
Troubleshooting the queue
Appendix A: Deactivating a queue
Appendix B: File permissions, owners, and groups

About this document

This document provides information on printing to locally attached printers and applies to AIX version 4.

Related documentation

The product documentation library is also available:


In the examples that follow, the configured device driver designated by lp0 refers to a printer attached to the parallel port, and the configured device driver designated by lp1 refers to a printer attached to the second serial port.

To check your system for configured device drivers, enter:

    lsdev -Cc printer

Information in the following format will be returned for any locally attached printers:

    lp0  Available 00-00-0P-00 Hewlett-Packard LaserJet 4,4M
    lp1  Available 00-00-S2-00 IBM 2380 Personal Printer II

Testing communication

Ensure that data can reach the printer and that the printer will print the data. With the exception of certain specialized printers, working printers are capable of printing ASCII text.

To test, enter:

    lptest 40 20 > /dev/lp0

This entry will send an ASCII test pattern 40 characters wide and 20 lines long to the file /dev/lp0, to the device driver in the kernel, and out the port for which lp0 was configured (in this case, the parallel port). The lptest pattern will look like the following:


A printer that accepts data in the postscript format can be tested by writing a postscript file such as the postscript header page to the device file. To test, enter:

    cd /usr/lib/lpd/pio/burst
    cat > /dev/lp0

NOTE: If a PJL command prefixes the data stream, those printers that automatically detect whether or not the incoming data stream is in postscript format will switch to postscript mode. Conversely, those printers without the PJL command will print the postscript source code.

Troubleshooting communication

Three types of failures may occur from the preceding tests (lptest or cat):

  1. A prompt is returned, but there is no output at the printer.

  2. A prompt is returned, but one of the following messages appears:
        cannot open the specified file
        cannot create the specified file

    The system is unable to send data out the port due to wrong cabling or wrong printer setting. The system is not receiving the CTS signal. CTS indicates that the printer is present and switched on. The CTS signal is normally sent along the printer RTS line, and it is expected to be high at all times. In some cases, the printer will have a setting for the CTS signal (possibly listed as an RTS option which should be set to true or high).

  3. The prompt does not return.

    Try the Ctrl-C key combination. If the prompt returns with a message, see example 2 above. If the prompt returns without a message, check use of the lp by entering:

    fuser /dev/lp1

In the preceding example of lp1, the following should be returned:


If there are any numbers after the colon, processes associated with the lp have been identified. For more information about the process(s), in the following command, substitute the process ID (PID) returned from fuser:

    ps -ef|grep PID

If this shows the process to be pioout or piobe and there is no printed output from the printer, a flow control problem probably exists. If Xon/Xoff flow control is used, then the system is waiting for an Xon character from the printer. If DTR (hardware) flow control is in use, the system is waiting for the CD signal from the printer DTR line.

If proper flow control can be established, printed output will resume where it left off.

Try the following:

  1. Switch printer power off and back on.
  2. Switch printer offline and back online.
  3. Disconnect the cable from the printer, plug it into a terminal, and type Ctrl-Q on the terminal.

If method 3 works, then the printer is not sending an Xon character to the system. Investigate the use of Xon/Xoff flow control by the printer.

If the flow control condition cannot be rectified or flow control is not the issue, kill the processes:

    fuser -k /dev/lp1

Verify that the processes were killed:

    fuser /dev/lp1

If unsuccessful, detach the printer cable from the system. If this still does not work, enter:

    kill -9 PID

If this too is unsuccessful, a system reboot is needed. If upon reboot the processes reappear, deactivate the queue as indicated in Appendix A.

Troubleshooting the queue

If a queue is used for printing and there is printed output from using the cat or lptest commands in the section above, turn your attention to the queueing system.

In the examples, lp0q and lp1q point to lp0 and lp1 respectively.

To view the status of queues, enter:


which in the case of the examples might return:

    Queue   Dev   Status 
    ------- ----  -------
    lp0q    lp0   READY
    lp1q    lp1   DOWN

Other possible states are DEV_BUSY or DEV_WAIT.

To enable the lp1q, enter:

    enable qlp1

If lpstat subsequently shows the queue to be DOWN and nothing was printed, compare your file permissions and file owners and groups against those in Appendix B.

If repeated lpstat commands show the queue hanging for several minutes in a DEV_BUSY or DEV_WAIT state, check the file= field for that queue, enter:

    pg /etc/qconfig

Use the ENTER key to page through the file. In the example queue and device, this would show:

            file = /dev/lp1

If the file= field does not have /dev/lp#, contact your AIX support center. You can also retrieve the device name by entering:

    lsque -qlp1q

In this example, the following would be returned:

            device = lp1

With the device name, you could enter:

    lsquedev -qlp1q -dlp1

which would return information including the file= field.

If the queue is stuck in a READY state with jobs QUEUED, the qdaemon must be cycled. This occurs when queues were added/removed/changed while the queuing system was in use. To cycle the qdaemon, enter:

    stopsrc -cs qdaemon
    startsrc -s qdaemon

Stopping the qdaemon may cause jobs currently printing to be abandoned, in which case those jobs would not resume where they left off upon restarting the qdaemon.

Appendix A: Deactivating a queue

The following command will disable the example queue lp1q:

    disable lp1q

lpstat will show this queue as DOWN.

To deactivate the example queue lp1q, thus ensuring that it would be disabled on reboot, enter the following:

    stopsrc -cs qdaemon
    chque -qlp1q -dlp1 -a"up = FALSE"
    startsrc -s qdaemon

To reactivate the queue, use SMIT or run the preceding commands substituting TRUE for FALSE.

Appendix B: File permissions, owners and groups

At minimum, the following should be checked. This is especially true if only the root user (superuser) can print.

-r-sr-s---   1 root    printq     58989 Oct 26 1994  /usr/sbin/qdaemon
-r-sr-s---   1 root    printq     50099 Oct 26 1994  /usr/sbin/lpd
-r-sr-sr-x   1 root    printq     59262 Oct 26 1994  /bin/enq
-r-xr-xr-x   1 bin     bin        31493 Oct 26 1994  /bin/qprt
-r-xr-xr-x   1 bin     bin        30397 Oct 26 1994  /bin/lp
-r-xr-xr-x   1 bin     bin        31421 Oct 26 1994  /bin/lpr
-r-xr-xr-x   1 bin     bin        30909 Oct 26 1994  /bin/lpstat
-r-xr-sr-x   1 bin     printq     54633 Oct 13 1994  /usr/lib/lpd/piobe
-r-sr-x---   1 root    printq     38205 Oct 26 1994  /usr/lib/lpd/digest
-r-sr-x---   1 root    printq     52088 Oct 26 1994  /usr/lib/lpd/qstatus
-r-sr-xr-x   1 root    printq     49626 Aug 14 1995  /usr/lib/lpd/pio
crw-rw-rw-   1 root    system     2,  2 Jul 09 08:56 /dev/null
-rw-rw-r--   1 root    printq      6198 Sep 27 10:55 /etc/qconfig
-rw-rw----   1 root    printq     26876 Sep 27 10:55 /etc/qconfig.bin
drwxr-xr-x  33 bin     bin         2048 Sep 17 00:39 /
drwxr-xr-x  12 bin     bin          512 Jul 10 14:45 /var
drwxrwxr-x  12 bin     bin          512 Sep 13 18:53 /var/spool
drwxrwxr-x   5 bin     printq     14336 Sep 14 11:51 /var/spool/lpd
drwxrwxr-x   2 root    printq     42496 Sep 15 17:19 /var/spool/lpd/qdir
drwxrwxr-x   2 root    printq      2048 Sep 15 17:18 /var/spool/lpd/stat
drwxrwxr-x   2 bin     printq      6656 Sep 15 15:23 /var/spool/qdaemon
drwxr-xr-x  21 bin     bin          512 Jan 17 1995  /usr
drwxr-xr-x   3 bin     bin        11776 Sep 16 23:31 /usr/bin
drwxr-xr-x   4 bin     bin         9216 Sep 16 23:32 /usr/sbin
drwxrwxr-x  15 root    system      8192 Sep 27 10:55 /etc
drwxrwsrwt  16 bin     bin         4608 Nov 27 14:32 /tmp

To check directories, enter:

    ls -ld <path/directory>

For example, ls -ld / would return information for root directory, and ls -ld /etc would return information for the etc directory.

[ Doc Ref: 90605208614738     Publish Date: Spt. 29, 2000     4FAX Ref: 7205 ]