Differences between revisions 1 and 55 (spanning 54 versions)
Revision 1 as of 2015-08-09 23:29:34
Size: 14355
Editor: Brian Potkin
Comment: First draft
Revision 55 as of 2020-02-22 20:59:19
Size: 53738
Editor: Brian Potkin
Comment: Some additions and changes to "Non-free Printer Drivers and Firmware". Puffed driverless printing. Corrected links.
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
## page was renamed from PrintQueuesCUPS
Line 5: Line 6:
                 UNFINISHED

Setting up print queues within the CUPS printing system.

Setting up and administering print queues within the CUPS printing system. Aimed at a Debian 10 (buster) installation, but much of the material should apply to Debian 9 (stretch) and Debian 8 (jessie) too.
Line 12: Line 13:
=== Introduction ===

The CUPS printing system involves complex interactions between the
programs contained in many packages. The [[https://packages.debian.org/search?keywords=cups-daemon|scheduler, cupsd]], is at the heart of the system, but support from a [[https://packages.debian.org/search?keywords=cups-filters|filtering system]], and a large array of packages is necessary for successful, effortless printing on a wide variety of printers.

Having said that, the system appears to work well and there is little
sign that Debian users have any great difficulty in setting up local or
networked printers and getting them to function correctly. This page is
intended to help maintain that situation and give some detail about the
printer installation process.

CUPS is the default printing system for Debian but the Berkeley LPR software is also in the archives as [[https://packages.debian.org search?keywords=lprng|lprng]]. It cannot co-exist with cups on the same system.
<<Anchor(intro)>>
=== Introduction ===

The major changes in Debian 10 (buster) compared with the two previous stable distributions have to do with [[DriverlessPrinting|driverless printing]]. It is offered on Debian 9, but both CUPS and cups-browsed have augmented their software to include more filters and options to take advantage of modern-day printing technology. For CUPS it is worth mentioning the introduction of [[#tempq|temporary queue formation]] and [[DriverlessPrinting#rasters|Apple Raster]] as a supported PDL. For cups-browsed there is now a [[PrintingGlossaryandIndex#pclm|rastertopclm]] filter and more [[DebianMan:cups-browsed.conf|support]] for setting up driverless printing automatically.

Users of legacy printers (printers which depend on what the vendor software supplies) should be unaffected by these changes [[https://github.com/apple/cups/issues/5271|for now]].

<<Anchor(printqueue)>>
Line 26: Line 22:
<<Anchor(xxx)>>
A document destined for a printer is frequently called a '''''print job'''''. On
its way to the printer it is first put into a '''''queue''''' before being
processed. The queue has certain properties which determine how the
print job is dealt with and may be queried with [[http://manpages.debian.org/cgi-bin/man.cgi?query=lpoptions|lpoptions]] and [[http://manpages.debian.org/cgi-bin/man.cgi?query=lpstat|lpstat]] for a list of some of these
properties and the queue status repectively.

The properties specified when the queue is created are not immutable.
Quite a few of them can be altered by a user when the print job
is submitted to the queue.

A document destined for a printer or print server is frequently called a [[PrintingGlossaryandIndex#printjob|print job]]. On its way there it is first put into a [[PrintingGlossaryandIndex#queue|queue]] before being processed. The queue has certain properties which determine how the print job is dealt with and may be [[SystemPrinting#status|queried]] with DebianMan:lpoptions and DebianMan:lpstat for a list of these properties and the queue status repectively.

The properties specified when the [[#lpadmin|queue is created]] are not immutable. Quite a few of them can be altered by a user via DebianMan:lp or an application when the print job is submitted to the queue. A user can also set default printing options in [[DebianMan:lpoptions|~/.cups/lpoptions]]. An administrator who hoped to confine users to duplex (two-sided) printing, for example, would have to [[Tea4CUPS#nup1|look outside]] the CUPS framework for a solution to add to the system.
Line 38: Line 28:
is very common for "print queue" and "printer" to be used
interchangably. Generally no harm comes from this.
is very common for ''print queue'' and ''printer'' to be used
interchangably. No harm need come from this, but it pays to give careful attention to whether a CUPS print server or a printer is being contacted. This account treats general principles and manual setup of a queue first; [[#autodiscovery|automatic setup]] and a [[#tempq|glimpse of a modern development]] follow later.

<<Anchor(deviceuri)>>
Line 43: Line 34:
Ultimately, a print job has to go somewhere. Most users expect the "somewhere" to be a printer. To see which "somewhere"s you have open to you, do (as root or a user):

{{{
  /usr/sbin/lpinfo -v
}}}

The [[http://manpages.debian.org/cgi-bin/man.cgi?query=backend|backends]] in /usr/lib/cups/backends are now used in discovery mode in an endeavour to locate printers. Here is the output of one such command when two printers are attached to the machine via a USB and parallel port and one is available over the network:

{{{
  network ipps
  network http
  network lpd
  network ipp14
  network socket
  network https
  direct parallel:/dev/lp0
  network ipp
  serial serial:/dev/ttyS0?baud=115200
  serial serial:/dev/ttyS1?baud=115200
  direct usb://EPSON/Stylus%20COLOR%20740
  network dnssd://TEST1%20%40%20wheezy._ipp._tcp.local/cups
  network dnssd://TEST2%20%40%20wheezy._ipp._tcp.local/cups
  network dnssd://TEST3%20%40%20wheezy._ipp._tcp.local/cups
  network socket://192.168.7.64
}}}

The USB-connected printer and the networked one have definitely been
discovered. They have device-uris

{{{
  usb://EPSON/Stylus%20COLOR%20740
  socket://192.168.7.64
}}}

A parallel port has also been found. Its device-uri is

{{{
  parallel:/dev/lp0
}}}

To identify the makes and models of any printers you will want to do

{{{
  lpinfo -l -v
Ultimately, a print job has to go somewhere; most users expect the job to go to a printer. However, the job is only going to get to the printer (after being taken out of the queue) if the [[PrintingGlossaryandIndex#deviceuri|device-uri]] is one recognised by CUPS and the printer. [[DebianMan:lpinfo|lpinfo]] allows you to see which device-uris are associated with a print server or printer:

{{{
/usr/sbin/lpinfo -v
}}}

[[DebianMan:backend|Backends]] in ''/usr/lib/cups/backends'' are now used in discovery mode in an endeavour to locate printers. Here is the output of one such command when two printers are attached to a Debian 10 (buster) machine via USB (an HP PSC 1300) and parallel (an Epson Stylus 740) ports and two are available over the network (an HP !LaserJet 2200 and an HP ENVY 4500):

{{{
network lpd
network ipp
network http
network socket
network beh
network https
network ipps
direct parallel:/dev/lp0
serial serial:/dev/ttyS0?baud=115200
serial serial:/dev/ttyS1?baud=115200
direct usb://hp/psc%201300%20series?serial=HU3AFBQ28Y9F&interface=1
direct hp:/usb/psc_1300_series?serial=HU3AFBQ28Y9F
direct hpfax
network dnssd://ENVY4500._ipp._tcp.local/?uuid=1c852a4d-b800-1f08-abcd-308d99fafac2
network socket://192.168.7.211
network socket://192.168.7.235:9100
network ipp://ENVY4500.local:631/ipp/print
}}}

The USB connected printer and the networked ones have device-uris

{{{
direct usb://hp/psc%201300%20series?serial=HU3AFBQ28Y9F&interface=1
direct hp:/usb/psc_1300_series?serial=HU3AFBQ28Y9F

network dnssd://ENVY4500._ipp._tcp.local/?uuid=1c852a4d-b800-1f08-abcd-308d99fafac2
network socket://192.168.7.211
network socket://192.168.7.235:9100
network ipp://ENVY4500.local:631/ipp/print
}}}

 * The USB connected printer has been located by two backends; `usb` and `hp`. The first backend comes from CUPS and the second from [[#hplip|HPLIP]]. Either device-uri can be used.

 * The CUPS `snmp` backend has discovered the networked !LaserJet 2200 (at 192.168.7.211) and the ENVY 4500 (at 192.168.7.235). A queue set up with this device-uri for the !LaserJet would need the [[#lpadmin|-m option]] to be given a [[#ppd|PPD]]. The same would have to be done for the ENVY 4500 unless,
 alternatively, [[DriverlessPrinting|-m everywhere]] is used.

 * Additionally, the ENVY 4500 has been found from its [[PrintingGlossaryandIndex#dnssd|DNS-SD]] broadcasts by the CUPS `dnssd` backend and by [[#tempq|CUPS itself]]. Either device-uri can be used.

 *A parallel port has also been found by the cups-filters `parallel` backend. Its device-uri is

{{{
parallel:/dev/lp0
}}}

For more detail and to identify the makes and models of the printers you will want to do

{{{
lpinfo -l -v
Line 92: Line 96:
  Device: uri = usb://EPSON/Stylus%20Photo%20RX420?serial=LJ4O40407152301540&interface=1
          class = direct
          info = EPSON Stylus Photo RX420
          make-and-model = EPSON Stylus Photo RX420
          device-id = MFG:EPSON;CMD:ESCPL2,BDC,D4;MDL:Stylus Photo RX420;CLS:PRINTER;DES:EPSON Stylus Photo RX420;
          location =
  Device: uri = parallel:/dev/lp0
          class = direct
          info = EPSON Stylus COLOR 740 LPT #1
          make-and-model = EPSON Stylus COLOR 740
          device-id = MFG:EPSON;CMD:ESCPL2,BDC,D4;MDL:Stylus COLOR 740;CLS:PRINTER;
          location =
  Device: uri = socket://192.168.7.64
          class = network
          info = HP LaserJet 2200
          make-and-model = HP LaserJet 2200
          device-id = G:Hewlett-Packard;CMD:PJL,MLC,PCL,PCLXL,POSTSCRIPT;MDL:HP LaserJet 2200;CLS:PRINTER;DES:Hewlett-Packard LaserJet 2200;MEM:8MB
          location =
}}}

The dnssd://... entries are print queues on a remote machine, not printers. DNS-SD has located them with the help of Avahi. A client machine with a cups version greater than or equal to 1.6.x will have the same queues found with [[http://manpages.debian.org/cgi-bin/man.cgi?query=avahi-daemon|avahi-daemon]] plus [[http://manpages.debian.org/cgi-bin/man.cgi?cups-browsed|cups-browsed]] and listed with

{{{
   lpstat -t
}}}

You can either ignore them or not have them displayed by removing the dnssd
backend from the list which

{{{
  dpkg-reconfigure cups
}}}

gives.
Device: uri = usb://hp/psc%201300%20series?serial=HU3AFBQ28Y9F&interface=1
        class = direct
        info = hp psc 1300 series
        make-and-model = hp psc 1300 series
        device-id = MFG:hp;MDL:psc 1300 series;CMD:LDL,MLC,PML,DYN;
                    CLS:PRINTER;1284.4DL:4d,4e,1;SN:HU3AFBQ28Y9F;
                    S:0380008000020020112fff8d800fff8d800;Z:007;
        location =

Device: uri = hp:/usb/psc_1300_series?serial=HU3AFBQ28Y9F
        class = direct
        info = HP psc 1300 series USB HU3AFBQ28Y9F HPLIP
        make-and-model = HP psc 1300 series
        device-id = MFG:hp;MDL:psc 1300 series;CLS:PRINTER;
                    DES:psc 1300 series;SN:HU3AFBQ28Y9F;
        location =

Device: uri = parallel:/dev/lp0
        class = direct
        info = EPSON Stylus COLOR 740 LPT #1
        make-and-model = EPSON Stylus COLOR 740
        device-id = MFG:EPSON;CMD:ESCPL2,BDC,D4;MDL:Stylus COLOR 740;CLS:PRINTER;
        location =

Device: uri = socket://192.168.7.211
        class = network
        info = HP LaserJet 2200
        make-and-model = HP LaserJet 2200
        device-id = G:Hewlett-Packard;CMD:PJL,MLC,PCL,PCLXL,POSTSCRIPT;
        MDL:HP LaserJet 2200;CLS:PRINTER;DES:Hewlett-Packard LaserJet 2200;
        MEM:8MB
        location =

Device: uri = socket://192.168.7.235:9100
        class = network
        info = ENVY 4500 series
        make-and-model = HP ENVY 4500 series
        device-id = MFG:HP;MDL:ENVY 4500 series;CMD:PCL3GUI,PJL,Automatic,
                    JPEG,PCLM,AppleRaster,DW-PCL,802.11,DESKJET,DYN;
                    CLS:PRINTER;DES:A9T87B;CID:HPIJVIPAV4;LEDMDIS:USB#FF#CC#00,
                    USB#07#01#02,USB#FF#04#01;IPP-HTTP:T;IPP-E:
                    FF-CC-00,07-01-02,FF4-01;SN:CN56G332DT060D;
                    S:038080C484a01021002c1f3000ac2880014;J:;
                    Z:0102,05034ee800aaa8,0600,0c0,0e000c0000,0f01000000,
                    10000008000008,12000,147,150,16361a34ee000116da17d40001,
                    1700005a000000,180;
        location = Study

Device: uri = dnssd://ENVY4500._ipp._tcp.local/?uuid=1c852a4d-b800-1f08-abcd-308d99fafac2
        class = network
        info = ENVY4500
        make-and-model = HP ENVY 4500 series
        device-id = MFG:HP;MDL:ENVY 4500 series;CMD:PCL,JPEG,URF;
        location =

Device: uri = ipp://envy4500.local:631/ipp/print
        class = network
        info = HP ENVY 4500 series (driverless)
        make-and-model = HP ENVY 4500 series
        device-id = MFG:HP;MDL:ENVY 4500 series;CMD:PCLM,PCL,AppleRaster,JPEG,URF;
        location =
}}}

<<Anchor(dnssd)>>
The `dnssd://...` entries are either [[PrintingGlossaryandIndex#bonjour|Bonjour-broadcasted]] print queues from a CUPS server on a remote machine or [[AirPrint|Bonjour-enabled printers]]; DNS-SD has located them with the help of Avahi. In general, queues created with a `dnssd://...` device-uri and pointing to a server should be set up on the client as [[#raw|raw queues]] so that the [[#doublefiltering|filtering takes place]] entirely on the remote server.

If it is known that a queue on the remote machine is itself a raw one or the device-uri points to a printer, you might have to consider whether setting up a local raw queue achieves what you want (see [[Tea4CUPS]] for situations in which you would want a local raw queue).

{{{#!wiki note
A Bonjour-enabled printer would almost certainly require a local non-raw queue to be set up [[#lpadmin|manually]] or for a [[DriverlessPrinting|driverless printing]] technique to be used.
}}}

Which `dnssd://...` entries are queues and which are printers?

{{{
/usr/lib/cups/backend/dnssd > dnssd.log

grep "local/cups" dnssd.log (These are print queues).
grep "local/?uuid" dnssd.log (These are printers).
grep "Unknown" dnssd.log (These are raw print queues).
}}}

A client machine with a cups version greater than or equal to 1.6.x will have the `dnssd://...` queues and printers automatically found with [[DebianMan:avahi-daemon|avahi-daemon]] plus [[DebianMan:cups-browsed|cups-browsed]] and listed with

{{{
lpstat -t
}}}

<<Anchor(networkuri)>>
=== The device-uri for a Networked Printer ===

CUPS can use at least one of the [[#appsock|AppSocket]], [[#ipp|Internet Printing (IPP)]] and [[#lpd|Line Printer (LPD)]] protocols for connecting to printers and print servers over a network connection. For a view of which services a device supports there is the DebianPkg:nmap command:

{{{
nmap <ip_address_or_hostname>
}}}

The output will vary from printer to printer. For an HP Envy 4500 it is

{{{
PORT STATE SERVICE
80/tcp open http
443/tcp open https
631/tcp open ipp
8080/tcp open http-proxy
9100/tcp open jetdirect
9220/tcp open unknown
}}}

The choice of protocol will be driven by your needs and what is offered by the printer or print server. !AppSocket is non-complex, usually well-implemented, low overhead and reliably gets the data from point A to point B, but doesn't do much else. IPP provides bidirectional communication for feedback and control, secure authentication services, access control and printer discovery and status. Its use is mandatory on [[AirPrint|AirPrint]] and [[IPPEverywhere|IPP Everywhere]] printers. LPD is a popular protocol older than IPP and with a feature set less extensive than it. Secure access, detailed error status reports and the ability to query a printer are lacking, for example.

<<Anchor(appsock)>>
 * '''!AppSocket'''

Also known as the ''!JetDirect'' or ''RAW'' protocol, this is the most basic protocol that can be supported by a printer. The URI scheme is

{{{
socket://<ip_address_or_hostname>:[port_number]
}}}

The standard port number is 9100 and this will be used by default if omitted from the device-uri. Print servers with three outputs would require three port numbers; for example, 9100, 9101 and 9102.

It is questionable whether ''!AppSocket'' is a protocol. There is no specified standard for it; no queue management; no aborting of jobs; no querying of printer supplies; no encryption. All it does is shovel the data for a print-ready file over the network and then close the connection. Because the only overhead is TCP/IP the data transfer is generally fast. Also, it has been in widespread use for a long time so the printer implementations of !AppSocket are good.

<<Anchor(ipp)>>
 * '''IPP'''

Printing normally takes place over port 631 with the URI scheme being

{{{
ipp://<ip_address_or_hostname>:[port_number]/resource
}}}

Unfortunately, the ''resource'' path has never been standardised and it may require some experimentation to determine what a printer or server will accept, especially if the device is not on the local network or it does not do, as most modern printers do, [[PrintingGlossaryandIndex#bonjour|Bonjour]] broadcasting. Apparently, newer printers often use ''/ipp/print'' in the path but for older products (as well as newer ones) it could be something entirely different, like ipp/port1, ipp, ipp/printer or ipp/laserjet. Maybe the printer's front panel will help. Or

{{{
/usr/lib/cups/backend/snmp <ip_address>
}}}

could give suitable output if there is explicit information from the Port Monitor MIB (Management Information Base) database of the printer. In the absence of an MIB the probing is for !AppSocket, then LPD and the first that works is reported. Because !AppSocket is supported by most network printers it would likely be the protocol given for use in a URI. So not so useful for getting an IPP URI.

If an IPP printer has registered itself using [[PrintingGlossaryandIndex#avahi|Avahi]], more success with obtaining an IPP URI could be achieved by installing DebianPkg:avahi-utils, running DebianMan:avahi-browse and looking at the ''rp= TXT Record Key'':

{{{
avahi-browse -art | less
}}}

An additional technique is to install DebianPkg:cups-ipp-utils and execute DebianMan:ippfind:

{{{
ippfind (Shows IPP printers and print queues).
ippfind -T 5 (Possibly more reliable).
ippfind ! --txt printer-type (Show IPP printers only).
}}}

An alternative command (which relies on `ippfind`) is

{{{
driverless
}}}

A CUPS server can always be reached with

{{{
ipp://<ip_address_or_hostname>/printers/<print_queue_name>
}}}

In theory, the handshaking and status monitoring done by the IPP protocol should ensure reliable printing but, in practice, there are older printers which do not implement some aspects of IPP very well. However, these days, a [[http://lists.cups.org/pipermail/cups/2015-October/027161.html|more optimistic view]] of the situation can be taken.

<<Anchor(lpd)>>
 * '''LPD'''

This is the original network protocol. It has a URI scheme of

{{{
lpd://<ip_address_or_hostname>/<print_queue_name>
}}}

and a default port of 515. Even though !AppSocket and IPP are [[https://www.cups.org/doc/network.html|seen as better alternatives]], it is regarded as a reliable protocol for sending a job to a printer. CUPS itself has some [[DebianMan:cups-lpd|limited functionality for LPD-based clients]]

<<Anchor(backendchoice)>>
=== Configuring the Choice of Backend ===

The cups package provides a [[DebianMan:debconf|debconf]] method for selecting [[#deviceuri|backends]] which are used for printer discovery and connection to the device. It basically gives a convenient way of copying the backends which come with CUPS between ''/usr/lib/cups/backend-available/'' and ''/usr/lib/cups/backend/''. Run

{{{
dpkg-reconfigure cups
}}}

Note that not every backend on the system is managed with this command because they are not all in the cups package. For example, the `parallel` and `beh` backends are in the cups-filters package.

Be careful about which backends are removed from the debconf list. Deleting the [[#dnssd|dnssd backend]] would still allow remote Bonjour broadcasted queue discovery via [[#cups-browsed|cups-browsed]] but Bonjour broadcasted printers would not seen by CUPS. An [[#networkuri|AppSocket-enabled printer]] would be discoverable with the snmp backend but, if the socket backend was deleted, trying to set up a queue using a `socket://...` URI would give the error ''Bad device-uri scheme "socket"''.


<<Anchor(driver)>>
Line 130: Line 294:
by the scheduler and the filtering system and to produce a final output
which can be understood by the printer.

Drivers are in the printer-driver-* packages plus various other packages. The print server task in Debian Installer gives you a full complement of these drivers. If you pass on this task and install the cups package after first boot
with
by the [[DebianPkg:cups-daemon|scheduler]] and the [[DebianPkg:cups-filters|filtering system]] and produce a final output which can be understood by the printer.

Drivers are in the printer-driver-* packages plus [[SystemPrinting|various other packages]]. The [[DebianPkg:task-print-server|print server task]] in Debian Installer gives you a full complement of these drivers. You may decline this task at install time but after first boot can do either

{{{
  apt-get install task-print-server
}}}

or
Line 140: Line 308:
the only printer driver package which comes with it is
printer-driver-gutenprint.
If a driver for your printer is not in that
package ([[#ppd|see below]] [LINK]) you can

 * Consult openprinting [LINK resources] for ideas on available drivers.
If a driver/[[#ppd|PPD]] for your printer is not in any of the installed packages you have various choices open to you:

 * Consult [[Printing#Resources|openprinting]] for ideas on available drivers.
Line 149: Line 315:
   apt-cache search <search_term>
}}}

 * Install the printer-driver-all package plus
   apt-cache search search_term
}}}

 * Go to the [[PrintQueuesCUPS#nonfree|printer manufacturer's website]]

<<Anchor(modern)>>
{{{#!wiki important
Users who possess a [[QuickPrintQueuesCUPS#Introduction|modern printer]] are urged to consider a [[DriverlessPrinting|driverless printing]] solution (buster only), perhaps by setting up a [[DriverlessPrinting#shortlpadmin|suitable print queue]] or by following the [[QuickPrintQueuesCUPS|advice here]]. The days of CUPS continuing driver support in the form it is now [[https://github.com/apple/cups/issues/5271|are numbered]].
}}}

<<Anchor(nonfree)>>
=== Non-free Printer Drivers and Firmware ===

Driver software distributed with quite a few printers does not meet the criterion of being [[https://www.debian.org/social_contract|DFSG-free]], so users who need to use such a driver with a printer will have to rely completely on what the printer manufacturer has to offer to get their printer working. Also, even though most HP printers operate with DFSG-free software, some [[#hp|HP devices]] used with DebPkg:hplip require a proprietary ''host-based'' driver plugin or a firmware file to allow full access to printer or scanner features or enhanced performance. The firmware is uploaded to the printer when it is powered-on attached to the computer. The ''host-based'' plugin software is used when printing or scanning.

It may be necessary to go to the manufacturer's website if the printer is a new model and drivers for it are not yet in a Debian package (or never will be) and [[CUPSDriverlessPrinting|driverless printing]] is not an option. However, it would be highly unlikely that a [[CUPSQuickPrintQueues#intro|modern, AirPrint-enabled printer]] would not be a good fit for driverless printing on Debian 10 (buster) and later, and therefore a user is advised to [[CUPSDriverlessPrinting|follow this route]] for a quick, efficient and almost effortless modern printer setup.

<<Anchor(brother)>>
 * '''Brother'''
[[http://support.brother.com/g/s/solutions/linux/|Solutions for Linux]] is a good place to start for assessing what support your printer has from Brother. Generally, you will need ''.deb'' files for the cupswrapper and the lpr driver. Follow the instructions to install them; alternatively, there is [[https://support.brother.com/g/b/downloadhowto.aspx?c=eu_ot&lang=en&prod=mfcl2700dw_us_eu_as&os=128&dlid=dlf006893_000&flang=4&type3=625|linux-brprinter-installer]] to do that for you.

<<Anchor(canon)>>
 * '''Canon'''
There is a [[Canon]] wiki page dealing with printers requiring URF-II, CAPT and cnijfilter drivers. A Canon Advanced Printing Technology (CAPT) printing package and a cnijfilter package can be installed in a similar way to Method 1 at the previous link. Namely: extract files from the package with `tar zvxf.....` and install Debian packages with `apt install ./...`.

Some useful phrases for locating Canon packages on the web are:

 * cnijfilter debian 5.70
 * ufr printer driver for linux
 * capt printer driver for linux

Alternatively, search for a package from a [[https://www.canon.co.uk/support/|Canon website]]

<<Anchor(epson)>>
 * '''Epson'''
A goodly number of Epson printer drivers fall into the category of DFSG-free. These are gathered together in DebPkg:printer-driver-escpr. Free and non-free drivers may be located and downloaded from [[http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX|this Epson website]].


<<Anchor(samsung)>>
 * '''Samsung'''
Linux support for a Samsung printer can be searched for from either the [[https://support.hp.com/gb-en/drivers|HP]] or [[https://samsung-printerdrivers.com/|Samsung]] web sites. Many, but not all, Samsung printer models use the ''Unified Linux Driver (ULD)''. ''ULD'' contains PPDs for Linux supported printers, a printer driver to use with the PPDs and a library to use with the driver. It comes in a ''.tar.gz'' package and only supports the i386 and amd64 platforms. No source code is provided.

Extract the files in the tarball and install them by entering the directory created and running ''install-printer.sh''

{{{
tar zvxf uld_v1.00.xx_xx.xx.tar.gz
cd uld
./install-printer.sh
}}}

Samsung does not provide ''ULD'' as a ''.deb'' but the [[http://www.bchemnet.com/suldr/|The Samsung Unified Linux Driver Repository]] does. It also has a good deal of information on the installation of ''ULD'' and its interaction with a Debian system. ''SULDR'' is not affiliated with Samsung.

<<Anchor(hp)>>
 * '''HP'''

A relatively small number of HP devices require a plugin to be installed on the computer for them to [[https://developers.hp.com/hp-linux-imaging-and-printing/binaary_plugin.html|operate at all or to function at their full potential]] for one or more of the device's printing, scanning or faxing modes. For a handful of HP printers the plugin package contains firmware which has to be uploaded to a printer. Without a firmware requirement the plugin software can still be needed to interact with the printer. Effectively, the print job is processed by the plugin to produce a file in a language the printer understands. In technical literature the printer would be described as ''host-based''. See whether the plugin [[https://developers.hp.com/hp-linux-imaging-and-printing/supported_devices/index|is needed]] and use [[https://developers.hp.com/|HP's home page search facility]] to see a printer's details and find out what any firmware is required for. `hp-plugin -i` is a command to use to install the plugin.

{{{#!wiki note
Plugin software can be installed (as root) without the hplip package and its dependencies being on the system.

 * ''apt install hplip-data''

 * [[https://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/|Download]] the appropriate plugin file to a chosen directory.

 * ''sh hplip-<version>-plugin.run --tar vxf''

 * ''python installPlugin.py'' or ''python3 installPlugin.py''

 * ''apt purge hplip-data''
}}}

<<Anchor(foo2zjs)>>
 * '''foo2zjs''' (firmware and colour profiles)

Not the name of a printer manufacturer but a [[DebianPkg:printer-driver-foo2zjs|Debian package]] which can install firmware and colour profiles for a number of printers which use the [[http://http://foo2zjs.rkkda.com/|ZjStream wire protocol]]. The commands (as root)

{{{
getweb | less
getweb p1008
}}}

give a list of what is available and download the firmware file for an HP !LaserJet P1008. [[DebianPkg:hannah-foo2zjs|Hannah]] is a graphical firmware downloader which uses getweb. Re-plug the connection to the printer to upload the firmware to it.

<<Anchor(avoiding)>>
=== Avoiding Non-free Printer Drivers and Firmware ===

A non-free filter generally gets used at the last stage of the filtering process after cups-filters has done its job. The process ends with something that is sometimes termed host-based (and which is often proprietary) rather than letting the printer itself take care of the final conversion. It makes sense to the printer manufacturer to do this (probably on legal, technical or economic grounds) but it disrupts the free software ecosystem within which CUPS and cups-filters operate.

{{{
           +----------------------+ +-----------------+
File in -> |CUPS and cups-filters | -> | Non-free driver | -> Printer
           +----------------------+ +-----------------+
}}}

The final stage of this process could be dispensed with if what was sent to the printer was something it could understand.

{{{
                                        +------------------------+
           +-----------------------+ | Something the printer |
File in -> | CUPS and cups-filters | -> | understands sent by | -> Printer
           +-----------------------+ | CUPS and cups filters. |
                                        +------------------------+
}}}

Recent developments in printer technology see printers understanding MIME types ''image/pwg-raster'' and ''image/urf''. These file types are also referred to as PWG and Apple raster data formats respectively.

{{{
                                        +--------------+
           +-----------------------+ | Apple raster |
File in -> | CUPS and cups-filters | -> | or | -> Printer
           +-----------------------+ | PWG raster |
                                        +--------------+
}}}

From CUPS 2.2.2 and cups-filters 1.13.0 onwards it is possible to send a job in Apple and PWG raster to a printer which understands either data format. This is dealt with in more detail on the [[DriverlessPrinting|driverless printing]] page.
Line 155: Line 432:
=== The PPD file === === The PPD File ===
Line 161: Line 438:
and special (often proprietary) languages. Driver packages include and special (often proprietary) languages. [[#driver|Driver packages]] include
Line 167: Line 444:
  lpinfo -m | less
}}}

If there is only one for your printer the choice is made for you! If
there is more than one, go for the PPD which is marked "Recommended". If
none are recommended use common sense (sometimes called "guessing" :))
or seek help from openprinting [[Printing#Resources|XXXX]].

A Generic PPD may be the solution when every driver package is installed
and your printer model is not in the list. And you can also resort to the printer manufacturer's website [LINK] or a CD which came
with the printer.
/usr/sbin/lpinfo -m | less
}}}

If there is only one for your printer the choice is made for you! If there is more than one, go for the PPD which is marked ''Recommended''. If none are recommended use common sense or seek help from the [[Printing#Resources|openprinting database]].

Some Generic PPDs are listed with `lpinfo -m` and one could be a solution when every driver package is installed and your printer model is not in the list. You can also resort to the [[PrintQueuesCUPS#nonfree|printer manufacturer's website]] or a CD which came with the printer.
Line 180: Line 452:
elsewhere in /usr/share/ppd/custom. It will then be displayed in the
output of lpinfo -m and by the web interface [LINK].
elsewhere in ''/usr/share/ppd/custom''. It will then be displayed in the
outputs of `lpinfo -m`, the [[#webinterface|web interface]] and [[#scp|system-config-printer]].

<<Anchor(lpadmin)>>
Line 186: Line 459:
with programs like system-config-printer [LINK] and the web interface.
[LINK]
There are four essentials to provide when setting up a working, accepting
print queue with lpadmin.[LINK manual]
with [[#scp|system-config-printer]], [[#hplip|HPLIP]], [[#cupsbrowsed|cups-browsed]] and the [[#webinterface|CUPS web interface]]. There are four essentials to provide when setting up a working, accepting print queue with [[DebianMan:lpadmin|lpadmin]].
Line 193: Line 463:
 2. The device-uri (-v): The destination for a print job; usually a printer.

 3. The PPD file (-m or -P): Determines how the print job is handled by the filtering system to produce data which can be successfully printed by the printer.

 4. Whether the queue is enabled (-E}: Must be specified explicitly.
 2. The [[#deviceuri|device-uri]] (-v): The destination for a print job; usually a printer.

 3. The printer model (-m): Determines how the print job is handled by the filtering system to produce data which can be successfully printed by the printer. Options are to specify a [[#ppd|PPD]] or have a [[DriverlessPrinting#lpadmin|PPD generated]] from the printer response to being queried (''everywhere'') or [[#raw|raw]].

 4. Whether the queue is enabled (-E): Must be specified explicitly.
Line 202: Line 472:
  lpadmin -p queue_name -v device_uri -m PPD_file -E lpadmin -p <queue_name> -v <device-uri> -m <PPD_or_everywhere_or_raw> -E
Line 207: Line 477:
lpoptions is the command to use to see default printer-specific options (obtained from the PPD) for the queue.

{{{
  lpoptions -p queue_name -l
}}}

Options which are not specific to the particular printer come from

{{{
  lpoptions -p queue_name
}}}

The previous lpadmin command is about as simple as it gets for setting up a queue quickly but it can be tweaked just as simply by giving the command some printer-specific and non-specific options to add with '''''-o'''''.

The lpadmin [LINK] and lp [LINK] manuals are sources for non-PPD options.

Setting up a queue requires either root privileges or for the user to
be a member of the lpadmin group. If you installed CUPS using the print
server task in the Debian installer the first user is put in the lpadmin
group. Check for user membership with the command

{{{
  groups
}}}

=== The CUPS Web Interface ===

http://localhost:631 for the location of the interface. Administration
<<Anchor(raw)>>
Sometimes it is necessary or desirable to establish a ''raw'' queue. That is, a queue where the filtering system is not involved and the print job goes directly to a printer or another queue.

{{{
lpadmin -p <queue_name> -v <device-uri> -m raw
}}}

[[DebianMan:lpoptions|lpoptions]] is the command to use to see default printer-specific options (obtained from the PPD) for the queue.

{{{
lpoptions -p <queue_name> -l
}}}

The previous lpadmin command is about as simple as it gets for setting up a queue quickly but it can be tweaked just as simply by giving the command some printer-specific options to add with ''-o''.

The [[DebianMan:lpadmin|lpadmin]] and [[DebianMan:lp|lp]] manuals are sources for non-PPD options.

{{{#!wiki important
Setting up a queue with lpadmin or the web interface requires either root privileges or for the user to be a member of the lpadmin group. If you installed CUPS using the printserver task in the Debian installer, the first user is put in the lpadmin group.
}}}

Check for user membership of the lpadmin group with the command

{{{
groups
}}}

If lpadmin doesn't appear in the previous command output execute this command (change username with your user name)
{{{
usermod -a -G lpadmin username
}}}

<<Anchor(webinterface)>>
=== Creating a Print Queue with the CUPS Web Interface ===

http://localhost:631 is the location of the interface and from there you can administer print queues, including their installation. Administration
Line 238: Line 516:
The Add Printer button could produce somthing like

{{{
             Local Printers: Serial Port #1
The Add Printer button could produce a first page with something like this on it:

{{{
             Local Printers: CUPS-BRF (Virtual Braille BRF Printer)
                                
Serial Port #1
Line 243: Line 522:
                                EPSON Stylus Photo RX420 (EPSON Stylus Photo RX420)                                 HP psc 1300 series USB HU3AFBQ28Y9F (HP psc 1300 series)
                                hp psc 1300 series (HP psc 1300 series)
                                HP Fax (HPLIP)
Line 245: Line 526:
Discovered Network Printers: TEST1 @ wheezy (HP HP DesignJet 750C)
                                TEST2 @ wheezy (HP HP DesignJet 750C)
                                TEST3 @ wheezy
Discovered Network Printers: ENVY4500 (HP ENVY 4500 series)
                                LaserJet-300 @ desktop (HP HP LaserJet 2200)
Line 249: Line 529:
                                ENVY 4500 series (HP ENVY 4500 series)
Line 258: Line 539:
Which doesn't look significantly different from what '''''lpinfo -l -v''''' gave [[#Creating a Print Queue with lpadmin|previously.]]

Having made a selection you should find a queue name based on the printer make and model has been filled in for you on the next page. Change it by all means if you wish. Once it is done it cannot be modified later because a new name would imply setting up a different, new queue.

'''''Share printers connected to this system''''' on the Administration page
is the basic facility to allow (or not allow) DNS-SD broadcasting on Debian 8.x.x. Ticking '''''Share This Printer''''' designates your queue as one to add to this facility.
Which doesn't look significantly different from what `lpinfo` gave [[#deviceuri|previously.]]

Under ''Local Printers:'' are the discovered printers which are directly connected to the machine being used. ''Discovered Network Printers:'' are networked printers on the same subnet as your machine. Or they could be print queues which the [[#dnssd|dnssd backend]] has found on the same subnet. In both cases backends have been run in [[#deviceuri|discovery mode]] to find printers. The [[#deviceuri|device-uri]] found is on the second page of the interface. In most cases your printer will appear in this two options, if it doesn't try to restart it with the power button or use ''Other Network Printers'' option to set it manually.

''Other Network Printers:'' gives you the opportunity to provide the [[#deviceuri|device uri]] and [[#ppd|PPD]] for a printer or queue which falls into neither of the previous two categories. The information is provided on the second and third pages.

Having made a selection from ''Local Printers:'' or ''Discovered Network Printers:'' you should find a queue name based on the printer make and model has been filled in for you on the next page. Change it by all means if you wish. Once it is done it cannot be modified later because a new name would imply setting up a different, new queue.

''Share printers connected to this system'' on the Administration page
is the basic facility to allow (or not allow) DNS-SD broadcasting of the queue on Debian 8.x Debian 9.x. Ticking ''Share This Printer'' on the second page designates your queue as one to add to this facility.
Line 266: Line 551:
for you, unless, like the printer on LPT #1, there is no make and model
infomation to work from or there is no PPD on the system. The comments in [LINK] apply here too.

The final page primarily has options from the
for you, unless

 * The printer provides no make and model information to CUPS.
 * There is no PPD for the printer on the system.
 * ''Other Network Printers:'' is being used.

The previous [[#driver|driver]] and [[#ppd|PPD]] comments apply here too.

The final page has the default printer-specific options from the PPD and a few non-specific printer options. This should suit the needs of many users.

<<Anchor(hplip)>>
=== Creating a Print Queue with HPLIP ===

[[DebianPkg:hplip|HPLIP]] is a [[https://developers.hp.com/hp-linux-imaging-and-printing/tech_docs/overview|one-stop]] solution for printing, scanning and faxing with appropriate HP devices and designed to work with CUPS. Only the printing aspect is dealt with here. USB scanning is the subject of [[Scanner|another wiki page]] and network scanning is linked from it. HPLIP uses its own printer backend, `hp:/...`, and [[#deviceuri|URI scheme]] for printer discovery and sending a print-ready job to the printer. For a graphical user interface (GUI) to HPLIP there is a [[DebianPkg:hplip-gui|hplip-gui]], which contains very similar utilities to the ones in the hplip package.

 * URI scheme: USB printer.
{{{
hp:/usb/<printer_model>?serial=<serial_number>
}}}

 * URI scheme: networked printer.
{{{
hp:/net/<printer_model>?ip=<IP_address>
hp:/net/<printer_model>?hostname=<DNS_hostname>
hp:/net/<printer_model>?zc=<zeroconf(avahi, Bonjour)_hostname>
}}}

 * URI scheme: parallel port printer.

{{{
hp:/par/<printer_model>?device=/dev/parportX (X=1,2...)
}}}

Each printer model supported by the installed verion of HPLIP is listed in ''/usr/share/hplip/data/models/models.dat''. Model names are enclosed in square brackets; like so, [envy_4500_series].

Printer discovery and setting up a print queue can be done from the command line with [[http://manpages.debian.org/cgi-bin/man.cgi?query=hp-setup|hp-setup]]. For USB and printers on the network:

{{{
hp-setup -i -busb
hp-setup -i -bnet
}}}

You will be led through the rest of the procedure.

{{{#!wiki tip
''hp-setup'' uses one of two methods to find printers on the network - Service Location Protocol (SLP) and mdns (Bonjour) broadcasts from [[AirPrint|suitable printers]].

The ''SLP'' service agent runs on port 427 of a printer; do you have such a service?

 * nmap -sU -p 427 <ip_address>

will tell you.

The command ''hp-setup -i -bnet'' uses only ''SLP'' for discovery. If you want to setup a queue for an mdns advertised printer it is suggested to do

 1. hp-probe -mmdns (This provides a Device URI).
 2. hp-setup -i -d<Device URI>

A problem with [[DissectingandDebuggingtheCUPSPrintingSystem#Problems_with_mdns.2FDNS-SD|firewall settings]] could lead to the first command failing.
}}}

 * Some HP printers require [[#hp|a non-free plugin]] to operate at their full potential; [[DebianMan:hp-plug|hp-plugin]] is a useful utility to use to obtain it.

 * HP printing devices can be set up with [[#networkuri|device-uri schemes]] other than `hp:/...` provided CUPS and a suitable printer-driver package such as DebianPkg:printer-driver-hpcups, DebianPkg:printer-driver-hpijs or DebianPkg:printer-driver-postscript-hp have, as a minimum, been installed. Printer discovery would be done through any of [[#lpadmin|lpadmin]], the [[#webinterface|CUPS web interface]] or [[#scp|system-config-printer]].

<<Anchor(scp)>>
=== Creating a Print Queue with system-config-printer ===

The idea of system-config-printer is to provide functionality similar to [[#lpadmin|lpadmin]] and the CUPS [[#webinterface|web interface]] but with GTK+ widgets and greater desktop integration. Anyone familiar with the CUPS web interface should feel at home with it but note that there is a difference in the way adminstrator privileges for the printing system are gained.

A default system-config-printer installs [[DebianPkg:cups-pk-helper|cups-pk-helper]] as a recommended package to further the aim of desktop integration. ''cups-pk-helper'' is intended to give [[http://www.vuntz.net/journal/post/2010/02/19/A-few-words-about-cups-pk-helper...|fine-grained control]] of aspects of CUPS management via [[DebianPkg:policykit-1|policykit]]. Unlike lpadmin, the CUPS web interface and HPLIP ''cups-pk-helper'' [[DebianBug:698504|does not respect]] the ''!SystemGroup lpadmin'' directive in ''/etc/cups/cups-files.conf'' and an adminstrator password will be requested to see remote print queues and to administer them and local queues.

{{attachment:scp-1.png||align=left}}

Almost nothing is administratively possible for an ordinary user when ''cups-pk-helper'' is on the machine. A user is entitled to cancel her own jobs but without the machine's administrator altering policykit's view of who is entitled to administer printers nothing else is available.

This can be done with a file ending with ''.pkla'' put into ''/etc/polkit-1/localauthority/50-local.d''. With the contents

{{{
[Printer configuration]
Identity=unix-user:milly;unix-user:molly;unix-user:mandy
Action=org.opensuse.cupspkhelper.mechanism.*
ResultAny=no
ResultInactive=no
ResultActive=yes
}}}

the users milly, molly, mandy would have privileges granted similar to
those granted to a member of the lpadmin group and not have to provide a password. Removing the cups-pk-helper package would be an alternative strategy to allow users in the lpadmin group administrative privileges.

The initial screen seen when ''system-config-printer'' is run displays icons and names for local print queues; that is, queues which been set up by a user or by [[#cupsbrowsed|cups-browsed]]. The ''Add'' button is for printer discovery and creating a new queue for a printer. A greyed-out button indicates a lack of some administrative privilege, so go to ''Server-->Connect-->Connect''.
Hopefully, the [[#deviceuri|device-uri]] section will be found useful for interpreting the discovered printers display.

<<Anchor(doublefiltering)>>
=== Double Filtering ===

The [[#webinterface|CUPS web interface]] and the command `/usr/sbin/lpinfo -v` give a list of printers and print queues discovered on the network. Any of the entries in the list can be installed as a local print queue. In other words they will listed in ''/etc/cups/printers.conf'' on your machine.

For example, under ''Discovered Network Printers'' in the web interface you might see

{{{
testq @ desktop (DCP-9020CDW)
}}}

and the next web page shows a ''Connection'' beginning `dnssd://`.

The [[#dnssd|dnssd://]] and ''@ desktop'' tell you this is a print queue discoverd by avahi-daemon. The (DCP-9020CDW) tells you the make and model of the printer. The latter information is obtained from the ''*Product'' line in the queue's PPD, so it implies the queue is not a [[#raw|raw queue]] and a job sent to it undergoes filtering on the server. The same information is given in the make-and-model field of the output of `/usr/sbin/lpinfo -l -v`.

On the third web page you should choose ''Raw'' as the ''Make''. With [[#lpadmin|lpadmin]] you should have ''-m raw''. Then the client passes the data through without filtering and all filtering is done correctly on the server.

Alternatively, you can get such queues automatically set up locally by
running [[#cupsbrowsed|cups-browsed]] on the client.

Upstream CUPS has [[http://www.cups.org/pipermail/cups-devel/2015-September/016446.html|something to say about double filtering]]. Quoting:

{{{
The issue is the MIME typing on the CUPS server - if the server
doesn't recognize the MIME media type then you may end up with
extra filtering.

I'm not saying it can't work (because we have customers that use
that configuration all of the time), it is just that we get a lot
of support calls when people try to do Microsoft-style printer
sharing to a server that is also hosting a CUPS printer driver on
the same queue.
}}}

[[https://www.cups.org/pipermail/cups-devel/2015-September/016453.html|Reinforcing]] the previous point:


{{{
The issue is that for IPP we actually get to use MIME media types,
and the filters in the PPD file specify what the final output type
is. We then try to match things up on the remote system, which is
where the problems typically occur. For example, if the local
driver has a filter that specifies application/vnd.hp-pcl" as the
destination MIME media type but the server does not have that MIME
media type defined/supported for its queue, we have to revert to
"application/octet-stream" (auto-detect).

You can "fix" this with .types and .convs files on the server
to specify a "-" filter for the affected MIME media types to
application/vnd.cups-raw) but ultimately you are better off
letting the server do the filtering...
}}}

{{{#!wiki caution
You are strongly advised not to do double filtering. Set up the queue on
the client as a raw queue if the remote queue is doing the filtering.
}}}

<<Anchor(autodiscovery)>>
=== Auto-discovery of Remote, Shared Queues and Printers ===

All four of the previous setup tools for print queue creation ([[#lpadmin|lpadmin]], the [[#webinterface|CUPS web interface]], [[#hplip|hp-setup]] and [[#scp|s-c-p]]) are manual tools and the created queues are also permanent. There is often no need for this permanancy, especially when moving from network to network. Having queues set up automatically and then automatically disappearing when they go offline or are no longer required is useful for conserving resources and having an up-to-date enumeration of queues and printers.

There are currently three methods for getting information from avahi-daemon and automatically displaying print queues and IPP printers in a print dialog.
                                                                                                                      
 * Use [[#cupsbrowsed|cups-browsed]] to manage queues and printers.
 * Have the dialog [[#gtk|itself browse]] the DNS-SD broadcasts of the queues and printers using avahi-daemon.
 * [[#tempq|Use CUPS version 2.2.4]] or later versions. They support discovery of Bonjour advertised print queues and printers.

Firefox, Evince and Zathura are examples of applications which use the GTK print dialog. The Qt print dialog is used in Okular and Qpdfview. Libreoffice has its own print dialog. Some but not all programs expecting ```lp``` can instead use ```gtklp```. Printing with ```lp``` or ```lpr``` is accomodated by the first and third methods.

<<Anchor(cupsbrowsed)>>
Line 274: Line 719:
8.x client machine if you want to discover print queues broadcast with
DNS-SD (Bonjour broadcasting) and have them available in the print
dialogues of GUI applications and usuable by command line programs. Documention
is in /usr/share/doc/cups/README.Debian.gz, /etc/cups/cups-browsed.conf,
cups-browsed [LINK] and cups-browsed.conf [LINK]. The avahi-daemon
[LINK] package also needs to be installed on the client.

A server with a CUPS version of 1.6.x does not need cups-browsed to do
DNS-SD broadcasting but avahi-daemon is required.
8.x or 9.x client machine if you want

 * to discover [[#autodiscovery|remote]] print queues broadcast with DNS-SD (Bonjour broadcasting) and
 * have them automatically available in the print dialogs of GUI applications and usable by command line programs.

It is [[#tempq|not necessary]] on 10.x, but could be seen as desirable if it deals with a situation CUPS cannot handle. An example might be the [[https://github.com/apple/cups/issues/5011|filtering of print queues]] from a print dialog.

The change in CUPS 1.6.x came about because upstream CUPS abandoned CUPS browsing as a way of broadcasting and discovering print queues and printers. There is a number of issues inherent in this method, as [[https://lists.cups.org/pipermail/cups/2012-November/053841.html|this mail]] explains. cups-browsed was devised to bring about backward compatibility and give continuity to the printing system. It does not intend to be available in perpetuity. With the [[#tempq|arrival of CUPS 2.2.4]] the cups-browsed author [[https://lists.cups.org/pipermail/cups-devel/2017-May/016988.html|reassessed]] his work for the future:

{{{
In small home networks and on mobile devices cups-browsed is not
actually needed any more, as the IPP backend replaces it in this simple
case of not needing load-balancing printer clusters and remote CUPS
servers being CUPS 1.6.x or newer.

cups-browsed will be continued, to provide additional functionality,
especially interoperability of CUPS 1.5.x or older with CUPS 1.6.x or
newer, to create load-balancing printer clusters, and to allow complex
filtering on which remote queues/printers one wants to see and which not.
}}}

Comprehensive documention is in ''/usr/share/doc/cups/README.Debian.gz'', ''/etc/cups/cups-browsed.conf'', [[DebianMan:cups-browsed|cups-browsed]] and [[DebianMan:cups-browsed.conf|cups-browsed.conf]]. There are significant differences in the cups-browsed facilities, such as [[DriverlessPrinting|driverless printing]], provided on jessie, stretch and buster.

The [[DebianMan:avahi-daemon|avahi-daemon]] package also needs to be installed on the client. The default cups-browsed.conf is set to do both DND-SD (Bonjour) discovery (CUPS only offers Bonjour broadcasting) and, for legacy purposes, CUPS IPP discovery of print queues. A server with a CUPS version of 1.6.x or greater does not need cups-browsed to do DNS-SD broadcasting but avahi-daemon is required.

|| ||<-2 #E0E0FF> DNS-SD Broadcasting (Server) ||<-2 #E0EFFF> DNS-SD Discovery (Client) ||<-2 #E0EFFF> ||
||<#FFFFE0>Debian Version ||<#E0E0FF>wheezy ||<#E0E0FF>jessie, stretch and buster ||<#E0EFFF>wheezy ||<#E0EFFF>jessie and stretch ||<#E0EFFF>buster ||
||<#FFFFE0>cups-browsed needed ||<#E0E0FF>Not available ||<#E0E0FF> {X} ||<#E0EFFF>Not available <<BR>> Use dnssd backend ||<#E0EFFF> (./) ||<#E0EFFF> {X} <<BR>> [[#tempq|Optional]] ||
||<#FFFFE0>avahi-daemon needed ||<#E0E0FF> (./) ||<#E0E0FF> (./) ||<#E0EFFF> (./) ||<#E0EFFF> (./) ||<#E0EFFF> (./) ||


|| ||<-2 #E0E0FF> Legacy CUPS Broadcasting (Server) ||<-2 #E0EFFF> Legacy CUPS Discovery (Client) ||
||<#FFFFE0>Debian Version ||<#E0E0FF>wheezy ||<#E0E0FF>jessie, stretch and buster||<#E0EFFF>wheezy ||<#E0EFFF>jessie, stretch and buster||
||<#FFFFE0>cups-browsed needed ||<#E0E0FF> {X} <<BR>> Not available ||<#E0E0FF> (./) ||<#E0EFFF> {X} <<BR>> Not available ||<#E0EFFF> (./) ||
||<#FFFFE0>avahi-daemon needed ||<#E0E0FF> {X} ||<#E0E0FF> {X} ||<#E0EFFF> {X} ||<#E0EFFF> {X} ||

<<Anchor(tempq)>>
=== Temporary Queue Creation by CUPS ===
Since version 2.2.4 CUPS has gained the ability to browse the DNS-SD broadcasts of remote [[#autodiscovery|print queues and printers]] picked up by avahi-daemon. Discovered remote queues and IPP printers can be listed in the print dialogs of applications without having a local queue. On accessing a listed queue to print a job, CUPS on the client machine creates a PPD using the [[DriverlessPrinting#lpadmin|everywhere model]]. This queue is temporary and disappears a minute after being idle (or when the cups service is stopped). The intent is that a queue is added only when it is needed to print something and there is no need to use memory, CPU cycles, etc for printers that are only created just in case the user wants to print.

Having cups-browsed running leads to its [[#autodiscovery|controlling automatic queue creation]] instead. By default cups-browsed will use the same destination name as the CUPS temporary queue creation mechanism does (''LocalQueueNamingRemoteCUPS DNS-SD'' in cups-browsed.conf). This allows it to overwrite a temporary queue and set up a local queue with the same name.
                                                                                                                      
Qt applications and libreoffice use the CUPS temporary queue facility to form their print dialogs. lp and lpr can also use it. First discover local and remote queues and printers (note that `lpstat -a` shows only local queues):

{{{
lpstat -e
}}}

Then print to a chosen one:
{{{
lp -d <printer_or_print_queue>
}}}

<<Anchor(gtk)>>
Line 286: Line 775:
The section on cups-browsed might give the impression that no
printing can take place from a Debian 8.x.x client without it. This is not quite
the case; it all depends on what you are printing from. Nevertheless it is worth
repeating that cups-browsed promotes printing from all applications and from the
command line.

Iceweasel, Evince and gedit (to name three) use the GTK print dialog
as a printing subsystem. The subsystem gets print queue information directly
from Avahi and the queues appear in the print dialogues of applications. cups-browsed isn't needed and neither for that matter is
CUPS.

The print dialogues of Qt applicatications (Okular, Konqueror etc) and
Libreoffice do not have this feature as yet. [LINK]
The sections on [[#cupsbrowsed|cups-browsed]] and [[#tempq|temporary queues]] might give the impression that remote printers and print queues cannot be discovered, and printing cannot take place from Debian 8, 9 and 10 clients, without either of them. This is not quite the case; it all depends on what you are printing from. Nevertheless, it is worth highlighting that
 * cups-browsed promotes printing from all applications and from the command line.
 * Temporary queue formation is a central feature in the Qt and LibreOffice print dialogs.

DebPkg:Firefox, DebPkg:Evince and DebPkg:gedit (to name but three applications) use the GTK print dialog as a printing subsystem. The subsystem gets remote print queue and printer information directly from [[PrintingGlossaryandIndex#avahi|Avahi]] and the queues appear in the print dialogs of those applications. cups-browsed and temporary queues aren't needed and neither for that matter is CUPS. This means that printers and print queues get broadcasted via [[PrintingGlossaryandIndex#bonjour|Bonjour]] and an application's GTK print dialog browses the Bonjour broadcasts to add available remote printers and queues to its list.

Displaying and printing to a queue advertised by a remote CUPS server should present no difficulty. However, although the GTK print dialog can detect an IPP printer, it would appear [[DriverlessPrinting#gtk|not to support printing to it]].
 
 * GTK applications need CUPS to handle local (but not remote) print queues.
 * The [[PrintingGlossaryandIndex#dialog|print dialogs]] of Qt applications (DebPkg:Okular, DebPkg:Konqueror etc) and DebPkg:LibreOffice [[DriverlessPrinting#tempq|enumerate]] printers and queues using CUPS to browse [[PrintingGlossaryandIndex#dnssd|DNS-SD]] advertised queues and printers.

<<Anchor(cupsclient)>>
Line 302: Line 789:
Print queue availability using browsing is a dynamic process. Queues
will come and go as they are enabled and disabled or as a machine
is moved from network to network. In a world which more and more has a
focus on mobile devices there are benefits to be gained from
avahi-daemon and cups-browsed or from a print dialogue which implements
Avahi discovery itself.

However, it is possible a static configuration is entirely suitable for
some purposes. In other words, no avahi-daemon, no cups-browsed and no
cupsd running on a machine and instead connecting to a designated
server. The first step is to read this manual [LINK]. Then

{{{
  apt-get install cups-client
Print queue availability by browsing the Bonjour broadcasts from a server is a dynamic process. Queues will come and go as they are enabled and disabled or as a client is moved from network to network. In a world which more and more has a
focus on mobile devices there are benefits to be gained from avahi-daemon and cups-browsed or from a print dialog which implements Avahi discovery itself.

However, it is possible a static configuration is entirely suitable for some purposes. In other words, no avahi-daemon, no cups-browsed and no cupsd running on a machine and instead connecting directly to a designated server. The first step is to read [[DebianMan:client.conf|this manual]]. Then

{{{
apt-get install cups-client
Line 322: Line 802:
  mkdir ~/.cups
  touch ~/.cups/client.conf
mkdir ~/.cups
touch ~/.cups/client.conf
Line 329: Line 809:
  ServerName 192.168.7.20
}}}

The local queue is eliminated and print jobs from all applications and
the command line go straight to
ServerName for processing. There is the
bother of changing Servername when moving from network to network but
this may be balanced by not having to run three daemons,
ServerName 192.168.7.20
}}}

The local queue is eliminated and print jobs from all applications and the command line go straight to !ServerName for processing. There is the bother of changing !ServerName when moving from network to network but this may be balanced by not having to run three daemons,
Line 341: Line 818:
  lp -h server_IP_or_hostname -d print_queue_on_server print_job
}}}
























## You can add other _helpful_ links here.
##== See also ==
lp -h <server_IP_or_hostname> -d <print_queue_on_server> <print_job?
}}}

<<Anchor(confs)>>
=== Configuration Files for the Scheduler, cupsd ===

These are located in ''/etc/cups'' as [[DebianMan:cupsd.conf|cupsd.conf]] and [[DebianMan:cups-files.conf|cups-files.conf]]. The existence of two files arises from a [[DebianBug:692791|Debian bug report]] which lead to the fixing of a privilege escalation from lpadmin to root on systems with all options contained in cupsd.conf, as they were at that time.

cups-files is editable only by root. cupsd.conf can be edited by root and, from the web interface only, by a user who is a member of the lpadmin group. After editing either file cupsd has to be restarted:

{{{
service cups restart
}}}

It can be very convenient to change some of the cupsd.conf settings with
[[DebianMan:cupsctl|cupsctl]] (as root only). The current settings displayed by

{{{
cupsctl
}}}

might be

{{{
_debug_logging=0
_remote_admin=0
_remote_any=0
_share_printers=0
_user_cancel_any=0
BrowseLocalProtocols=dnssd
DefaultAuthType=Basic
JobPrivateAccess=default
JobPrivateValues=default
MaxLogSize=0
SubscriptionPrivateAccess=default
SubscriptionPrivateValues=default
WebInterface=Yes
}}}

Change a displayed setting with

{{{
cupsctl Webinterface=no
}}}

and, for a setting which is not displayed:

{{{
cupsctl SystemdIdleExit=Off
}}}

More than one line in cupsd.conf can be changed with some commands and cupsd is restarted when cupsctl is used. cups-files cannot be altered with cupsctl.



=== See Also ===
 * [[Printing|The Debian Printing Portal]]
Line 371: Line 877:
## If this page belongs to an existing Category, add it below.
## CategorySomething | CategoryAnother

CategoryPrinter

Translation(s): none


Setting up and administering print queues within the CUPS printing system. Aimed at a Debian 10 (buster) installation, but much of the material should apply to Debian 9 (stretch) and Debian 8 (jessie) too.

Introduction

The major changes in Debian 10 (buster) compared with the two previous stable distributions have to do with driverless printing. It is offered on Debian 9, but both CUPS and cups-browsed have augmented their software to include more filters and options to take advantage of modern-day printing technology. For CUPS it is worth mentioning the introduction of temporary queue formation and Apple Raster as a supported PDL. For cups-browsed there is now a rastertopclm filter and more support for setting up driverless printing automatically.

Users of legacy printers (printers which depend on what the vendor software supplies) should be unaffected by these changes for now.

A document destined for a printer or print server is frequently called a print job. On its way there it is first put into a queue before being processed. The queue has certain properties which determine how the print job is dealt with and may be queried with lpoptions and lpstat for a list of these properties and the queue status repectively.

The properties specified when the queue is created are not immutable. Quite a few of them can be altered by a user via lp or an application when the print job is submitted to the queue. A user can also set default printing options in ~/.cups/lpoptions. An administrator who hoped to confine users to duplex (two-sided) printing, for example, would have to look outside the CUPS framework for a solution to add to the system.

Several queues can point to the same physical device, the printer, but it is very common for print queue and printer to be used interchangably. No harm need come from this, but it pays to give careful attention to whether a CUPS print server or a printer is being contacted. This account treats general principles and manual setup of a queue first; automatic setup and a glimpse of a modern development follow later.

The device-uri

Ultimately, a print job has to go somewhere; most users expect the job to go to a printer. However, the job is only going to get to the printer (after being taken out of the queue) if the device-uri is one recognised by CUPS and the printer. lpinfo allows you to see which device-uris are associated with a print server or printer:

/usr/sbin/lpinfo -v

Backends in /usr/lib/cups/backends are now used in discovery mode in an endeavour to locate printers. Here is the output of one such command when two printers are attached to a Debian 10 (buster) machine via USB (an HP PSC 1300) and parallel (an Epson Stylus 740) ports and two are available over the network (an HP LaserJet 2200 and an HP ENVY 4500):

network lpd
network ipp
network http
network socket
network beh
network https
network ipps
direct parallel:/dev/lp0
serial serial:/dev/ttyS0?baud=115200
serial serial:/dev/ttyS1?baud=115200
direct usb://hp/psc%201300%20series?serial=HU3AFBQ28Y9F&interface=1
direct hp:/usb/psc_1300_series?serial=HU3AFBQ28Y9F
direct hpfax
network dnssd://ENVY4500._ipp._tcp.local/?uuid=1c852a4d-b800-1f08-abcd-308d99fafac2
network socket://192.168.7.211
network socket://192.168.7.235:9100
network ipp://ENVY4500.local:631/ipp/print  

The USB connected printer and the networked ones have device-uris

direct usb://hp/psc%201300%20series?serial=HU3AFBQ28Y9F&interface=1
direct hp:/usb/psc_1300_series?serial=HU3AFBQ28Y9F

network dnssd://ENVY4500._ipp._tcp.local/?uuid=1c852a4d-b800-1f08-abcd-308d99fafac2
network socket://192.168.7.211
network socket://192.168.7.235:9100
network ipp://ENVY4500.local:631/ipp/print
  • The USB connected printer has been located by two backends; usb and hp. The first backend comes from CUPS and the second from HPLIP. Either device-uri can be used.

  • The CUPS snmp backend has discovered the networked LaserJet 2200 (at 192.168.7.211) and the ENVY 4500 (at 192.168.7.235). A queue set up with this device-uri for the LaserJet would need the -m option to be given a PPD. The same would have to be done for the ENVY 4500 unless, alternatively, -m everywhere is used.

  • Additionally, the ENVY 4500 has been found from its DNS-SD broadcasts by the CUPS dnssd backend and by CUPS itself. Either device-uri can be used.

  • A parallel port has also been found by the cups-filters parallel backend. Its device-uri is

parallel:/dev/lp0

For more detail and to identify the makes and models of the printers you will want to do

lpinfo -l -v

In this case, an edited output is

Device: uri = usb://hp/psc%201300%20series?serial=HU3AFBQ28Y9F&interface=1
        class = direct
        info = hp psc 1300 series
        make-and-model = hp psc 1300 series
        device-id = MFG:hp;MDL:psc 1300 series;CMD:LDL,MLC,PML,DYN;
                    CLS:PRINTER;1284.4DL:4d,4e,1;SN:HU3AFBQ28Y9F;
                    S:0380008000020020112fff8d800fff8d800;Z:007;
        location =

Device: uri = hp:/usb/psc_1300_series?serial=HU3AFBQ28Y9F
        class = direct
        info = HP psc 1300 series USB HU3AFBQ28Y9F HPLIP
        make-and-model = HP psc 1300 series
        device-id = MFG:hp;MDL:psc 1300 series;CLS:PRINTER;
                    DES:psc 1300 series;SN:HU3AFBQ28Y9F;
        location =

Device: uri = parallel:/dev/lp0
        class = direct
        info = EPSON Stylus COLOR 740 LPT #1
        make-and-model = EPSON Stylus COLOR 740
        device-id = MFG:EPSON;CMD:ESCPL2,BDC,D4;MDL:Stylus COLOR 740;CLS:PRINTER;
        location =

Device: uri = socket://192.168.7.211
        class = network
        info = HP LaserJet 2200
        make-and-model = HP LaserJet 2200
        device-id = G:Hewlett-Packard;CMD:PJL,MLC,PCL,PCLXL,POSTSCRIPT;
        MDL:HP LaserJet 2200;CLS:PRINTER;DES:Hewlett-Packard LaserJet 2200;
        MEM:8MB
        location =

Device: uri = socket://192.168.7.235:9100
        class = network
        info = ENVY 4500 series
        make-and-model = HP ENVY 4500 series
        device-id = MFG:HP;MDL:ENVY 4500 series;CMD:PCL3GUI,PJL,Automatic,
                    JPEG,PCLM,AppleRaster,DW-PCL,802.11,DESKJET,DYN;
                    CLS:PRINTER;DES:A9T87B;CID:HPIJVIPAV4;LEDMDIS:USB#FF#CC#00,
                    USB#07#01#02,USB#FF#04#01;IPP-HTTP:T;IPP-E:
                    FF-CC-00,07-01-02,FF4-01;SN:CN56G332DT060D;
                    S:038080C484a01021002c1f3000ac2880014;J:;
                    Z:0102,05034ee800aaa8,0600,0c0,0e000c0000,0f01000000,
                    10000008000008,12000,147,150,16361a34ee000116da17d40001,
                    1700005a000000,180;
        location = Study

Device: uri = dnssd://ENVY4500._ipp._tcp.local/?uuid=1c852a4d-b800-1f08-abcd-308d99fafac2
        class = network
        info = ENVY4500
        make-and-model = HP ENVY 4500 series
        device-id = MFG:HP;MDL:ENVY 4500 series;CMD:PCL,JPEG,URF;
        location =

Device: uri = ipp://envy4500.local:631/ipp/print
        class = network
        info = HP ENVY 4500 series (driverless)
        make-and-model = HP ENVY 4500 series
        device-id = MFG:HP;MDL:ENVY 4500 series;CMD:PCLM,PCL,AppleRaster,JPEG,URF;
        location =

The dnssd://... entries are either Bonjour-broadcasted print queues from a CUPS server on a remote machine or Bonjour-enabled printers; DNS-SD has located them with the help of Avahi. In general, queues created with a dnssd://... device-uri and pointing to a server should be set up on the client as raw queues so that the filtering takes place entirely on the remote server.

If it is known that a queue on the remote machine is itself a raw one or the device-uri points to a printer, you might have to consider whether setting up a local raw queue achieves what you want (see Tea4CUPS for situations in which you would want a local raw queue).

A Bonjour-enabled printer would almost certainly require a local non-raw queue to be set up manually or for a driverless printing technique to be used.

Which dnssd://... entries are queues and which are printers?

/usr/lib/cups/backend/dnssd > dnssd.log

grep "local/cups" dnssd.log      (These are print queues).
grep "local/?uuid" dnssd.log     (These are printers).
grep "Unknown" dnssd.log         (These are raw print queues).

A client machine with a cups version greater than or equal to 1.6.x will have the dnssd://... queues and printers automatically found with avahi-daemon plus cups-browsed and listed with

lpstat -t

The device-uri for a Networked Printer

CUPS can use at least one of the AppSocket, Internet Printing (IPP) and Line Printer (LPD) protocols for connecting to printers and print servers over a network connection. For a view of which services a device supports there is the nmap command:

nmap <ip_address_or_hostname>

The output will vary from printer to printer. For an HP Envy 4500 it is

PORT     STATE SERVICE
80/tcp   open  http
443/tcp  open  https
631/tcp  open  ipp
8080/tcp open  http-proxy
9100/tcp open  jetdirect
9220/tcp open  unknown

The choice of protocol will be driven by your needs and what is offered by the printer or print server. AppSocket is non-complex, usually well-implemented, low overhead and reliably gets the data from point A to point B, but doesn't do much else. IPP provides bidirectional communication for feedback and control, secure authentication services, access control and printer discovery and status. Its use is mandatory on AirPrint and IPP Everywhere printers. LPD is a popular protocol older than IPP and with a feature set less extensive than it. Secure access, detailed error status reports and the ability to query a printer are lacking, for example.

  • AppSocket

Also known as the JetDirect or RAW protocol, this is the most basic protocol that can be supported by a printer. The URI scheme is

socket://<ip_address_or_hostname>:[port_number]

The standard port number is 9100 and this will be used by default if omitted from the device-uri. Print servers with three outputs would require three port numbers; for example, 9100, 9101 and 9102.

It is questionable whether AppSocket is a protocol. There is no specified standard for it; no queue management; no aborting of jobs; no querying of printer supplies; no encryption. All it does is shovel the data for a print-ready file over the network and then close the connection. Because the only overhead is TCP/IP the data transfer is generally fast. Also, it has been in widespread use for a long time so the printer implementations of AppSocket are good.

  • IPP

Printing normally takes place over port 631 with the URI scheme being

ipp://<ip_address_or_hostname>:[port_number]/resource

Unfortunately, the resource path has never been standardised and it may require some experimentation to determine what a printer or server will accept, especially if the device is not on the local network or it does not do, as most modern printers do, Bonjour broadcasting. Apparently, newer printers often use /ipp/print in the path but for older products (as well as newer ones) it could be something entirely different, like ipp/port1, ipp, ipp/printer or ipp/laserjet. Maybe the printer's front panel will help. Or

/usr/lib/cups/backend/snmp <ip_address>

could give suitable output if there is explicit information from the Port Monitor MIB (Management Information Base) database of the printer. In the absence of an MIB the probing is for AppSocket, then LPD and the first that works is reported. Because AppSocket is supported by most network printers it would likely be the protocol given for use in a URI. So not so useful for getting an IPP URI.

If an IPP printer has registered itself using Avahi, more success with obtaining an IPP URI could be achieved by installing avahi-utils, running avahi-browse and looking at the rp= TXT Record Key:

avahi-browse -art | less

An additional technique is to install cups-ipp-utils and execute ippfind:

ippfind                         (Shows IPP printers and print queues).
ippfind -T 5                    (Possibly more reliable).
ippfind ! --txt printer-type    (Show IPP printers only).

An alternative command (which relies on ippfind) is

driverless

A CUPS server can always be reached with

ipp://<ip_address_or_hostname>/printers/<print_queue_name>

In theory, the handshaking and status monitoring done by the IPP protocol should ensure reliable printing but, in practice, there are older printers which do not implement some aspects of IPP very well. However, these days, a more optimistic view of the situation can be taken.

  • LPD

This is the original network protocol. It has a URI scheme of

lpd://<ip_address_or_hostname>/<print_queue_name>

and a default port of 515. Even though AppSocket and IPP are seen as better alternatives, it is regarded as a reliable protocol for sending a job to a printer. CUPS itself has some limited functionality for LPD-based clients

Configuring the Choice of Backend

The cups package provides a debconf method for selecting backends which are used for printer discovery and connection to the device. It basically gives a convenient way of copying the backends which come with CUPS between /usr/lib/cups/backend-available/ and /usr/lib/cups/backend/. Run

dpkg-reconfigure cups

Note that not every backend on the system is managed with this command because they are not all in the cups package. For example, the parallel and beh backends are in the cups-filters package.

Be careful about which backends are removed from the debconf list. Deleting the dnssd backend would still allow remote Bonjour broadcasted queue discovery via cups-browsed but Bonjour broadcasted printers would not seen by CUPS. An AppSocket-enabled printer would be discoverable with the snmp backend but, if the socket backend was deleted, trying to set up a queue using a socket://... URI would give the error Bad device-uri scheme "socket".

Printer Drivers

The job of a printer driver is to ensure that printing options are applied by the scheduler and the filtering system and produce a final output which can be understood by the printer.

Drivers are in the printer-driver-* packages plus various other packages. The print server task in Debian Installer gives you a full complement of these drivers. You may decline this task at install time but after first boot can do either

  apt-get install task-print-server

or

  apt-get install cups

If a driver/PPD for your printer is not in any of the installed packages you have various choices open to you:

  • Consult openprinting for ideas on available drivers.

  • Hunt down an appropriate package with

   apt-cache search search_term

Users who possess a modern printer are urged to consider a driverless printing solution (buster only), perhaps by setting up a suitable print queue or by following the advice here. The days of CUPS continuing driver support in the form it is now are numbered.

Non-free Printer Drivers and Firmware

Driver software distributed with quite a few printers does not meet the criterion of being DFSG-free, so users who need to use such a driver with a printer will have to rely completely on what the printer manufacturer has to offer to get their printer working. Also, even though most HP printers operate with DFSG-free software, some HP devices used with hplip require a proprietary host-based driver plugin or a firmware file to allow full access to printer or scanner features or enhanced performance. The firmware is uploaded to the printer when it is powered-on attached to the computer. The host-based plugin software is used when printing or scanning.

It may be necessary to go to the manufacturer's website if the printer is a new model and drivers for it are not yet in a Debian package (or never will be) and driverless printing is not an option. However, it would be highly unlikely that a modern, AirPrint-enabled printer would not be a good fit for driverless printing on Debian 10 (buster) and later, and therefore a user is advised to follow this route for a quick, efficient and almost effortless modern printer setup.

  • Brother

Solutions for Linux is a good place to start for assessing what support your printer has from Brother. Generally, you will need .deb files for the cupswrapper and the lpr driver. Follow the instructions to install them; alternatively, there is linux-brprinter-installer to do that for you.

  • Canon

There is a Canon wiki page dealing with printers requiring URF-II, CAPT and cnijfilter drivers. A Canon Advanced Printing Technology (CAPT) printing package and a cnijfilter package can be installed in a similar way to Method 1 at the previous link. Namely: extract files from the package with tar zvxf..... and install Debian packages with apt install ./....

Some useful phrases for locating Canon packages on the web are:

  • cnijfilter debian 5.70
  • ufr printer driver for linux
  • capt printer driver for linux

Alternatively, search for a package from a Canon website

  • Epson

A goodly number of Epson printer drivers fall into the category of DFSG-free. These are gathered together in printer-driver-escpr. Free and non-free drivers may be located and downloaded from this Epson website.

  • Samsung

Linux support for a Samsung printer can be searched for from either the HP or Samsung web sites. Many, but not all, Samsung printer models use the Unified Linux Driver (ULD). ULD contains PPDs for Linux supported printers, a printer driver to use with the PPDs and a library to use with the driver. It comes in a .tar.gz package and only supports the i386 and amd64 platforms. No source code is provided.

Extract the files in the tarball and install them by entering the directory created and running install-printer.sh

tar zvxf uld_v1.00.xx_xx.xx.tar.gz
cd uld
./install-printer.sh

Samsung does not provide ULD as a .deb but the The Samsung Unified Linux Driver Repository does. It also has a good deal of information on the installation of ULD and its interaction with a Debian system. SULDR is not affiliated with Samsung.

  • HP

A relatively small number of HP devices require a plugin to be installed on the computer for them to operate at all or to function at their full potential for one or more of the device's printing, scanning or faxing modes. For a handful of HP printers the plugin package contains firmware which has to be uploaded to a printer. Without a firmware requirement the plugin software can still be needed to interact with the printer. Effectively, the print job is processed by the plugin to produce a file in a language the printer understands. In technical literature the printer would be described as host-based. See whether the plugin is needed and use HP's home page search facility to see a printer's details and find out what any firmware is required for. hp-plugin -i is a command to use to install the plugin.

Plugin software can be installed (as root) without the hplip package and its dependencies being on the system.

  • apt install hplip-data

  • Download the appropriate plugin file to a chosen directory.

  • sh hplip-<version>-plugin.run --tar vxf

  • python installPlugin.py or python3 installPlugin.py

  • apt purge hplip-data

  • foo2zjs (firmware and colour profiles)

Not the name of a printer manufacturer but a Debian package which can install firmware and colour profiles for a number of printers which use the ZjStream wire protocol. The commands (as root)

getweb | less
getweb p1008

give a list of what is available and download the firmware file for an HP LaserJet P1008. Hannah is a graphical firmware downloader which uses getweb. Re-plug the connection to the printer to upload the firmware to it.

Avoiding Non-free Printer Drivers and Firmware

A non-free filter generally gets used at the last stage of the filtering process after cups-filters has done its job. The process ends with something that is sometimes termed host-based (and which is often proprietary) rather than letting the printer itself take care of the final conversion. It makes sense to the printer manufacturer to do this (probably on legal, technical or economic grounds) but it disrupts the free software ecosystem within which CUPS and cups-filters operate.

           +----------------------+    +-----------------+
File in -> |CUPS and cups-filters | -> | Non-free driver | -> Printer
           +----------------------+    +-----------------+

The final stage of this process could be dispensed with if what was sent to the printer was something it could understand.

                                        +------------------------+
           +-----------------------+    | Something the printer  |
File in -> | CUPS and cups-filters | -> | understands sent by    | -> Printer
           +-----------------------+    | CUPS and cups filters. |        
                                        +------------------------+

Recent developments in printer technology see printers understanding MIME types image/pwg-raster and image/urf. These file types are also referred to as PWG and Apple raster data formats respectively.

                                        +--------------+
           +-----------------------+    | Apple raster |
File in -> | CUPS and cups-filters | -> | or           | -> Printer
           +-----------------------+    | PWG raster   |     
                                        +--------------+

From CUPS 2.2.2 and cups-filters 1.13.0 onwards it is possible to send a job in Apple and PWG raster to a printer which understands either data format. This is dealt with in more detail on the driverless printing page.

The PPD File

PostScript Printer Description (PPD) files were originally used by printers which operated with PostScript as a Page Description Language (PDL) for printing. They have been adapted to cope with other standard printer languages such as HP's Printer Command Language (PCL) and special (often proprietary) languages. Driver packages include PPDs in their contents.

A searchable list of PPDs on your system is obtained with

/usr/sbin/lpinfo -m | less

If there is only one for your printer the choice is made for you! If there is more than one, go for the PPD which is marked Recommended. If none are recommended use common sense or seek help from the openprinting database.

Some Generic PPDs are listed with lpinfo -m and one could be a solution when every driver package is installed and your printer model is not in the list. You can also resort to the printer manufacturer's website or a CD which came with the printer.

It is convenient (and probably sensible) to put a PPD obtained from elsewhere in /usr/share/ppd/custom. It will then be displayed in the outputs of lpinfo -m, the web interface and system-config-printer.

Creating a Print Queue with lpadmin

This is the basic method to set up a queue. It is used behind the scenes with system-config-printer, HPLIP, cups-browsed and the CUPS web interface. There are four essentials to provide when setting up a working, accepting print queue with lpadmin.

  1. The queue name (-p): The printing system treats the name in a case-insensitive manner; LaserJet-300 is the same queue as laserjet-300.

  2. The device-uri (-v): The destination for a print job; usually a printer.

  3. The printer model (-m): Determines how the print job is handled by the filtering system to produce data which can be successfully printed by the printer. Options are to specify a PPD or have a PPD generated from the printer response to being queried (everywhere) or raw.

  4. Whether the queue is enabled (-E): Must be specified explicitly.

With this information:

lpadmin -p <queue_name> -v <device-uri> -m <PPD_or_everywhere_or_raw> -E

sets up the queue.

Sometimes it is necessary or desirable to establish a raw queue. That is, a queue where the filtering system is not involved and the print job goes directly to a printer or another queue.

lpadmin -p <queue_name> -v <device-uri> -m raw

lpoptions is the command to use to see default printer-specific options (obtained from the PPD) for the queue.

lpoptions -p <queue_name> -l

The previous lpadmin command is about as simple as it gets for setting up a queue quickly but it can be tweaked just as simply by giving the command some printer-specific options to add with -o.

The lpadmin and lp manuals are sources for non-PPD options.

Setting up a queue with lpadmin or the web interface requires either root privileges or for the user to be a member of the lpadmin group. If you installed CUPS using the printserver task in the Debian installer, the first user is put in the lpadmin group.

Check for user membership of the lpadmin group with the command

groups

If lpadmin doesn't appear in the previous command output execute this command (change username with your user name)

usermod -a -G lpadmin username 

Creating a Print Queue with the CUPS Web Interface

http://localhost:631 is the location of the interface and from there you can administer print queues, including their installation. Administration tasks are able to be completed by giving the root name and password or the user name and password of an lpadmin group member.

The Add Printer button could produce a first page with something like this on it:

             Local Printers:    CUPS-BRF (Virtual Braille BRF Printer)
                                Serial Port #1
                                Serial Port #2
                                HP psc 1300 series USB HU3AFBQ28Y9F (HP psc 1300 series)
                                hp psc 1300 series (HP psc 1300 series)
                                HP Fax (HPLIP)
                                EPSON Stylus COLOR 740 LPT #1 (EPSON Stylus COLOR 740)
Discovered Network Printers:    ENVY4500 (HP ENVY 4500 series)
                                LaserJet-300 @ desktop (HP HP LaserJet 2200)
                                HP LaserJet 2200 (HP LaserJet 2200)
                                ENVY 4500 series (HP ENVY 4500 series)
     Other Network Printers:    AppSocket/HP JetDirect
                                Internet Printing Protocol (ipps)
                                Internet Printing Protocol (ipp14)
                                Internet Printing Protocol (https)
                                Internet Printing Protocol (http)
                                LPD/LPR Host or Printer
                                Internet Printing Protocol (ipp)

Which doesn't look significantly different from what lpinfo gave previously.

Under Local Printers: are the discovered printers which are directly connected to the machine being used. Discovered Network Printers: are networked printers on the same subnet as your machine. Or they could be print queues which the dnssd backend has found on the same subnet. In both cases backends have been run in discovery mode to find printers. The device-uri found is on the second page of the interface. In most cases your printer will appear in this two options, if it doesn't try to restart it with the power button or use Other Network Printers option to set it manually.

Other Network Printers: gives you the opportunity to provide the device uri and PPD for a printer or queue which falls into neither of the previous two categories. The information is provided on the second and third pages.

Having made a selection from Local Printers: or Discovered Network Printers: you should find a queue name based on the printer make and model has been filled in for you on the next page. Change it by all means if you wish. Once it is done it cannot be modified later because a new name would imply setting up a different, new queue.

Share printers connected to this system on the Administration page is the basic facility to allow (or not allow) DNS-SD broadcasting of the queue on Debian 8.x Debian 9.x. Ticking Share This Printer on the second page designates your queue as one to add to this facility.

Moving on to the third page you should find that a PPD has been selected for you, unless

  • The printer provides no make and model information to CUPS.
  • There is no PPD for the printer on the system.
  • Other Network Printers: is being used.

The previous driver and PPD comments apply here too.

The final page has the default printer-specific options from the PPD and a few non-specific printer options. This should suit the needs of many users.

Creating a Print Queue with HPLIP

HPLIP is a one-stop solution for printing, scanning and faxing with appropriate HP devices and designed to work with CUPS. Only the printing aspect is dealt with here. USB scanning is the subject of another wiki page and network scanning is linked from it. HPLIP uses its own printer backend, hp:/..., and URI scheme for printer discovery and sending a print-ready job to the printer. For a graphical user interface (GUI) to HPLIP there is a hplip-gui, which contains very similar utilities to the ones in the hplip package.

  • URI scheme: USB printer.

hp:/usb/<printer_model>?serial=<serial_number>
  • URI scheme: networked printer.

hp:/net/<printer_model>?ip=<IP_address>
hp:/net/<printer_model>?hostname=<DNS_hostname>
hp:/net/<printer_model>?zc=<zeroconf(avahi, Bonjour)_hostname>
  • URI scheme: parallel port printer.

hp:/par/<printer_model>?device=/dev/parportX (X=1,2...)

Each printer model supported by the installed verion of HPLIP is listed in /usr/share/hplip/data/models/models.dat. Model names are enclosed in square brackets; like so, [envy_4500_series].

Printer discovery and setting up a print queue can be done from the command line with hp-setup. For USB and printers on the network:

hp-setup -i -busb
hp-setup -i -bnet

You will be led through the rest of the procedure.

hp-setup uses one of two methods to find printers on the network - Service Location Protocol (SLP) and mdns (Bonjour) broadcasts from suitable printers.

The SLP service agent runs on port 427 of a printer; do you have such a service?

  • nmap -sU -p 427 <ip_address>

will tell you.

The command hp-setup -i -bnet uses only SLP for discovery. If you want to setup a queue for an mdns advertised printer it is suggested to do

  1. hp-probe -mmdns (This provides a Device URI).
  2. hp-setup -i -d<Device URI>

A problem with firewall settings could lead to the first command failing.

Creating a Print Queue with system-config-printer

The idea of system-config-printer is to provide functionality similar to lpadmin and the CUPS web interface but with GTK+ widgets and greater desktop integration. Anyone familiar with the CUPS web interface should feel at home with it but note that there is a difference in the way adminstrator privileges for the printing system are gained.

A default system-config-printer installs cups-pk-helper as a recommended package to further the aim of desktop integration. cups-pk-helper is intended to give fine-grained control of aspects of CUPS management via policykit. Unlike lpadmin, the CUPS web interface and HPLIP cups-pk-helper does not respect the SystemGroup lpadmin directive in /etc/cups/cups-files.conf and an adminstrator password will be requested to see remote print queues and to administer them and local queues.

scp-1.png

Almost nothing is administratively possible for an ordinary user when cups-pk-helper is on the machine. A user is entitled to cancel her own jobs but without the machine's administrator altering policykit's view of who is entitled to administer printers nothing else is available.

This can be done with a file ending with .pkla put into /etc/polkit-1/localauthority/50-local.d. With the contents

[Printer configuration]
Identity=unix-user:milly;unix-user:molly;unix-user:mandy
Action=org.opensuse.cupspkhelper.mechanism.*
ResultAny=no
ResultInactive=no
ResultActive=yes

the users milly, molly, mandy would have privileges granted similar to those granted to a member of the lpadmin group and not have to provide a password. Removing the cups-pk-helper package would be an alternative strategy to allow users in the lpadmin group administrative privileges.

The initial screen seen when system-config-printer is run displays icons and names for local print queues; that is, queues which been set up by a user or by cups-browsed. The Add button is for printer discovery and creating a new queue for a printer. A greyed-out button indicates a lack of some administrative privilege, so go to Server-->Connect-->Connect. Hopefully, the device-uri section will be found useful for interpreting the discovered printers display.

Double Filtering

The CUPS web interface and the command /usr/sbin/lpinfo -v give a list of printers and print queues discovered on the network. Any of the entries in the list can be installed as a local print queue. In other words they will listed in /etc/cups/printers.conf on your machine.

For example, under Discovered Network Printers in the web interface you might see

testq @ desktop (DCP-9020CDW)

and the next web page shows a Connection beginning dnssd://.

The dnssd:// and @ desktop tell you this is a print queue discoverd by avahi-daemon. The (DCP-9020CDW) tells you the make and model of the printer. The latter information is obtained from the *Product line in the queue's PPD, so it implies the queue is not a raw queue and a job sent to it undergoes filtering on the server. The same information is given in the make-and-model field of the output of /usr/sbin/lpinfo -l -v.

On the third web page you should choose Raw as the Make. With lpadmin you should have -m raw. Then the client passes the data through without filtering and all filtering is done correctly on the server.

Alternatively, you can get such queues automatically set up locally by running cups-browsed on the client.

Upstream CUPS has something to say about double filtering. Quoting:

The issue is the MIME typing on the CUPS server - if the server
doesn't recognize the MIME media type then you may end up with
extra filtering.

I'm not saying it can't work (because we have customers that use
that configuration all of the time), it is just that we get a lot
of support calls when people try to do Microsoft-style printer
sharing to a server that is also hosting a CUPS printer driver on
the same queue.

Reinforcing the previous point:

The issue is that for IPP we actually get to use MIME media types,
and the filters in the PPD file specify what the final output type
is. We then try to match things up on the remote system, which is
where the problems typically occur. For example, if the local
driver has a filter that specifies application/vnd.hp-pcl" as the
destination MIME media type but the server does not have that MIME
media type defined/supported for its queue, we have to revert to
"application/octet-stream" (auto-detect).

You can "fix" this with .types and .convs files on the server 
to specify a "-" filter for the affected MIME media types to
application/vnd.cups-raw) but ultimately you are better off
letting the server do the filtering...

You are strongly advised not to do double filtering. Set up the queue on the client as a raw queue if the remote queue is doing the filtering.

Auto-discovery of Remote, Shared Queues and Printers

All four of the previous setup tools for print queue creation (lpadmin, the CUPS web interface, hp-setup and s-c-p) are manual tools and the created queues are also permanent. There is often no need for this permanancy, especially when moving from network to network. Having queues set up automatically and then automatically disappearing when they go offline or are no longer required is useful for conserving resources and having an up-to-date enumeration of queues and printers.

There are currently three methods for getting information from avahi-daemon and automatically displaying print queues and IPP printers in a print dialog.

  • Use cups-browsed to manage queues and printers.

  • Have the dialog itself browse the DNS-SD broadcasts of the queues and printers using avahi-daemon.

  • Use CUPS version 2.2.4 or later versions. They support discovery of Bonjour advertised print queues and printers.

Firefox, Evince and Zathura are examples of applications which use the GTK print dialog. The Qt print dialog is used in Okular and Qpdfview. Libreoffice has its own print dialog. Some but not all programs expecting lp can instead use gtklp. Printing with lp or lpr is accomodated by the first and third methods.

cups-browsed

This package was introduced for CUPS 1.6.x and is necessary on a Debian 8.x or 9.x client machine if you want

  • to discover remote print queues broadcast with DNS-SD (Bonjour broadcasting) and

  • have them automatically available in the print dialogs of GUI applications and usable by command line programs.

It is not necessary on 10.x, but could be seen as desirable if it deals with a situation CUPS cannot handle. An example might be the filtering of print queues from a print dialog.

The change in CUPS 1.6.x came about because upstream CUPS abandoned CUPS browsing as a way of broadcasting and discovering print queues and printers. There is a number of issues inherent in this method, as this mail explains. cups-browsed was devised to bring about backward compatibility and give continuity to the printing system. It does not intend to be available in perpetuity. With the arrival of CUPS 2.2.4 the cups-browsed author reassessed his work for the future:

In small home networks and on mobile devices cups-browsed is not 
actually needed any more, as the IPP backend replaces it in this simple 
case of not needing load-balancing printer clusters and remote CUPS 
servers being CUPS 1.6.x or newer.

cups-browsed will be continued, to provide additional functionality, 
especially interoperability of CUPS 1.5.x or older with CUPS 1.6.x or 
newer, to create load-balancing printer clusters, and to allow complex 
filtering on which remote queues/printers one wants to see and which not.

Comprehensive documention is in /usr/share/doc/cups/README.Debian.gz, /etc/cups/cups-browsed.conf, cups-browsed and cups-browsed.conf. There are significant differences in the cups-browsed facilities, such as driverless printing, provided on jessie, stretch and buster.

The avahi-daemon package also needs to be installed on the client. The default cups-browsed.conf is set to do both DND-SD (Bonjour) discovery (CUPS only offers Bonjour broadcasting) and, for legacy purposes, CUPS IPP discovery of print queues. A server with a CUPS version of 1.6.x or greater does not need cups-browsed to do DNS-SD broadcasting but avahi-daemon is required.

DNS-SD Broadcasting (Server)

DNS-SD Discovery (Client)

Debian Version

wheezy

jessie, stretch and buster

wheezy

jessie and stretch

buster

cups-browsed needed

Not available

{X}

Not available
Use dnssd backend

(./)

{X}
Optional

avahi-daemon needed

(./)

(./)

(./)

(./)

(./)

Legacy CUPS Broadcasting (Server)

Legacy CUPS Discovery (Client)

Debian Version

wheezy

jessie, stretch and buster

wheezy

jessie, stretch and buster

cups-browsed needed

{X}
Not available

(./)

{X}
Not available

(./)

avahi-daemon needed

{X}

{X}

{X}

{X}

Temporary Queue Creation by CUPS

Since version 2.2.4 CUPS has gained the ability to browse the DNS-SD broadcasts of remote print queues and printers picked up by avahi-daemon. Discovered remote queues and IPP printers can be listed in the print dialogs of applications without having a local queue. On accessing a listed queue to print a job, CUPS on the client machine creates a PPD using the everywhere model. This queue is temporary and disappears a minute after being idle (or when the cups service is stopped). The intent is that a queue is added only when it is needed to print something and there is no need to use memory, CPU cycles, etc for printers that are only created just in case the user wants to print.

Having cups-browsed running leads to its controlling automatic queue creation instead. By default cups-browsed will use the same destination name as the CUPS temporary queue creation mechanism does (LocalQueueNamingRemoteCUPS DNS-SD in cups-browsed.conf). This allows it to overwrite a temporary queue and set up a local queue with the same name.

Qt applications and libreoffice use the CUPS temporary queue facility to form their print dialogs. lp and lpr can also use it. First discover local and remote queues and printers (note that lpstat -a shows only local queues):

lpstat -e

Then print to a chosen one:

lp -d <printer_or_print_queue>

Printing and GTK Applications

The sections on cups-browsed and temporary queues might give the impression that remote printers and print queues cannot be discovered, and printing cannot take place from Debian 8, 9 and 10 clients, without either of them. This is not quite the case; it all depends on what you are printing from. Nevertheless, it is worth highlighting that

  • cups-browsed promotes printing from all applications and from the command line.
  • Temporary queue formation is a central feature in the Qt and LibreOffice print dialogs.

Firefox, Evince and gedit (to name but three applications) use the GTK print dialog as a printing subsystem. The subsystem gets remote print queue and printer information directly from Avahi and the queues appear in the print dialogs of those applications. cups-browsed and temporary queues aren't needed and neither for that matter is CUPS. This means that printers and print queues get broadcasted via Bonjour and an application's GTK print dialog browses the Bonjour broadcasts to add available remote printers and queues to its list.

Displaying and printing to a queue advertised by a remote CUPS server should present no difficulty. However, although the GTK print dialog can detect an IPP printer, it would appear not to support printing to it.

Printing Without a Local CUPS Server

Print queue availability by browsing the Bonjour broadcasts from a server is a dynamic process. Queues will come and go as they are enabled and disabled or as a client is moved from network to network. In a world which more and more has a focus on mobile devices there are benefits to be gained from avahi-daemon and cups-browsed or from a print dialog which implements Avahi discovery itself.

However, it is possible a static configuration is entirely suitable for some purposes. In other words, no avahi-daemon, no cups-browsed and no cupsd running on a machine and instead connecting directly to a designated server. The first step is to read this manual. Then

apt-get install cups-client

followed by making the directory ~/.cups and putting a file client.conf in it.

mkdir ~/.cups
touch ~/.cups/client.conf

The content of client.conf could be as simple as

ServerName 192.168.7.20

The local queue is eliminated and print jobs from all applications and the command line go straight to ServerName for processing. There is the bother of changing ServerName when moving from network to network but this may be balanced by not having to run three daemons,

Even a client.conf may be dispensed with if the only printing to take place is from the command line. At its simplest:

lp -h <server_IP_or_hostname> -d <print_queue_on_server> <print_job?

Configuration Files for the Scheduler, cupsd

These are located in /etc/cups as cupsd.conf and cups-files.conf. The existence of two files arises from a Debian bug report which lead to the fixing of a privilege escalation from lpadmin to root on systems with all options contained in cupsd.conf, as they were at that time.

cups-files is editable only by root. cupsd.conf can be edited by root and, from the web interface only, by a user who is a member of the lpadmin group. After editing either file cupsd has to be restarted:

service cups restart

It can be very convenient to change some of the cupsd.conf settings with cupsctl (as root only). The current settings displayed by

cupsctl

might be

_debug_logging=0
_remote_admin=0
_remote_any=0
_share_printers=0
_user_cancel_any=0
BrowseLocalProtocols=dnssd
DefaultAuthType=Basic
JobPrivateAccess=default
JobPrivateValues=default
MaxLogSize=0
SubscriptionPrivateAccess=default
SubscriptionPrivateValues=default
WebInterface=Yes

Change a displayed setting with

cupsctl Webinterface=no

and, for a setting which is not displayed:

cupsctl SystemdIdleExit=Off

More than one line in cupsd.conf can be changed with some commands and cupsd is restarted when cupsctl is used. cups-files cannot be altered with cupsctl.

See Also


CategoryPrinter