This document contains information on locally attached printers. This document is applicable to AIX versions 3 and 4.
In the examples that follow, the configured device driver designated by 'lp0' points to a printer attached to the parallel port, and the configured device driver designated by 'lp1' points to a printer attached to the second serial port.
To check your system for configured device drivers, use:
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
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.
Test this by using:
lptest 40 20 > /dev/lp0
This will send an ASCII test pattern 40 characters wide and 20 lines long to the file /dev/lp0 and then 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:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGH "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI #$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJ $%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJK %&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKL &'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLM '()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN ()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO )*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOP *+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQ +,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR ,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRS -./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRST ./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTU /0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUV 0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW 123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWX 23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXY 3456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ 456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[
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:
cd /usr/lib/lpd/pio/burst cat H.ps > /dev/lp0
NOTE: Some printers that are capable of automatically detecting whether the incoming data stream is in postscript format and switching to postscript mode accordingly do so only if a PJL command is prefixed to the data stream. In the case of printers where the command is lacking, the postscript source code will be printed.
Failures of the preceding test (lptest or cat) will be of three kinds:
The system has sent the data out the port. In most cases where there is a printer buffer (or 'online') light, this light will flash indicating receipt of data. The printer most likely was not set to receive data in the format sent (e.g., ASCII text was sent to a printer set to receive postscript data). While the data reached the printer buffer, the buffer was flushed. Check the printer mode and set it to match the data type sent,or send the appropriate data type.
The system has sent the data out the port, but the printer has not accepted it. Some printers do not accept data on their RxD line unless the printer DSR signal is high. Wire the cable so that DSR goes high when the system DTR signal goes high (DTR goes high when the system sends data).
cannot open the specified fileor
cannot create the specified file
The system is unable to send data out the port due to wrong cabling or a wrong printer setting. The system is not getting the CTS signal. CTS indicates that the printer is present and switched on. This signal is normally sent along the printer RTS line. CTS is expected to be high at all times. In some cases the printer will have a setting for this (possibly listed as an RTS option which should be set to 'true' or 'high').
Try the Ctrl-C key combination. If the prompt returns with a message, see 2) above. If the prompt returns without a message, check use of the lp by:
fuser /dev/lp1
(For a method which may be used at AIX 3.2.x in addition to fuser, see Appendix A)
In the example of 'lp1' above, the following should be returned:
/dev/lp1:
If there are any numbers after the colon, processes associated with the lp have been identified. To find 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, there is probably a flow control problem. 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, then 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:
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 by:
fuser -k /dev/lp1
Verify that the processes were killed by:
fuser /dev/lp1
If unsuccessful, detach the printer cable from the system. If still unsuccessful, try:
kill -9 PID
If this is unsuccessful, a system reboot is needed. If upon reboot the processes reappear, then deactivate the queue as indicated in Appendix B.
If a queue is used for printing and there is printed output from using the cat or lptest commands in the section above, attention should be turned to the queuing system.
In the examples, 'lp0q' and 'lp1q' are the queues that point to 'lp0' and 'lp1' respectively.
To view the status of queues you may use:
lpstat
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' you can try:
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 C.
If repeated lpstat's show the queue hanging for several minutes in a DEV_BUSY or DEV_WAIT state, check the file= field for that queue by entering:
pg /etc/qconfig
and using the ENTER key to page through the file. In the example queue and device, this would show:
lp1: file = /dev/lp1
If the file= field does not have /dev/lp#, contact your AIX support center. Another method is:
lsque -qlp1q
to get the device name. In the example the following would be returned:
lp1q: device = lp1
With the device name, you could run:
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 is the case where queues were added/removed/changed while the queuing system was in use. To cycle the qdaemon, use:
stopsrc -cs qdaemon startsrc -s qdaemon
Stopping the qdaemon may cause currently printing jobs to be abandoned in which case those jobs will not resume where they left off upon restarting the qdaemon.
Another method useful for tracking down a process that is holding a port is to use the crash command. In addition to process determination, this method allows one to determine whether an exiting process has hung the port. In those cases where fuser has not returned a PID, suspect a hung port. To confirm this use the following command (this applies only to AIX 3.2.x):
echo tty lp1|crash|pg
This should return information similar to the following:
lp1: tp=0x05b2f400, dev:(12,774) chan:(0x0) sid:0x00000000 group:0x00000000 tsm:0x00000000 id:60 port status: iclose ccnt=0 ... etc.
If 'port status' is anything except 'iclose ccnt=0', check the Session ID (SID). SID identifies the process. In the example above there is none, as the field after the 0x is all zeroes. Where the port status is other than 'iclose ccnt=0', there are flags against the port. If in addition the SID is all zeroes after the 0x, there is no process registering as holding the port; the remedy to clear the port is to reboot the system. Should the problem recur after reboot, consider deactivating the queue (if one is used in printing),(See Appendix B.).
The SID is given in hexadecimal notation. To convert this to decimal do the following (replacing SID below with what follows 0x and using capitals for any letters):
bc ibase=16 SID quit
After the SID has been converted to the decimal PID, use:
ps -ef|grep PID
replacing PID with the number returned from the SID conversion.
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, do the following:
stopsrc -cs qdaemon chque -qlp1q -dlp1 -a"up = FALSE" startsrc -s qdaemon
To reactivate the queue, use 'smit' or run the above commands substituting TRUE for FALSE.
At minimum the following should be checked. This is especially true if only 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 /etc/pioout 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 use:
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.