Removing CUPS in favor of LPRng

Submitted by olaf on 2014-07-13

My current system is Ubuntu, which uses CUPS as the default printing system.

While CUPS is a decent system for printing, supporting my printer and providing a nice gui, it has a big drawback: it doesn’t work reliably in my environment.

Sometimes it prints only the first page and then an error message, which wastes paper and forces me to print every single page separately. At other times, it doesn’t print at all, without showing any error message. And without removing the print job from the queue, causing all following jobs to stall.

Recently, I again wanted to print a job, waiting almost half an hour without a result. To put this annoying behaviour to an end, I ditched CUPS and installed LPRng

apt-get install lprng

This installs LPRng on a Ubuntu system and removes CUPS.

But it has its downsides too. You cannot print directly from an application anymore. You must print to a file first and then print the file from the command line


Another shortcoming is the lack of double sided printing. To fix the second problem first, you need to install package ifhp

apt-get install ifhp

Ifhp is a printing filter for the Berkeley lpr print spooler system. It allows double or single sided printing, manual feed tray, or paper size selection.

You need to tell ifhp, how duplex printing or tray selection is done. For my printer, a Brother DCP 8045D, this is just a few lines

# Brother DCP-8045D BR-Script3

[ dcp8045d ]


## select manual paper feed
ps_manual=<< /ManualFeed true >> setpagedevice

## singled sided printing
ps_simplex= << /Duplex false /Tumble false >> setpagedevice

## double sided printing
ps_duplex= << /Duplex true /Tumble false >> setpagedevice

## available -Z options
ps_user_opts = [
	simplex duplex manual

## I use magicfilter to print DVI files directly
## without the need to convert to Postscript
magicfilter_options = 
magicfilter_converter = /etc/magicfilter/ps600-filter \%s{magicfilter_options}

file_output_match = [
	*  ps  \%s{magicfilter_converter}

In this configuration, I use magicfilter to allow printing other formats like DVI transparently. For this to work, you must also install the magicfilter package.

apt-get install magicfilter

The next step is to tell LPRng to use ifhp as a printer filter. This is done in the /etc/printcap file

lp0|Brother DCP 8045DN:

The relevant entries are ifhp=... and if=..., which give some arguments to ifhp and the path to the ifhp executable itself.

If your printer is included in the default /etc/ifhp.conf file, you don’t need to configure ifhp yourself. You can just pass the model of your printer in /etc/printcap, e.g.

lp|HP LaserJet 5mp:

Now you can print double sided documents on the command line

lpr -Zduplex

Which still leaves the first problem, missing a little more user friendly way to print a file than using the command line. I chose the file manager Nautilus for this task.

When you right click on a document, you see a popup with a menu entry Open With. The submenu contains applications to chose from and as a last item has an entry Other Application... (Show other applications). The applications, you can select from, are .desktop files in the directories /usr/share/applications, /usr/local/share/applications or ~/.local/share/applications in your home directory.

I created two files print-lprng-duplex.desktop and print-lprng-simplex.desktop and put these into /usr/local/share/applications

[Desktop Entry]
Name=Print (duplex)
Comment=Print with lprng (duplex)
Exec=/usr/bin/lpr -Zduplex %F

Single sided printing looks almost the same

[Desktop Entry]
Name=Print (single sided)
Comment=Print with lprng (single sided)
Exec=/usr/bin/lpr %F

Now you can print to a file, select the file in the file manager and print with a right click and Open With.

1 Comment

Anonymous on 2015-06-07 23:09:00 +0200

I wouldn’t CUPS is excellent

Post a comment

All comments are held for moderation; Markdown and basic HTML formatting accepted. If you want to stay anonymous, leave name, e-mail and website empty.