cups — fixing cups printer problem: lpd failed 
Introduction
Recently, our HP2420dn printer stopped working. Well, it was not really the printer… printing jobs went but nothing came out of the printer. The cups server has put the printer into a stopped state with the StateMessage /usr/lib/cups/backend/lpd failed. What caused this? Well, I am not really sure, however the cups server error logs (http://localhost:631/admin/log/error_log, or alternatively /var/log/cups/error_log) tell at least part of the story, as shown below.
... I [22/Sep/2007:12:36:40] Adding start banner page "none" to job 835. I [22/Sep/2007:12:36:40] Adding end banner page "none" to job 835. I [22/Sep/2007:12:36:40] Job 835 queued on "printer" by "kamil". I [22/Sep/2007:12:36:40] Started filter /usr/lib/cups/filter/pstops (PID 2607) for job 835. I [22/Sep/2007:12:36:40] Started backend /usr/lib/cups/backend/lpd (PID 2608) for job 835. I [22/Sep/2007:12:37:53] Adding start banner page "none" to job 836. I [22/Sep/2007:12:37:53] Adding end banner page "none" to job 836. I [22/Sep/2007:12:37:53] Job 836 queued on "printer" by "kamil". ... W [22/Sep/2007:12:41:41] [Job 835] Remote host did not respond with command status byte after 300 seconds! E [22/Sep/2007:12:41:45] PID 2608 (/usr/lib/cups/backend/lpd) stopped with status 1! I [22/Sep/2007:12:41:45] Hint: Try setting the LogLevel to "debug" to find out more. I [22/Sep/2007:12:41:45] [Job 835] Backend returned status 1 (failed) I [22/Sep/2007:12:41:45] Saving printers.conf… …
From the above error log fragments, it can be seen that the communication with the HP printer timed out, causing the lpd to exit with an error status. Now, because of this error, the cups server has stopped the printer. Later on I'll show you how to alter this default cups behaviour. Now, lets take a quick look at the printer queue status using the following command.
lpq
The printer is listed as not ready as is shown in the output below.
printer is not ready no entries
Interestingly, this error happend on a few workstations around the same time. Anyhow, there are number of ways to fix such a problem. One could remove the printer and then install it again. That fixes it, but there are simpler ways. One could use some sort of front end to cups configuration, such as its web interface (i.e. http://localhost:631/), to start the printer again. Or, one could edit cups config files directly, solution courtesy of Mr Brett Wildermoth. This is how I got our printer working again.
Fixing the problem
First, to verify that you are experiencing the same kind of problem as I did, run:
sudo cat /etc/cups/printers.conf
This should show you a list of installed printers with their settings and status, as show below.
# Printer configuration file for CUPS v1.2.10 # Written by cupsd on 2007-09-22 12:41 <printer> Info HP2420dn Location SPL DeviceURI lpd://123.234.103.10/printer State Stopped StateMessage /usr/lib/cups/backend/lpd failed StateTime 1190428905 Accepting Yes Shared Yes JobSheets none none QuotaPeriod 0 PageLimit 0 KLimit 0 OpPolicy default ErrorPolicy stop-printer </printer> <defaultprinter> Info richo afico 3030 Location outside spl DeviceURI socket://123.234.102.11:9100 State Idle StateTime 1183439409 Accepting Yes Shared Yes JobSheets none none QuotaPeriod 0 PageLimit 0 KLimit 0 OpPolicy default ErrorPolicy stop-printer </defaultprinter>
The above config file shows that there are two printers installed under cups with the following device URIs lpd://123.234.103.10/printer and socket://123.234.102.11:9100. The first printer (HP2420dn) is in a stopped state due to a lpd error. To fix the problem you'll have to replace the follwing two lines in the /etc/cups/printers.conf file:
State Stopped StateMessage /usr/lib/cups/backend/lpd failed
with this line:
State Idle
To achieve the above you could use your favourite text editor, or the following sed on-liner.
sudo sed -i -e '/StateMessage .*lpd failed/d' -e 's/State Stopped/State Idle/' /etc/cups/printers.conf
Have another look at the output of:
sudo cat /etc/cups/printers.conf
to double check that fixing the error lines worked correctly. My /etc/cups/printers.conf file now look as follows.
# Printer configuration file for CUPS v1.2.10 # Written by cupsd on 2007-09-22 12:43 <printer> Info HP2420dn Location SPL DeviceURI lpd://123.234.103.10/printer State Idle StateTime 1190428905 Accepting Yes Shared Yes JobSheets none none QuotaPeriod 0 PageLimit 0 KLimit 0 OpPolicy default ErrorPolicy stop-printer </printer> <defaultprinter> Info richo afico 3030 Location outside spl DeviceURI socket://123.234.102.11:9100 State Idle StateTime 1183439409 Accepting Yes Shared Yes JobSheets none none QuotaPeriod 0 PageLimit 0 KLimit 0 OpPolicy default ErrorPolicy stop-printer </defaultprinter>
Then the final step is to restart the cups server using:
service cups restart
or alternatively:
/etc/init.d/cups restart
Note that on your platform cups daemon might actually be called cupsd. If so, you'll have to change the above commands accordingly to reflect this difference. Now, looking at the printer queue status once more (using the lpq command) we see that the problem is fixed.
printer is ready no entries
You may have noticed that there is an entry in the /etc/cups/printers.conf file called ErrorPolicy set to stop-printer. This could be changed so that the printer does not get stopped on an error. The other possible settings are abort-job and retry-job. You could use the following sed one-liner for this purpose.
sudo sed -i -e 's/ErrorPolicy stop-printer/ErrorPolicy abort-job/' /etc/cups/printers.conf
Hope this helps!
Did you find the above information useful and interesting? If so, please support this site by using the blog directory links at the bottom of this page. Thanks for your support!
If you have any Linux related problems or questions then please feel free to post them on our Linux Forums: http://linux.dsplabs.com.au/forums.

April 18th, 2008 at 1:36 pm
Worked a treat, you rock!
May 16th, 2008 at 9:18 am
Just though you might like to know - your solution is helping keep the blood supply in Ireland flowing! Nice one guys!! Cheers, G.
May 16th, 2008 at 9:38 am
Greetings from Brisbane George, I am very happy this info was useful to you!
July 1st, 2008 at 9:40 am
Hey it was a real useful solution. I was getting the error - /usr/lib/cups/backend/socket failed and it still worked. Thanks a lot.
July 30th, 2008 at 1:38 pm
Dude, I love you!
September 30th, 2008 at 6:48 am
Thank you man. Your post just save me
October 1st, 2008 at 7:01 pm
Thanks for the solution! The restart commands did not work for me in Ubuntu 7.10
service cups restart or /etc/init.d/cups restart
So I just fire up cups http://localhost:631/
Went to the printer and hit restart. All fixed.
Your instructions made it easy to fix.
October 10th, 2008 at 12:15 pm
50 14 * * 1,2,3,4,5 sudo sed -i -e '/StateMessage Paused/d' -e 's/State Stopped/State Idle/' /etc/cups/printers.conf
55 14 * * 1,2,3,4,5 /etc/init.d/cups restart
I put this in a cron job. Darn lpd printer kept getting paused. This seems to be the cure to make sure it doen't get left paused. Thanks!!!
October 15th, 2008 at 6:52 pm
Thank you very much!
Excellent post, very esay to follow
November 15th, 2008 at 5:08 pm
This worked perfect! Thank God for the dsplabs & the internet! (It's sudo /etc/init.d/cupsys restart in 7.10 in case someone doesn't know.)
November 18th, 2008 at 10:38 am
Thanks for this…
The sudo sed -i -e 's/ErrorPolicy stop-printer/ErrorPolicy retry-job/' /etc/cups/printers.conf
and /etc/init.d/cups restart worked a treat.
—Redhat enterprise 5—
December 4th, 2008 at 10:44 pm
Thanks very much to you and to Google.
I learned something new today and the punters are happy, which is why we are here .
December 22nd, 2008 at 3:02 pm
Worked on this on and off for a couple of days. Didn't know where to start searching (Linux box or MS Windows with LPD); Google's second hit for "troubleshoot lpd" directed me to your site. This solved the problem. Thanks !
December 29th, 2008 at 8:17 pm
You saved me a lot of time. Thanks very much. Suse Linux 2.6.22.5-31……
February 17th, 2009 at 3:15 pm
why not use cupsenable to re-enable printer??
February 20th, 2009 at 11:39 pm
I'm an AIX SysAdmin but a newcomer to SUSE Linux (SLES10). Used your two-line replacement and cups restart solution and it worked GREAT! Your article was well-written–concise and easy to understand. Thanks a bunch from a Filipino dude in sunny Southern California.
SUSE Linux 2.6.16.60-0.21-default
March 7th, 2009 at 2:42 am
It did not work for me. CUPS seems to simply rewrite the file "printers.conf" file to what it was before, i.e.
State Stopped
StateMessage /usr/lib/cups/backend/lpd failed
March 11th, 2009 at 4:37 pm
I put the error message in to google and yours was the first hit. Well written documentation. I followed the advice and it worked just fine. In our case, it was a xerox printer where one of the color's toner was out for a while and so would not print. After the toner was replaced, obviously the "new" state of the printer didn't get back to the linux box (fc9).
April 17th, 2009 at 6:35 pm
Why not simply enable the printer?
/usr/bin/enable $printername works for me.
Other option could be to increase the timeout option from the configuration file for cups.
March 3rd, 2010 at 11:04 am
It is not work for me. CUPS seems to simply rewrite the file "printers.conf" file to what it was before, i.e.
State Stopped
StateMessage /usr/lib/cups/backend/lpd failed
just after giving print from my snow leopard and going to State Idle after resuming the printer manually after deleting the queue only
April 4th, 2010 at 12:30 pm
Hi akbar, this could happen for many reasons. Does it happen for any file? or only when you try to print one specific file? Some odd pdf files crash our HP2420dn printer for instance. If that is the case for you, then try changing the error policy as described at the end of the post, fix the file (e.g., conver to ps and back) or simply print it on another printer.
April 19th, 2010 at 5:41 pm
Thank you! I have never seen this problem before but the solution worked perfectly.
RH5 2.6.18-53.el5
May 4th, 2010 at 10:01 pm
Interesting post, thanks for sharing this
June 30th, 2010 at 9:09 pm
Clean and nice instructions.
Works well after CUPS update on Slack-13.1, restart with "/etc/rc.d/rc.cups restart" and everything runs again.
Thanks!