Difference between revisions of "LPRng"

From ArchWiki
Jump to: navigation, search
m (Usage)
(Start the lpd daemon)
Line 57: Line 57:
===Start the lpd daemon===
===Start the lpd daemon===
LPRng runs a daemon in background called {{ic|lpd}} to manage print requests. To start this daemon, type the two commands:
LPRng runs a daemon in background called {{ic|lpd}} to manage print requests. Enable and start this daemon using [[systemd]].  If these commands complete without complaint, you should be good to go.
{{bc|$ systemctl enable lpd.service
If any configuration files are changed, one must restart {{ic|lpd}}.
$ systemctl start lpd.service}}
If these complete without complaint, you should be good to go.  If any configuration files are changed, one must restart the lpd daemon.  Do this with the command
{{bc|$ systemctl restart lpd.service))}}
Note that this LPRng package assumes that systemd is running.  If some alternate initialization package is used, one must devise an alternate means of starting the lpd daemon.

Revision as of 03:37, 6 January 2015

The LPRng software is an enhanced, extended, and portable implementation of the Berkeley LPR print spooler functionality. While providing the same interface and meeting RFC1179 requirements, the implementation is completely new and provides support for the following features: lightweight (no databases needed) lpr, lpc, and lprm programs; dynamic redirection of print queues; automatic job holding; highly verbose diagnostics; multiple printers serving a single queue; client programs do not need to run SUID root; greatly enhanced security checks; and a greatly improved permission and authorization mechanism.[1]



Configuration consists of the following steps:

  • Set up control files
  • Configure filters
  • Create a printcap file and spool directories
  • Enable and start the lpd daemon using systemctl

Control files

Two control files must be configured, lpd.conf and lpd.perms. The default configurations in /usr/share/doc/lprng are adequate for a client computer printing to a remote printer. Copy these to /etc/lprng/lpd/. For a server receiving requests across the Internet, uncomment the last line in lpd.conf and configure permissions as documented in the comments in lpd.perms. The files lpd.conf.sample and lpd.perms.sample, located in /usr/share/doc/lprng, document more complex situations.

Configure filters

Postscript printers

If you have a network Postscript printer you are in luck. The sample postscript filter /usr/share/doc/lprng/psfilter converts PDF and text files to Postscript. Other file types are rejected. Copy this file to /usr/lib/lprng/lpd and rename it as desired. Then edit it to set your paper type and your choice of single-sided/double-sided printing. If you wish to have separate single-sided and double-sided print queues, make two copies with different names and edit appropriately.

Foomatic system

Another mechanism for print filtering is via the Foomatic system. This system used by CUPS. Install foomatic-filters-lprngAUR as the foomatic-rip program in the CUPS installation has been modified to remove LPRng support). Use foofilter as described above, editing for your desired {ic|.ppd file}}. Install the .ppd file in conformance with the path specified in foofilter. (/etc/lprng/lpd is a good location.)

To use Hewlett Packard printers, install hplip from the main distribution. This package has .ppd files for virtually all Hewlett Packard printers.

Ghostscript drivers

If you have a printer that has a Ghostscript driver, copy and edit gsfilter as above to set the appropriate driver and the paper type. You can discover the drivers available in your version of Ghostscript by typing the command

$ gs -h

Note that support for various printer features is typically limited and out of date with this option.

Printcap file

The /etc/lprng/printcap file tells LPRng about the printers you have and the print filters that need to be used. The printcap.sample file (in /usr/share/doc/lprng) provides a short tutorial as to how to set up a printcap file. The printcap fragments printcap_server and printcap_client in this directory also provide information. Generally, one computer should be designated as the server for one or more printers. Other client computers should send their print jobs to the server rather than the printer directly. The rather non-obvious server setup in printcap_server is needed to make print filtering work on network printers, as opposed to printers attached directly to the server computer via, say, a USB port. (See the reference manual[2].)

After creating the printcap file, run the command

$ /usr/bin/checkpc -f

This will check your configuration and create spool directories in /var/spool/lpd. If checkpc complains about something, address the issue and rerun.

Start the lpd daemon

LPRng runs a daemon in background called lpd to manage print requests. Enable and start this daemon using systemd. If these commands complete without complaint, you should be good to go.

If any configuration files are changed, one must restart lpd.


The lpr command is the printing tool in LPRng. The general form of use is

$ lpr [options] [file_to_be_printed]

If no file is specified, input is accepted on the standard input. The most useful options are -P printer and -K number_of_copies. In the absence of the printer option, setting the environment variable PRINTER to the name of the printer will tell LPRng which printer to use.

Other useful commands are lpq (examine the print queue) and lprm (remove a print job from the queue). See the man pages for lpr, lpq, and lprm.

CUPS and LPRng

CUPS may be used to access a printer on a server from a client machine on which LPRng is not installed. The trick is to configure CUPS to access the printer via the {{ic|lpd} protocol. This is easy to do using the web interface to CUPS. Also, since the server as set up here does all necessary print filtering, tell CUPS to use the raw filter. Alternative divisions between filtering responsibilities can be devised, depending on your needs.


A disadvantage of LPRng is that Gnome3/GTK3 (ncluding chrome and chromium) and KDE do not support lpr printing from their GUI. However, printing to a file and then using lpr works, though it is inconvenient. Gnome2/GTK2 applications (including Firefox, Mate, LXDE, and XFCE4) still support LPR printing. To make this work, create the file .gtkrc-2.0 in your home directory containing a single line

 gtk-print-backends = "file,lpr"

LXDE may create its own .gtkrc-2.0 file if the look and feel of the desktop are altered -- look in this file for instructions as to how to proceed.

The filter pdftops from the poppler package is used to create Postscript from PDF files in the print filters. Occasionally, pdftops produces bad or no output. An alternative filter, pdf2ps from the ghostscript package, can be substituted, but this filter has its own problems. For a one-shot case, just use pdf2ps or some other converter to produce Postscript and send that to the printer.

Double-sided printing of Postscript files is effected in the example filters by inserting a line of Postscript code right after the first line. For some Postscript files, this doesn't work. In this case, send the Postscript file to a single-side print queue. The print filter psfilter set up for single-sided printing does no filtering of Postscript files.