Printers Cheat Sheet - May 1998



Basics...

We mostly use the standard lp printing software (System 5) on our computers, but one computer, the print server, must also have the BSD lpr software set up on it too. This system works as follows:

  1. Person issues lp on machine A.
  2. Machine A runs script in /var/spool/lp/interface/<printer_name> which sends request to print server machine and printer_name specified in script.
  3. Print Server (PS) machine gets request, runs its copy of script in /var/spool/lp/interface/<printer_name>, which converts the file to PostScript format, then issues an lpr command to send the converted file to the printer.
  4. lpr prints the file.

Of course, the above scenario is only if everything is working. If you are reading this, something has probably screwed up. The troubleshooting section of this document, attempts to guide you through this process, looking for problems along the way.

The lp parts of this process doesn't seem that complicated. There is a deamon out there that sits and waits for someone to type in lp something. When it finds that someone has done that, it runs the script in the interface directory. The majority of these scripts are just a copy of the netface script that SGI supplies in the models directory. On the print server machine(s), this is a script that TJ modified a long time ago. I think it originally started out as one of the standard things in the models directory, but SGI changes those a little bit with every release.

The lpr stuff is harder to understand. One of the SysAdmin books that I once read proclaimed "lpr to be the flakiest program within UNIX". The /etc/printcap file is the starting point for this system. The basic idea is that you put everything into this file, and the daemon(s) take it from there. You don't have much other control...

As a final word of warning, the way we have stuff set up here is not the SGI "recommended" way of handling this stuff. They will tell you that we should buy there printer-handling software (impressario?).

Files and Directories...

/var/spool/lp - The directory with all of the lp printer information in it.

/var/spool/lp/log - The log file for lp.

/var/spool/lp/interface/* - The scripts that are run when a print job is submitted.

/var/spool/lp/activeicons/* - Not sure why they must be there, but gives an error if they are missing.

/etc/printcap - The file that defines lpr printers to the print server machine.

/pi/wwrich/bin/printerdef - A script that sets up all of the current printers on a non-print server machine.

/pi/wwrich/bin/printerone - A script that sets up one of the current printers on a non-print server machine.

/pi/wwrich/bin/printer_icons - A script that copies up all of the current printer icons to all machines. (from the one you are currently logged onto).

Troubleshooting...

The first thing to do is to check the log files on both the machine that the print job was submitted on, and the print server it was sent to. Often the log will tell you what the problem is/was. Unfortunately, too many times, the log claims everything is fine.

The most common problems related to printing is the users .rhosts file. This is especially true when that is the ONLY person having problems with printing on that machine. The .rhosts file should contain the line localhost lp. The 2 lines for the machine they are using, plus the two lines for the print server machine must also be present. In addition, the permissions and ownership for this file must be correct. The permission should be 600 (-rw-------), and they must be the owner.

Check the type of file that is not printing. The command file <name> reports a type. The script that converts files to PostScript can only deal with certain types. These are: ascii, command, English, ext, script. Any type that does not contain one of these words will not be processed. Graphics files are handled separately. TJ wrote the parts of the script that handle graphics files. Ask him.

If the file is erased before it is finished being printed, this will cause problems. This will appear in the log file as something like "file not found".

Checking the printer daemons is another good thing to try. The command lpstat -t will give you the full status report on all lp printers. If a daemon is down or screwed up, you can stop it with lpshut, and restart it with lpsched. The watcher daemon should inform you if this daemon is down. The lpstat -t command should also tell you if the printer in question is not defined (by not telling you about its status). These checks should be done on both the machine where the request originated, and the print server machine.

Look at is the script in the /var/spool/lp/interface directory. Is the name of the print server machine correct? Is the name of the printer on the print server correct? In newer versions of IRIX, the machine that creates the print job wants a file in the /var/spool/lp/activeicons directory for each defined printer. If these are missing, copy these file(s) from a machine that has them there. I have a script in ~wwrich/bin that checks for, and copies missing entries into this directory. This script is called printer_icons.

The command lpq -P<printer> will report things in the lpr queue for a specific printer (if you don't specify a printer, it chooses the one known as "lp" in the /etc/printcap file). Try the lpc restart all command to restart the BSD lpr daemons on the print server machine if things are in the queue and not printing.

Now, check the /etc/printcap file on the print server. Is it there? Can you ping the names listed as the "rm" entries? Does the nameserver know them? (nslookup <name>)

Sometimes, I just make the person resend the print job, or I print it myself. Keep in mind the process described in the first part of this document, then try to trace it back. Can you print that file from the print server? Can you print that file from their machine? Can they print that file from the print server? Can they read that file? Can they sign on to the print server?

Setting up a new machine...

Setting up a new printer on a "normal" machine

I have used the printer "k201a" in this example. Of course, you should use whatever name the new printer should have.

This procedure is also somewhat automated by the scripts printerdef and printerone in my bin directory.

Setting up a new printer on the print server machine


Last updated: