We have 2 network attached HP LaserJet 400 M401dne, and we need them to print invoice PDFs directly from server command line.

I have added the printers to CUPS and created a printing class(invoices) that contains these two printers.

Then I have set a cron job, which checks a directory for invoice files and sends them to print when it finds any, then moves the files away.

lpr -P invoices -# 4 {list of pdf files}

It seems, however, that whenever there are more than 4-5 invoices to print at the same time, something happens -- printer becomes unresponsive to cups and the cups job stays in queue forever, not printing and not canceling the print.

The printer in the meantime still accepts printouts from windows printing system, which uses it in parallel.

What seems to work, is to cancel all print jobs in cups, hardware-cycle the printer and doing cupsdisable/cupsenable(not sure if the last is needed).

However, there should be some solution so that CUPS is not sending jobs to printer, before it is ready to accept them.

What could be the issue?

Perhaps I need to select a different printing protocol? At the moment I use what the CUPS admin webpage sggested:


But maybe I should use IPP or other protocol? If so, how can I find out the IPP queue name for the HP printer?

Or perhaps I should use different printer driver instead of: HP LaserJet 400 M401dne Postscript (recommended) ?

UPD: lpstat - v output:

device for invoices: ///dev/null
device for default: ///dev/null
device for HP_LJ_PRO_400_1: dnssd://HP%20LaserJet%20400%20M401dn%20(072E87)._ipp._tcp.local/?uuid=564e4633-4430-3134-3232-6c3be5072e87
device for HP_LJ_PRO_400_2: dnssd://HP%20LaserJet%20400%20M401dn%20(636536)._ipp._tcp.local/?uuid=564e4835-5030-3038-3636-c8cbb8636536
device for HP_HP_LaserJet_P2055dn: dnssd://HP%20LaserJet%20P2055dn%20%5B0E39EF%5D._pdl-datastream._tcp.local/
device for Ricoh_1515: lpd://
  • lpstat -v output, please.
    – ewwhite
    Commented Jun 1, 2017 at 6:44
  • added output for lpstat invoices is a class, as well ad default
    – Gnudiff
    Commented Jun 1, 2017 at 7:43

2 Answers 2


I recommend using socket printing on port 9100:

device for invoices: socket://

Easy config:

# lpadmin -p invoices -v socket:// -E 
  • thank you, I have changed to socket, let's see if it helps. I was also told that I perhaps shoukd try PCL5 printing instead of postscript, but not sure if there are pcl drivers for linux
    – Gnudiff
    Commented Jun 1, 2017 at 8:15
  • this worked. Now I have some other issues --- cups page.log is missing a lot of files printed -- it shows last printout 5 hours ago, with job id 238, but the job printing right now is with id 244, there are some 6 jobs which have printed meanwhile (checked with operator in place), but without getting into logfile for some reason.
    – Gnudiff
    Commented Jun 1, 2017 at 20:02
  • Turns out, this didn't help fully. CUPS still sometimes gets stuck, but now it seems a problem on CUPS side.
    – Gnudiff
    Commented Jun 1, 2017 at 21:03

So far it seems that the best option is to use ipp://printer-ip/ for adding this particular printer.

Using a generic HP LJ PCL6 driver (PCL5 has been recommended somewhere on the net as the best driver for printing PDFs on HP printers) yielded problem of printer not accepting copy parameter (lpr -# parameter), so I switched back to CUPS recommended Postscript driver for those.

When using socket:// interface, there were still some hiccups with print jobs no more accepting jobs and them hanging in queue with "Connecting to printer" status, and cups server needed to be restarted manually for this to go away.

After switching to ipp this hasn't happened.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .