Question & Answer
Question
Remote Printing using the LPR/LPD Protocol
Answer
This document describes how to set up remote printing by using the LPR/LPD
protocol. The following information applies to AIX Version 4.3 and higher,
including 5.x.
How the LPR/LPD protocol works
How to set up an AIX print client to an LPD server
How to set up AIX as an LPD server
Details of local formatting
Remote printing flags and status filters
Remote printing status
Tracing remote printing
Rembak debug output
LPD debug output
Problem determination
Streaming LPR/LPD
Rembak flags
Canceling remote jobs
How the LPR/LPD protocol works
Printing using the LPR/LPD protocol is defined in an RFC 1179. This Request For Comment, although never officially adopted as a standard, is used by most computer, terminal server, printer server, and printer manufactures for doing network printing. Be aware that the standard is incomplete, and does not define any type of error handling, retry capability, or what the client should do when the server is busy. This often times creates problems when printing to network attached printers and print servers using this protocol. When possible, it is recommended when printing to these devices, use the proprietary protocol or socket program provided by the manufacturer. When this is not done, frequently the queue will go down.The basic syntax of remote printing using LPR/LPD is as follows:
- Client sends a print request to server specifying a queue name.
- Server acknowledges that the queue exists.
- Client sends a packet that contains the temporary filename, and the number of bytes in the file.
- Server acknowledges that it has room to accept the job.
- Client sends the data file to be printed.
- Client sends a packet that contains the control file name and the number of bytes in the control file.
- Server acknowledges that it is ready to accept the control file.
- Client sends the control file.
- Server acknowledges that it has received the file.
- Client or Server sends a FIN packet to end transmission.
How to set up an AIX print client to an LPD server
AIX 4 allows both local and remote formatting. Local formatting allows a virtual printer to be set up on the local system that will send the data to the remote system with local headers and printer setup information attached. Remote formatting sends the data to the remote server without doing any filtering or formatting of the file and without adding any printer setup commands.
AIX 4 setup with remote (standard) processing
Steps to create a remote queue with no local formatting.
This creates a queue with the rembak backend. It is assumed that the remote system will add headers and trailers, as well as add carriage returns to line feeds. This is the method used by default prior to AIX 4, enter:smit mkpq
- Select remote Printer Attached to Remote Host
- Select Standard processing
- Fill in entries on Add a Standard Remote Print Queue screen.
- Name of QUEUE to add - Enter queue name on AIX client.
- HOSTNAME of remote server - Enter <hostname> or IP address of server.
- Name of QUEUE on remote server - Queue must exist on server.
-
TYPE of print spooler on remote server - Depends on server type.
- Determines format of remote queue status requests.
- Determines format of print flags sent to remote server.
- Use AIX Version 3 or 4 only if printing to other AIX.
- Use BSD for most other servers.
- Use System V for AT&T and possibly SUN.
-
Backend TIME OUT period (minutes)
Set this to 5 minutes if you are printing over a WAN, or to a print server that can take only one job at a time. When printing to other UNIX servers, including AIX, this can be left blank. - Send control file first? No
This can be set to yes when printing to print servers that ignore the control file and start printing as soon as the file is received. - To turn on debugging, specify output file pathname
By setting a filename, the output can be used to debug the problem. Example output is described in the section Rembak debug output. - DESCRIPTION of printer on remote server
(Use for own record keeping)
- Press Enter to create queue.
AIX 4 setup with local formatting
In this section, you create a local queue that uses an AIX virtual printer to first add printer setup commands and format the data prior to sending the file to the remote hosts. The backend program for this kind of a queue is piorlfb which calls piobe (the virtual printer backend), and then uses rembak to send the formatted file to the remote server.Reasons why you may consider setting up a local queue that uses an AIX virtual printer follow:
- So that local print flags work to select pitch, paper tray, orientation, etc...
- To have the formatter add carriage returns to line feeds to avoid stair step actions when printing.
Steps to create a remote queue with local (virtual printer) formatting.
- Enter smit mkpq
- Select remote Printer Attached to Remote Host
- Select Local filtering before sending to print server
- Select Printer Manufacturer
- Select Printer Type
-
FIll in the Add a Remote Print Queue with Local Filtering menu.
- Queue Names - Enter names to use on AIX system.
- HOSTNAME of Remote Server - Enter Server Hostname.
- Name of QUEUE on remote server - Enter queue on remote server.
-
Type of print spooler on remote server.
- Determines format of remote queue status requests.
- Determines format of print flags sent to remote server.
- Use AIX Version 3 or 4 only if printing to other AIX systems.
- Use BSD for most other servers.
- Use System V for AT&T and possibly SUN.
-
Backend TIME OUT period (minutes)
Set this to 5 minutes if you are printing over a WAN, or to a print server that can take only one job at a time. When printing to other UNIX servers, including AIX, this can be left blank. -
Send control file first? no
This can be set to yes when printing to print servers that ignore the control file and start printing as soon as the file is received. -
To turn on debugging, specify output file pathname
By setting a filename, the output can be used to debug the problem. Example output is described in the section Rembak debug output. -
DESCRIPTION of printer on remote server
(Use for own record keeping)
- Press Enter to create queues.
How to set up an AIX LPD print server
There are two steps to setting up an LPD print server on AIX. The first step is to start the lpd daemon on AIX.
- Start the lpd remote printer subsystem daemon on the Server
System.
The following is an outline:- Enter smit spooler (smit lpd can also be used).
- Select Manage Remote Printer Subsystem
- Select Server Services
- Select lpd Remote Printer Subsystem
- Select Start Using the lpd Subsystem
- Select Start now and at start of system reboot
- Choose "yes" or "no" at TRACE lpd daemon activity
to syslog?
(Tracing will be described in the debug section of this document.) - EXPORT directory containing print attributes? Typically no
- Press Enter to start the system.
- Check to see if the lpd is running, enter:
ps -ef | grep lpd 3
NOTE: The command lssrc -s lpd can also be used for step 10.
- Set up the hosts allowed to print to the server (Host B).
The following is an outline:- Enter smit spooler (smitty lpd can also be entered).
- Select Manage Remote Printer Subsystem
- Select Add Print Access for a Remote Client
- For Name of REMOTE CLIENT, enter the hostname or IP address of client.
- Type enter or click DO.
- Once the hostname has been added, check for the name by entering:
grep <hostname> /etc/hosts.lpd
NOTE: To allow all hosts to print to your server, enter a "+" symbol in the /etc/hosts.lpd file.
Details of local formatting
With normal processing, the filename is passed to the AIX lpr program (rembak), which sends the file to the remote lpd server without making any changes or additions to the file. When setting up a remote queue with local formatting, the backend program is /usr/lib/lpd/pio/etc/piorlfb. In addition to creating the queue, a virtual printer is also created. You can see the virtual printer file in the /var/spool/lpd/pio/@local/custom directory. You can also make changes to the virtual printer through option 2 in the SMIT shortpath smitty chpq after selecting the queue name. If you examine the piorlfb shell script you will see that it pipes the file to piobe (the virtual printer backend), and the output is redirected to a temporary file in /var/tmp/, starting with piorlfb_. This filename is then given to rembak which sends the formatted file to the remote print server. The output that is created is identical to that which would be created for a local printer on the AIX client.
The following list shows the entry in /etc/qconfig for a locally formatted remote queue:
asc:
device = @tesch
host = tesch
rq = asc
s_statfilter = /usr/lib/lpd/bsdshort
l_statfilter = /usr/lib/lpd/bsdlong
@tesch:
header = never
trailer = never
access = both
backend = /usr/lib/lpd/pio/etc/piorlfb -f ! -T5
Remote printing flags and status filters.
The SHORT FORM FILTER (and LONG) are simply shell scripts that format the status information coming back from the client to the server.
The values of aixshort and aixlong are only used when connecting from one AIX system to another. When connecting PC's, 3rd Party UNIX systems, Novel flexip, or some terminal servers, this can be changed to either bsdshort or attshort depending on the type of lpd daemon on the server system.
Examples of the status format are shown in Remote printing status.
In addition to formatting the status output, the value of the flags is also used by rembak in deciding which print flags to use.
Remote printing formatting flags
In the LPD protocol, flags are sent to the remote system in a portion of the transmission called the control file. This file can be read by using iptrace. The flag values are also recorded in the debug output of both rembak and lpd as described in the Problem determination section below.
Sample control file from iptrace output
00000000 48616978 34707274 0a50726f 6f740a66 |Haix4prt.Proot.f| 00000010 64664134 36366169 78347072 740a5564 |dfA466aix4prt.Ud| 00000020 66413436 36616978 34707274 0a4e2f76 |fA466aix4prt.N/v| 00000030 61722f74 6d702f70 696f726c 66625f31 |ar/tmp/piorlfb_1| 00000040 36393534 0a2d6f2d 640a2d6f 700a2d6f |6954.-o-d.-op.-o| 00000050 2d6a0a2d 6f300a2d 6f2d4a0a 2d6f300a |-j.-o0.-o-J.-o0.| 00000060 2d6f2d5a 0a2d6f30 0a2d4e31 0a2d5a72 |-o-Z.-o0.-N1.-Zr| 00000070 6f6f7440 61697834 7072740a 2d74726f |oot@aix4prt.-tro| 00000080 6f744061 69783470 72740a2d 542f7661 |ot@aix4prt.-T/va| 00000090 722f746d 702f7069 6f726c66 625f3136 |r/tmp/piorlfb_16| 000000a0 3935340a &n bsp; |954. &nbsThe flags in the control file can be divided into two groups:
- Flags defined by the LPR/LPD standard RFC 1179.
- AIX or enq flags
The first few flags in the control file above are flags from the standard:
- Haix4prt - Client Host Name.
- Proot - User submitting job.
- fdfA466aix4prt - Temporary File name to store data.
f - Identifies file as a Plain Text or Formatted File.
dfA - Identifier that this is the data file.
466 - Job number on the client.
aix4prt - Client host name. - UdfA466aix4pr - Unlink this File when finished (this is the temporary file).
- N/var/tmp/piorlfb_16954 - Name of file on client to be printed.
The actual content of this control file and the flags that are passed between systems depends on several things:
- Level of AIX
- The status filter type, also called the LPD type
- The print command that is used
- Command line flags
- At AIX 4, the type of remote formatting
local vs normal
Summary of command line flags and filters
- BSD and ATT Filters use flags defined by standard through Network.
- Passthrough to BSD or ATT LPD with lpr -l or qprt -fl.
- Passthrough to AIX systems (qprt -dp) will not be sent with BSD or ATT filters
- other -o flags will ONLY be sent with AIX filters.
- Virtual Printer flags will ONLY be sent with AIX filters,
except
for those defined by LPD RFC 1179 such as:
- qprt -i 10 - Indent text
- qprt -fl - Passthrough Control Characters
- qprt -Ban - Print Header Page (Passed as L)
- qprt -w 180 - Set text width
- qprt -ff (and other filter flags)
- Some flags NOT sent with BSD or ATT Filters include:
- qprt -l 60 - for page length
- qprt -p 17 - for setting pitch
- qprt -z+ - for setting landscape
- qprt -u 2 - for selecting paper drawer.
- qprt -Y+ - for Duplex Operation
Remote printing status
When obtaining the status of a remote queue, both the status of the local queue and the remote queue will be shown. This will usually give a status similar to the following:Queue Dev Status Job Files &nb sp; User PP % Blks Cp Rnk ------- ----- --------- --- ------------------ ---------- ---- -- ----- --- --- gena @tesc READY <---- client queue gena, queue device @tesch gena genas DOWN <---- server queue genasc, queue device lpx QUEUED 167 STDIN.22612 root &nbs p; QUEUED 170 /etc/motd root@aix4p &nbs p;
The exact format of the remote status will depend on the type of LPD running on the server as well as the stat filter set up in the client queue.
In the case above, The local (client) queue is empty and shows that the data has already been passed to the remote queue, which is down. The queue on the remote (server) system also has a job #167 that was sent locally on the server.
The following output comes from an IBM Network Printer using a bsdshort filter.
# lpstat -vbsdtest Queue Dev Status Job Files User PP % Blks Cp Rnk ------- ----- --------- --- ------------------ ---------- ---- -- ----- --- --- bsdtest @9 READY bsdtest: 1 entries bsdtest: 0 - port busy. No info
The same printer using the attshort filter shows:
# lpstat -vbsdtest
Queue Dev Status Job Files User PP % Blks Cp Rnk
------- ----- --------- --- ------------------ ---------- ---- -- ----- --- ---
bsdtest @9 READY
0 0 1 1 1 0 Unknown entries
0 Unknown - 0 0 1 1 2
The queue name for both lines of the status will show the client queue name as the name, but the Device will show the client device (usually the server name), for the local status line and the server queue name for the device name of the remote queue status line.
NOTE: Only five characters of the device name will display.
Viewing only remote queue status with two queue devices
If the server has two queue devices for the queue, you will see three lines in the status as in the example that follows:#lpstat -vteschasc Queue Dev Status Job Files &nb sp; User PP % Blks Cp Rnk ------- ----- --------- --- ------------------ ---------- ---- -- ----- --- --- teschas @tesc READY <---- client queue teschasc:@tesch teschas asc READY <---- server queue asc:lp0 asc lpxt READY <---- server queue asc:lpxtNote that the third line (the second queue device on the server queue) has the queue name of the server queue.
Viewing only local queue status
One frequent problem encountered with remote queue status is the long wait for queues to time-out if the remote server is down. Sometimes it is only important to check the status of the queues on the server. This can be checked using the following commands:- AIX 3.2, enter: enq -sA
- AIX 4, enter: enq -isA
Tracing remote printing
- All printing using the LPR/LPD protocol is sent to port 515. This makes it
is easy to trace remote printing with the command:
iptrace -p 515 -a -b -s client -d server /tmp/trace.file
-
Print something small and simple - similar to the following:
echo "AAAAA" | qprt -Premque
-
After issuing the command in step 2, print and check the size of the
/tmp/trace.file.
If the file is greater than 11 bytes, find the process ID of the iptrace
program and kill the process:
ps -ef | grep iptrace kill PID
-
Once this is done, format the data with the following command:
ipreport -n /tmp/trace.file > /tmp/trace.report
- To see everything that was sent back and forth, grep this file for
0000.
This will give output similar to the following if the server has not setup the
host permissions. This would indicate that the server should be added to the
/etc/hosts.lpd
file.
# grep 0000 /tmp/aaaaa.rpt 00000000 036a756e 6b0a |.junk. | 00000000 30373831 2d323032 20796f75 7220686f |0781-202 your ho| 00000010 73742064 6f657320 6e6f7420 68617665 |st does not have| 00000020 206c696e 65207072 696e7465 72206163 | line printer ac| 00000030 63657373 2e |cess. |
The following is an example of a good print job: Note that it shows the file size (6), the temporary filename (dfA329tesch), the actual data in the file (AAAAA), the control file size (96), the control file temporary name (cfA329tesch), and the control file with the flags.
00000000 00 |. | 00000000 03362064 66413332 39746573 63680a |.6 dfA329tesch. | 00000000 00 |. | 00000000 41414141 410a |AAAAA. | 00000000 00 |. | 00000000 00 |. | 00000000 02393620 63664133 32397465 7363680a |.96 cfA329tesch.| 00000000 00 |. | 00000000 48746573 63680a50 726f6f74 0a666466 |Htesch.Proot.fdf| 00000010 41333239 74657363 680a5564 66413332 |A329tesch.UdfA32| 00000020 39746573 63680a4e 53544449 4e2e3231 |9tesch.NSTDIN.21| 00000030 3736300a 2d4e310a 2d5a726f 6f744074 |760.-N1.-Zroot@t| 00000040 65736368 0a2d7472 6f6f7440 74657363 |esch.-troot@tesc| 00000050 680a2d54 53544449 4e2e3231 3736300a |h.-TSTDIN.21760.| 00000000 00 |. | 00000000 00 |. |
Rembak debug output
When you create or modify a remote queue, you can specify the log file in the line:
To turn on debugging, specify output [/tmp/testdbg.log]
file pathname
This adds the -D flag to the backend line as shown below:
backend = /usr/lib/lpd/rembak -D /tmp/testdbg.logThe following example shows how you would add a new queue with this option:
Add a Standard Remote Print Queue
Type or select values in entry fields.
Press Enter AFTER making all desired changes.
[Entry Fields]
* Name of QUEUE to add [testdbg]
* HOSTNAME of remote server [9.19.169.54]
* Name of QUEUE on remote server [junk]
Type of print spooler on remote server AIX Version 3 or 4 +
Backend TIME OUT period (minutes) [] #
Send control file first? no +
To turn on debugging, specify output [/tmp/testdbg.log]
file pathname
DESCRIPTION of printer on remote server []
When a file is printed, the output in the file will include information on the control file, the size of the job and other useful information. The following shows a sample file:
rembak[42216] main: Thu Feb 1 12:48:35 2001 rembak[42216] main: /usr/lib/lpd/rembak -D /tmp/testdbg.log -S 9.19.169.54 -P junk -N \n/usr/lib/lpd/aixshort /etc/motd rembak[42216] main: backend=1. rembak[42216] hookup: Try to connect, current time=981053315. rembak[42216] sendjob: sendjob starts, jobname=/etc/motd, current time=981053315. rembak[42216] sendjob: datafn[0]=dfA330tesch, fakedfn=dfA330tesch. rembak[42216] makecontrolfile: Entering makecontrolfile. rembak[42216] makecontrolfile: dfnames[0]=dfA330tesch rembak[42216] getbsdinfo: bsd3=Htesch\10 Proot\10 rembak[42216] get_bsd_4file: bsd nc=1 rembak[42216] get_bsd_4file: bsd strings: [N/etc/motd\10 ][N/etc/motd\10 ]\n[N/etc/motd\10 ][N/etc/motd\10 ] rembak[42216] getbsdinfo: bsd3=Htesch\10 Proot\10 fdfA330tesch\10 UdfA330tesch\10 \nN/etc/motd\10 rembak[42216] gettmpr: Opening file /tmp//rembak1EFo7a. rembak[42216] gettmpr: File /tmp//rembak1EFo7a opened successfully, fd=8. rembak[42216] sendjob: ctrlfname=/tmp//rembak1EFo7a, fakecfn=cfA330tesch. rembak[42216] sendjob: State machine starts..... rembak[42216] sendjob: State 1 - send the "Receive a Print Job" request. rembak[42216] sendreq: sendreq - sending lpd request [\2 junk\10 ]. rembak[42216] gotack: Reading ACK status.....current time=981053315, timeout_ack=90. rembak[42216] gotack: ACK status=0x0. rembak[42216] sendjob: state 3 - Send data file(s), dfcount=1. rembak[42216] sendjob: realfn=/etc/motd, fakefn=dfA330tesch, \nfilter=/usr/lib/lpd/aixshort. rembak[42216] sendreq: sendreq - sending lpd request [\3 880 dfA330tesch\10 ]. rembak[42216] gotack: Reading ACK status.....current time=981053315, timeout_ack=90. rembak[42216] gotack: ACK status=0x0. rembak[42216] senddatafile: Opening file /etc/motd. rembak[42216] senddatafile: File /etc/motd opened successfully, fd=9. rembak[42216] send_file_rembak: Reading 880 bytes from file, fd=9. rembak[42216] send_file_rembak: Writing 880 bytes to socket 7. rembak[42216] send_file_rembak: File sent. rembak[42216] ack: Send ACK. rembak[42216] send_file_rembak: waiting for ACK. rembak[42216] gotack: Reading ACK status.....current time=981053315, timeout_ack=90. rembak[42216] gotack: ACK status=0x0. rembak[42216] sendjob: State 2 - send control file, ctrlfname=/tmp//rembak1EFo7a, \nfakecfn=cfA330tesch. rembak[42216] sendreq: sendreq - sending lpd request [\2 92 cfA330tesch\10 ]. rembak[42216] gotack: Reading ACK status.....current time=981053315, timeout_ack=90. rembak[42216] gotack: ACK status=0x0. rembak[42216] sendcontrolfile: Opening file /tmp//rembak1EFo7a. rembak[42216] sendcontrolfile: File /tmp//rembak1EFo7a opened successfully, fd=9. rembak[42216] send_file_rembak: Reading 92 bytes from file, fd=9. rembak[42216] send_file_rembak: Writing 92 bytes to socket 7. rembak[42216] send_file_rembak: File sent. rembak[42216] ack: Send ACK. rembak[42216] send_file_rembak: waiting for ACK. rembak[42216] gotack: Reading ACK status.....current time=981053315, timeout_ack=90. rembak[42216] gotack: ACK status=0x0. rembak[42216] sendjob: State 5 - end of job #330 (/etc/motd). rembak[42216] sendjob: Delete control file /tmp//rembak1EFo7a.From the preceding example, you can see the entire process, from the command sent to rembak to the deletion of the temporary file.
LPD debug output
To use lpd debug you must enable the output in the /etc/syslog.conf file as well as turn on the debug flag for lpd.
Setting debug for lpd in /etc/syslog.conf
Follow these steps:
- Edit /etc/syslog.conf and add the following line:
*.debug /tmp/lpd.log
- Create the /tmp/lpd.log file.
# touch /tmp/lpd.log
- Refresh the syslogd daemon.
# refresh -s syslogd
Turn on the debug for for lpd
Follow these steps to turn on lpd debug:
- Stop the current lpd daemon.
# stopsrc -s lpd
- Use SMIT to start the lpd daemon, enter:
# smitty lpd
- Select Start the Print Server Subsystem (lpd daemon)
- Turn on the debug flag:
Start the Print Server Subsystem Type or select values in entry fields. Press Enter AFTER making all desired changes. [Entry Fields] Start subsystem now, on system restart, or both [both] TRACE lpd daemon activity to syslog? [yes] EXPORT directory containing print attributes? [no]
The following example shows the status and a print job:
# cat /tmp/nslddbug.log Feb 1 13:11:19 tesch syslogd: restart Feb 1 13:11:36 tesch lpd[45316]: 0781-205 request displayq short asc. Feb 1 13:12:16 tesch lpd[45320]: 0781-205 request recvjob asc.
To view more detailed output, enter the following:
# stopsrc -s lpd # startsrc -s lpd -a "-d -l -D /tmp/lpd.dbug"
Printing a job after entering the preceding commands shows a file similar to the following:
lpd[6726] main: Thu Feb 1 13:21:20 2001 lpd[6726] main: /usr/sbin/lpd -d -l -D /tmp/lpd.dbug lpd[42086] main: child process starts..... lpd[42086] doreq: lpd command=[\2 asc]. lpd[42086] doreq: (WARNING) 0781-205 request recvjob asc. lpd[42086] readjob: send ACK. lpd[42086] readjob: lpd command=[\3 880 dfA558aix4prt]. lpd[42086] readjob: CmdType 3 - receive data file. lpd[42086] chk_request: Entering chk_request, rq_str=[880 dfA558aix4prt]. lpd[42086] chk_request: rc=2, filename=dfA558aix4prt, *psize=880. lpd[42086] chk_request: Opening file dfA558aix4prt.981055283. lpd[42086] chk_request: Clearing file dfA558aix4prt.981055283, *psize=880. lpd[42086] chk_request: send ACK. lpd[42086] readfile: Entering readfile, file=dfA558aix4prt.981055283, size=880. lpd[42086] readfile: Opening file dfA558aix4prt.981055283. lpd[42086] readfile: File dfA558aix4prt.981055283 opened successfully, fd=7. lpd[42086] readfile: Reading 880 bytes from socket, fd=1. lpd[42086] readfile: Writing 880 bytes to file, fd=7. lpd[42086] noresponse: Read ACK status byte, current time=981055283. lpd[42086] noresponse: ACK status byte=0x0. lpd[42086] readfile: send ACK. lpd[42086] readjob: lpd command=[\2 120 cfA558aix4prt]. lpd[42086] readjob: CmdType 2 - receive control file. lpd[42086] chk_request: Entering chk_request, rq_str=[120 cfA558aix4prt]. lpd[42086] chk_request: rc=2, filename=cfA558aix4prt, *psize=120. lpd[42086] chk_request: Opening file cfA558aix4prt.981055283. lpd[42086] chk_request: Clearing file cfA558aix4prt.981055283, *psize=120. lpd[42086] chk_request: send ACK. lpd[42086] readfile: Entering readfile, file=cfA558aix4prt.981055283, size=120. lpd[42086] readfile: Opening file cfA558aix4prt.981055283. lpd[42086] readfile: File cfA558aix4prt.981055283 opened successfully, fd=7. lpd[42086] readfile: Reading 120 bytes from socket, fd=1. lpd[42086] readfile: Writing 120 bytes to file, fd=7. lpd[42086] noresponse: Read ACK status byte, current time=981055283. lpd[42086] noresponse: ACK status byte=0x0. lpd[42086] readfile: send ACK. lpd[4206] doit: cfn=[cfA558aix4prt.981055283]. lpd[4206] doit: get a line [Haix4prt]. lpd[4206] doit: get a line [Proot]. lpd[4206] doit: get a line [fdfA558aix4prt]. lpd[4206] doit: get a line [UdfA558aix4prt]. lpd[4206] doit: get a line [N/etc/motd]. lpd[4206] doit: get a line [-o-z]. lpd[4206] doit: get a line [-o+]. lpd[4206] doit: get a line [-o-Y]. lpd[4206] doit: get a line [-o1]. lpd[4206] doit: get a line [-N1]. lpd[4206] doit: get a line [-Zroot@aix4prt]. lpd[4206] doit: get a line [-troot@aix4prt]. lpd[4206] doit: get a line [-T/etc/motd]. lpd[4206] doit: exec enq cmd=[/usr/bin/enq -Pasc -r -troot@aix4prt -Zroot@aix4prt -N1 \n-T/etc/motd -o-z -o+ -o-Y -o1 /var/spool/lpd/dfA558aix4prt.981055283 ]. lpd[42086] readjob: No more commands, rc=0, ck=3. lpd[42086] main: child process stopsTwo important pieces of information are the flags in the doit: get a line lines and then the enq flags in the exec line.
You will only want to run lpd in this mode for a short time. After you have gathered the information, stop and restart the lpd daemon, enter:
# stopsrc -s lpd # startsrc -s lpd
Problem determination
Can you print to the local queue on the server?
You will not be able to print remotely if you cannot print locally.
Hostnames are important
Ensure that the name and address of the client system is in the file /etc/hosts of the server system and vice versa. This is not necessary if you are running a name server. If the client cannot look up the host by name, rembak will fail and the queue will go down.
Test to see if each hostname is accessible with the host or nslookup command.
host <hosta> host <hostb> nslookup <hosta> nslookup <hostb>Prior to setting up the remote queue on hosta, ensure that a local queue has been setup on hostb. For this example, assume the queue name on hostb is asc1.
Print to the queue asc1 while logged into hostB, by issuing the command:
lpr -Pasc1 <filename>To be able to print from the client hostnameA to the printer lp51, you will need to accomplish the steps in the following example.
Simple debug sequence
In this example we have a local queue named text on the server and a remote queue remtext on the client.
- Disable the local queue on the client, enter:
# disable text
- Disable the remote queue on the server, enter:
# disable remtext
- Print to the remote queue from the client, enter:
# qprt -Premtext /full_path/filename
- Check the status on the client to make sure the job is queued, enter:
# lpstat -vremtext
# qchk -Premtext
This should now show both queues as DOWN, and the job queued on the local client. - Enable the remtext queue on the server, enter:
# enable remtext
- Check the status on the client to make sure the job is queued, enter:
# qchk -Premtext
The remtext should show READY, and the remote queue should show DOWN with a job queued. - On the server check for the file in /var/spool/lpd, enter:
# ls -l /var/spool/lpd
Example output follows:total 6264 -rw-rw-rw- 1 root system 1011513 Jan 29 15:43 asc32 -rw-rw-rw- 1 root system 1011513 Jan 29 15:48 asc33 -rw-rw-rw- 1 root system 1011513 Jan 29 15:50 asc34 -rw-r----- 1 lpd printq 880 Feb 01 13:20 dfA557aix4prt.981055243 drwxrwxr-x 3 root printq 512 Apr 28 2000 pio drwxrwxr-x 2 root printq 166912 Feb 01 13:21 qdir drwxrwxr-x 2 root printq 1536 Feb 01 13:12 stat
- Copy the file to /tmp/testfile, enter:
# cp /var/spool/lpd/dfA557aix4prt.981055243 /tmp/testfile
- cat the job description file, enter:
# cat /var/spool/lpd/qdir/n0*
This will show the flags for the job. The file will end with something similar to the example below. The line that starts with -Ptext shows the flags that are enq valid flags. The flags below, that start with $#@! are -o flags for enq. The last line in the file is the temporary filename.
-Ptext-r-troot@aix4prt-Zroot@aix4prt-N1-T/etc/motd /etc/motd root@aix4prt tesch 0 $#@!-z $#@!+ $#@!-Y $#@!1 /var/spool/lpd/dfA558aix4prt.981055283 1
- Enable the server text queue, enter:
# enable text
- Did the job print?
If the job printed, it could be a timing issue. If the job didn't print, continue to step 12.
- Print the file you saved in /etc/testfile locally on the client. If this prints, the file is good. If this does not print, the file may be the problem.
- If the file prints, then the problem may be the flags.
Use enq to print the file and use the flags starting
with -Ptext as normal flags and add a -o before each
of the $#@! flags.
The important lines from the JDF (job description file) are:-Ptext-r-troot@aix4prt-Zroot@aix4prt-N1-T/etc/motd $#@!-z $#@!+ $#@!-Y $#@!1
The -t and -Z flags are not really important in this test. The enq flag to use is:enq -Ptext -r -N1 -T/etc/motd -o -z -o + -o -Y -o 1 /tmp/testfile
- Did this print? If it did not, the problem may be the flags. Try it without the -o flags. If it printed, the problem is probably caused by the permissions' settings.
Streaming LPR/LPD
Prior to AIX 4.3, the AIX printing subsystem always sent the data file before the control file. This means that when you print to network print servers, if the file is too large, all the data may not be sent before the devices buffer runs out. An update to RFC 1179 describes some new subcommands to the print command that allow the control file to be sent before the print job or to send a print job of unspecified length. These functions are implemented in AIX 4.3 and later operating systems. When adding a remote queue through SMIT, the additional options Send control file first has been added to the menu. The default is still no, but for network print servers this can be changed to yes.
The advantage of streaming LPR/LPD is that the print server has enough information as soon as it starts receiving data to print the data without waiting for the entire data file to arrive before starting the print job. This means that jobs of essentially unlimited length can theoretically be printed to devices that support this.
When AIX receives jobs as the print server, it can also receive jobs with the control file first, but because of the way that the qdaemon is implemented, the entire file must still be placed in /var/spool/lpd before the job can be submitted to enq to create the job description file and start the job printing to the local printer. This basically means that streaming works fully when AIX is the client, but only partially when AIX is the server.
Rembak flags
- -# JobNumber
- Specifies the JobNumber to cancel.
- -C
- Sends control file first. The lpd protocol allows two handshaking sequences
for processing a print job. The default consists of sending the data file(s)
first, followed
by the control file. The other sequence is to send the control file first,
followed by
the data file(s). If -C is specified, rembak will send the
control file first,
followed by the data file(s).
- -D DebugOutputfile
- Turns on
the debugging option for rembak. If no output file name is specified,
or if there are any problems creating or writing to the output file, the
debugging option is ignored. If the output file specified already exists, new
debugging output is appended to the end of it.
- -L
- Indicates a long (verbose) status request from the remote queue.
- -N Filter
- Indicates the machine type of the remote server. The filter name is
specified by the s_statfilter attribute in the /etc/qconfig
file. Values for the filter variable include the following:
- /usr/lib/lpd/aixshort
- Indicates the server is another AIX machine.
- /usr/lib/lpd/aixv2short
- Indicates the server is an RT with a Version 2 operating system.
- /usr/lib/lpd/bsdshort
- Indicates the server is a BSD machine.
- /usr/lib/lpd/attshort
- Indicates the server is an AT&T machine.
- -o Option
- Specifies an Option to be sent to the backend on the remote
server. (These Options are passed through the rembak
command.)
- -P Queue
- Specifies the name of the Queue on the remote server where the print job is sent.
- -q
- Indicates a short (abbreviated) status request from the remote queue.
- -R
- Restarts the remote queuing system.
NOTE: The -R flag is not supported when sending a request to an AIX system. The lpd daemon in AIX does not support such a request. The -R flag is supported only for compatibility with other systems.
- -S Server
- Specifies the name of the remote print Server where the print
request is sent.
- -T Timeout
- Sets a timeout period, in minutes, for rembak to wait for
acknowledgements
from the remote server. If no value is specified, a default timeout of
90 seconds is used. This default is also used if timeout is 0 or a negative
value.
- -u UserName@HostName
- Cancels a print job for UserName that was submitted from the
HostName machine.
NOTE: The queuing system does not support multibyte host names.
- -X
- Specifies that the rembak command send the -o
Option
to the remote server, even if the remote server is a non-AIX
machine. If the remote is a non-AIX machine, then the Option
is sent without the -o flag. Thus, -o -abc is sent as -abc.
To use the -X flag on a remote queue, the following line for the specific queue must be included in the /etc/qconfig file:
backend = /usr/lib/lpd/rembak -X
The qprt, lpr and other queuing commands are not guaranteed to work when -X is specified on a queue. Use the enq command.
- -x
- Cancels a job request. Use the -# JobNumber flag or the -u UserName flag to cancel a request.
Examples
- To print the files spinach, asparagus,
and broccoli on the queue popeye on the remote server
olive, which is an RT with a Version 2 operating
system, enter:
rembak -S olive -P popeye -N /usr/lib/lpd/aixv2short spinach asparagus broccoli
- To issue a verbose status request to olive
for the queue popeye, enter:
rembak -S olive -P popeye -N /usr/lib/lpd/aixv2short -L
- To cancel job number 23 on a remote
server submitted by user sweetpea from machine bluto,
which is a Version 3 machine, enter:
rembak -S olive -P popeye -N /usr/lib/lpd/aixv2short -x -#23 -u sweetpea@bluto
Canceling remote jobs
The cancel commands qadm, enq -X, and others will only cancel local jobs. If you are root, you can cancel jobs on a remote system with the rembak command:/usr/lib/lpd/rembak -S rhost -P rqueue -x -# 123 -u userid@hostYou must know the following:
- -S the hostname that the actual printer is on.
- -P the queue name on the above host.
- -x
- -# the job number as shown on the system that it was submitted from remotely.
- -u the userid@host of the account that submitted the job
This will allow you to kill any job that is in a queue - if it was submitted from a remote queue. You only need to be root on a system that has line printer access on the system where you want to cancel the job.
Historical Number
isg1pTechnote0357
Was this topic helpful?
Document Information
Modified date:
17 June 2018
UID
isg3T1000222