LPD seems to die: an AppleTalk/SAMBA Solution
Late Breaking News! For some reason, I’ve been having good luck restarting LPD after a sleep by doing the following: using the terminal, sudo su, and then type /usr/libexec/lpd. This seems to restart the LPD daemon contrary to my notes below. Once done, you can restart individual queues by lpc restart printername , where printername is the name of one the print queues we’ve defined. I’ve also been informed that in the Print Center, stopping and then starting individual printers will reset stall queues. Please read ahead, though, if this doesn’t work for you.
For some reason parts of the LPD system seem to die during log-off/sleep sessions. No one seems to be able to explain why, and of course, this means there’s no way to rectify it. The symptom of this is that your print jobs, after waking the computer, will go through the Print Center and be spooled with no problems (this part of the print system does work). However, the jobs are never processed through the print filter (and thus are never printed). So on one part, the print system works, and the NetInfo-defined printer works, and the job ends up in the spool directory. But, the input filter – our print filter – is never executed. Restarting the computer always resolves the problem, but the Unix-conventional methods never seem to solve the problem. For example…
lpc restart ghostscript
…should restart the queue named ghostscript, but it fails with a “bootstrap_lookup” failure and “unknown printer” failure (as if NetInfo isn’t working for some reason).
Well, as said, restarting the computer will fix everything. As soon as you print a new job after restarting, all of the previous, queued jobs will also print out. But there are times when you don’t really want to wait for the computer to restart just to print a job. The following instructions will get you printing until you can restart the computer.
Here’s the trick: once the jobs are queued in the queue directory, and your lpd.filter is set up for AppleTalk or SMB printing, we don’t need LPD to send the job to the printer. We’re using atprint or smbclient, remember? Follow this example as root:
- cd /var/spool/lpd/ghostscript
- puts us in the directory where the print jobs – PostScript files – have been put to wait for further processing.
to get a directory listing of spooled jobs. It will look something like this:
-rw-rw---- 1 daemon daemon 158 Dec 30 22:20 cfA008localhost -rw-rw---- 1 jderry daemon 338236 Dec 30 22:20 dfA008localhost
In the directory listing, you can see that the two files are very, very similar in name. One is very small, and is owned by daemon, which is the “user” who conducts printing for us. If you were to examine this file in pico, you’d see that it contains some basic information about the print job (the owner, the filename, and so on). The other file, though, is owned by the user that printed it, and it’s considerably larger. This is a file generated by your Print Center printer, and is merely PostScript code. Thus, we can run it through our lpd.filter manually and force it out of the printer, like this:
/usr/local/lib/lpd/lpd.filter < /var/spool/lpd/deskjet970/dfA008localhost
Granted, the actual file name will change with every print job, so you’ll have to lookup the file name each time you want to manually print jobs in the queue. There’s also the problem that the files, after running them in the filter, are still in the queue. We can clear them the “right” way like this, as root:
- lprm –P ghostscript -
- removes all jobs for all users on the printer ghostscript. See man lprm for various, other uses.
You will see confirmation that the files were removed from the queue.