Removing a Lock from the Print Queue

Sometimes the print queue will get stuck. On any host, as anyone, type:

%lpq -P printername

The results may look like this:


Mon Nov  6 12:03:32 2000: waiting for lock on color
Rank   Pri Owner      Job  Files                                 Total Size
1st    0   mathews    564  (standard input)                     897 bytes
2nd    0   alexm      162  bio                                  596 bytes
3rd    0   root       916  /opt/transcript/lib/ehandler.ps      2821 bytes   

You know this printer is locked because the first line of the output from lpq says "waiting for lock." If the printer is stuck, and it doesn't say "waiting for lock", any user can log into bigdog and type:

%lpc restart printername


If the printer is waiting for a lock, here's what to do:

First, if you don't know the real name of the printer (it should be hpxx, where xx are numbers), type:

%printers | grep printername

The name you're using will appear in a list like this one:


hp02 (color, lasercolor, hplj4500):

To clear the lock, log in to bigdog as root. Type the following:

#lpc down hpxx

This disables queuing for this printer while you fix the problem. You should get a response something like this:


hp02: printer and queuing disabled

#ps -ef | grep hpxx

This will show the accounting jobs running in support of this printer (usually two or so). The output should look something like this:


daemon    20122  20226  0.0 14:20:37 ??           
0:00.05 /opt/transcript/bin/ps
comm -P hp02 -p psif -n mathews -h godzilla.ucolick.org /var/adm/hp02-acct
daemon    20226      1  0.0 14:20:31 ??           
0:00.15 sh /opt/transcript/lib
root      20317  20277  0.4 14:33:28 ttyp6        0:00.01 grep hp02

Kill the accounting daemon jobs:

#kill -9 jobnumber

Repeat for all acct jobs (in this case, 20122).

#cd /var/spool/printers/hpxx

#rm lock

#lpc up hpxx

This re-enables the print queue. You should get a response like this:


hp02: daemon started

The printer should be running normally now. You will want to check the queue a few times afterward to make sure that jobs are passing through:

%lpq -P printername


Mon Nov  6 15:13:04 2000: Attempting to print dfA905babar.ucolick.org
Rank   Pri Owner      Job  Files                                 Total Size
active 0   gst131     905  /tmp/psk2466a                        23783 bytes   

%lpq -P printername


Mon Nov  6 15:13:17 2000:
no entries   

Yay!