Difference between revisions of "CUPS"

From ArchWiki
Jump to navigation Jump to search
m (Configuration: add link to the man pages for cupsd.conf and cups-files.conf)
(cups-browsed: flag section with Template:Out of date, cups-browsed is used to broadcast/browse printers over the legacy CUPS protocol and to browse printers on an LDAP server; DNS-SD is handled by cupsd itself)
 
(52 intermediate revisions by 14 users not shown)
Line 1: Line 1:
 
[[Category:Printers]]
 
[[Category:Printers]]
 +
[[Category:Servers]]
 
[[cs:CUPS]]
 
[[cs:CUPS]]
 
[[de:CUPS]]
 
[[de:CUPS]]
Line 9: Line 10:
 
[[ru:CUPS]]
 
[[ru:CUPS]]
 
[[th:CUPS]]
 
[[th:CUPS]]
[[tr:CUPS]]
 
 
[[zh-hans:CUPS]]
 
[[zh-hans:CUPS]]
 
[[zh-hant:CUPS]]
 
[[zh-hant:CUPS]]
Line 20: Line 20:
 
{{Related articles end}}
 
{{Related articles end}}
  
[http://www.cups.org/ CUPS] is the standards-based, open source printing system developed by Apple Inc. for macOS® and other UNIX®-like operating systems.
+
[https://www.cups.org/ CUPS] is the standards-based, open source printing system developed by Apple Inc. for macOS® and other UNIX®-like operating systems.
  
 
== Installation ==
 
== Installation ==
Line 26: Line 26:
 
[[Install]] the {{Pkg|cups}} package.
 
[[Install]] the {{Pkg|cups}} package.
  
For GTK3 printing support, see [[Gtk#Printers not shown in the GTK print dialog]].
+
If you intend to "print" into a PDF document, also install the {{pkg|cups-pdf}} package. By default, pdf files are stored in {{ic|/var/spool/cups-pdf/''username''/}}. The location can be changed in {{ic|/etc/cups/cups-pdf.conf}}.
  
If you intend to "print" into a PDF document, also install the {{pkg|cups-pdf}} package. By default, pdf files are stored in {{ic|/var/spool/cups-pdf/$USER}}. The location can be changed in {{ic|/etc/cups/cups-pdf.conf}}.
+
[[Enable]] and [[start]] {{ic|org.cups.cupsd.service}}.
 +
 
 +
=== Socket activation ===
 +
 
 +
{{Pkg|cups}} provides a {{ic|org.cups.cupsd.socket}} unit. If {{ic|org.cups.cupsd.socket}} is [[enable]]d (and {{ic|org.cups.cupsd.service}} is [[disable]]d), systemd will not start CUPS immediately, it will just listen to the appropriate sockets. Then, whenever a program attempts to connect to one of these CUPS sockets, systemd will start {{ic|org.cups.cupsd.service}} and transparently hand over control of these ports to the CUPS process.
  
[[Enable]] and [[start]] {{ic|org.cups.cupsd.service}}.
+
This way, CUPS is only started once a program wants to make use of the service.
  
 
== Connection Interfaces ==
 
== Connection Interfaces ==
 +
 
Additional steps for printer detection are listed below for various connection interfaces.
 
Additional steps for printer detection are listed below for various connection interfaces.
  
{{Note|CUPS helper programs are run using the {{ic|lp}} group and {{ic|daemon}} user. This allows the helper programs to access printer devices '''and''' read config files in {{ic|/etc/cups/}}, which all belong to the {{ic|lp}} group. This default may conflict with non-printer parallel port device access:
+
{{Note|1=<nowiki></nowiki>
* Adding extra users to the {{ic|lp}} group will allow those users to read CUPS files, and
+
* CUPS helper programs are run using the {{ic|cups}} user and group. This allows the helper programs to access printer devices and read config files in {{ic|/etc/cups/}}, which are owned by the {{ic|cups}} group.
* CUPS helpers may gain access to any non-printer parallel port devices.
+
* Prior to {{Pkg|cups}} 2.2.6-2, the {{ic|lp}} group [https://git.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/cups&id=a209bf21797a239c7ddb4614f0266ba1e5238622 was used instead]. After the upgrade, the files in {{ic|/etc/cups}} should be owned by the {{ic|cups}} group and {{ic|User 209}} and {{ic|Group 209}} set in {{ic|/etc/cups/cups-files.conf}}.
If this is a concern, consider using a [[Udev]] rule to assign a different group for any non-printer parallel port device ({{Bug|50009}}). The group and user that CUPS uses can be changed, but the permissions of some files may need to be manually fixed.}}
+
}}
  
 
=== USB ===
 
=== USB ===
 +
 
To see if your USB printer is detected:
 
To see if your USB printer is detected:
 +
 
{{hc|$ lsusb|
 
{{hc|$ lsusb|
 
(...)
 
(...)
Line 48: Line 55:
  
 
=== Parallel port ===
 
=== Parallel port ===
 +
 
To use a parallel port printer, the {{ic|lp}}, {{ic|parport}} and {{ic|parport_pc}} [[kernel modules]] are required.
 
To use a parallel port printer, the {{ic|lp}}, {{ic|parport}} and {{ic|parport_pc}} [[kernel modules]] are required.
  
Line 56: Line 64:
  
 
=== Network ===
 
=== Network ===
[[Avahi]] can be used to scan for printers on the local network. To use [[Avahi]] hostnames to connect to networked printers, set up [[Avahi#Hostname_resolution|.local hostname resolution]] and [[restart]] {{ic|org.cups.cupsd.service}}.
 
  
If the system is connected to a networked printer using the [[Samba]] protocol, or if the system is to be a print server for Windows clients, install the {{Pkg|samba}} package.
+
To discover or share printers using DNS-SD/mDNS, setup [[Avahi#Hostname_resolution|.local hostname resolution]] with [[Avahi]] and [[restart]] {{ic|org.cups.cupsd.service}}.
 +
 
 +
{{Note|DNS-SD is only supported when using [[Avahi]]. CUPS does not support using [[systemd-resolved]] for DNS-SD, see [https://github.com/apple/cups/issues/5452 CUPS issue 5452].}}
 +
 
 +
To share printers with [[Samba]], e.g. if the system is to be a print server for Windows clients, the {{Pkg|samba}} package will be required.
  
 
== Printer Drivers ==
 
== Printer Drivers ==
 +
 
The drivers for a printer may come from any of the sources shown below. See [[CUPS/Printer-specific problems]] for an incomplete list of drivers that others have managed to get working.
 
The drivers for a printer may come from any of the sources shown below. See [[CUPS/Printer-specific problems]] for an incomplete list of drivers that others have managed to get working.
  
Line 71: Line 83:
  
 
=== CUPS ===
 
=== CUPS ===
CUPS provides a few PPDs and filter binaries by default, which should work out of the box. CUPS also provides support for [[wikipedia:AirPrint|AirPrint]] and [http://www.pwg.org/ipp/everywhere.html IPP Everywhere] printers.
+
 
 +
CUPS includes support for [[wikipedia:AirPrint|AirPrint]] and [http://www.pwg.org/ipp/everywhere.html IPP Everywhere] printers.
 +
 
 +
=== OpenPrinting CUPS filters ===
 +
 
 +
The Linux Foundation's OpenPrinting workgroup provides [https://wiki.linuxfoundation.org/openprinting/cups-filters cups-filters]. Those are backends, filters, and other binaries that were once part of CUPS but are no longer maintained by Apple. They are available in the {{Pkg|cups-filters}} package that is a dependency of {{Pkg|cups}}.
 +
 
 +
Non-PostScript printers require {{pkg|ghostscript}} to be installed. For {{pkg|ghostscript}}, {{pkg|gsfonts}} may also be required.
  
 
=== Foomatic ===
 
=== Foomatic ===
The [https://wiki.linuxfoundation.org/openprinting/database/foomatic foomatic] project provides PPDs for many printer drivers, both free and nonfree. For more information about what foomatic does, see [http://www.openprinting.org/download/kpfeifle/LinuxKongress2002/Tutorial/IV.Foomatic-Developer/IV.tutorial-handout-foomatic-development.html Foomatic from the Developer's View].
 
  
To use foomatic, install {{pkg|foomatic-db-engine}}, and at least one of {{pkg|foomatic-db}}, {{pkg|foomatic-db-ppds}}, {{pkg|foomatic-db-nonfree-ppds}}, or {{pkg|foomatic-db-gutenprint-ppds}}.
+
The Linux Foundation's OpenPrinting workgroup's [https://wiki.linuxfoundation.org/openprinting/database/foomatic foomatic] provides PPDs for many printer drivers, both free and nonfree. For more information about what foomatic does, see [http://www.openprinting.org/download/kpfeifle/LinuxKongress2002/Tutorial/IV.Foomatic-Developer/IV.tutorial-handout-foomatic-development.html Foomatic from the Developer's View].
 +
 
 +
To use foomatic, install {{pkg|foomatic-db-engine}} and at least one of:
 +
 
 +
* {{pkg|foomatic-db}} - a collection of XML files used by foomatic-db-engine to generate PPD files.
 +
* {{pkg|foomatic-db-ppds}} - prebuilt PPD files.
 +
* {{Pkg|foomatic-db-nonfree}} - a collection of XML files from printer manufacturers under non-free licenses used by foomatic-db-engine to generate PPD files.
 +
* {{pkg|foomatic-db-nonfree-ppds}} - prebuilt PPD files under non-free licenses.
 +
 
 +
The foomatic PPDs may require additional filters, such as {{aur|min12xxw}}.
 +
 
 +
=== Gutenprint ===
 +
 
 +
The [http://gimp-print.sourceforge.net/ Gutenprint project] provides drivers for Canon, Epson, Lexmark, Sony, Olympus, and PCL printers for use with CUPS and [[GIMP]].
 +
 
 +
Install {{Pkg|gutenprint}} and {{Pkg|foomatic-db-gutenprint-ppds}}.
  
The foomatic PPDs may require additional filters, such as {{pkg|gutenprint}}, {{pkg|ghostscript}}, or another source (for instance {{aur|min12xxw}}).
+
{{Note|When the Gutenprint packages get updated, the printers using Gutenprint drivers will stop working until you run {{ic|cups-genppdupdate}} as root and restart CUPS. ''cups-genppdupdate'' will update the PPD files of the configured printers, see {{man|8|cups-genppdupdate}} for more details.}}
For {{pkg|ghostscript}}, {{pkg|gsfonts}} may also be required.
 
  
 
=== Manufacturer-specific drivers ===
 
=== Manufacturer-specific drivers ===
 +
 
Many printer manufacturers supply their own Linux drivers. These are often available in the official Arch repositories or in the [[AUR]].
 
Many printer manufacturers supply their own Linux drivers. These are often available in the official Arch repositories or in the [[AUR]].
  
Line 88: Line 121:
 
== Printer URI ==
 
== Printer URI ==
  
Listed below are additional steps to manually generate the URI if required.
+
Listed below are additional steps to manually generate the URI if required. Some printers or drivers may need a special URI as described in [[CUPS/Printer-specific problems]].
  
 
=== USB ===
 
=== USB ===
Line 94: Line 127:
 
CUPS should be able to automatically generate a URI for USB printers, for example {{ic|1=usb://HP/DESKJET%20940C?serial=CN16E6C364BH}}.
 
CUPS should be able to automatically generate a URI for USB printers, for example {{ic|1=usb://HP/DESKJET%20940C?serial=CN16E6C364BH}}.
  
If it doesn't, see [[CUPS/Troubleshooting#USB printers]] for troubleshooting steps.
+
If it does not, see [[CUPS/Troubleshooting#USB printers]] for troubleshooting steps.
  
 
=== Parallel port ===
 
=== Parallel port ===
Line 107: Line 140:
 
The URI can also be generated manually, without using [[Avahi]].
 
The URI can also be generated manually, without using [[Avahi]].
 
A list of the available URI schemes for networked printers is available in the [https://www.cups.org/doc/network.html#PROTOCOLS CUPS documentation]. As exact details of the URIs differ between printers, check either the manual of the printer or [[CUPS/Printer-specific problems]].
 
A list of the available URI schemes for networked printers is available in the [https://www.cups.org/doc/network.html#PROTOCOLS CUPS documentation]. As exact details of the URIs differ between printers, check either the manual of the printer or [[CUPS/Printer-specific problems]].
 +
 +
The URI for printers on [[SMB]] shares is described in the {{man|8|smbspool}} man page.
  
 
Remote CUPS print servers can be accessed through a URI of the form {{ic|ipp://''hostname'':631/printers/''queue_name''}}. See [[CUPS/Printer sharing#Between GNU/Linux systems]] for details on setting up the remote print server.
 
Remote CUPS print servers can be accessed through a URI of the form {{ic|ipp://''hostname'':631/printers/''queue_name''}}. See [[CUPS/Printer sharing#Between GNU/Linux systems]] for details on setting up the remote print server.
Line 128: Line 163:
  
 
{{Note|Command-line switches cannot be grouped}}
 
{{Note|Command-line switches cannot be grouped}}
 +
 +
{{Style|Nonstandard use of definition lists, comments in command line.}}
  
 
;List the devices
 
;List the devices
  # lpinfo -v #
+
  # lpinfo -v
  $ /usr/lib/cups/backend/snmp ''ip_address'' # Use SNMP to find a URI
+
  $ /usr/lib/cups/backend/snmp ''ip_address'' # Use SNMP to find a URI
  
 
;List the models
 
;List the models
Line 213: Line 250:
 
If your user does not have sufficient privileges to administer CUPS, the applications will request the root password when they start. To give users administrative privileges without needing root access, see [[#Configuration]].
 
If your user does not have sufficient privileges to administer CUPS, the applications will request the root password when they start. To give users administrative privileges without needing root access, see [[#Configuration]].
  
* {{App|print-manager|A tool for managing print jobs and printers ([[KDE]]).|https://projects.kde.org/projects/kde/kdeutils/print-manager|{{Pkg|print-manager}}}}
+
* {{App|GtkLP|GTK+ interface for CUPS.|https://gtklp.sirtobi.com/index.shtml|{{AUR|gtklp}}}}
* {{App|system-config-printer|A CUPS printer configuration tool and status applet ([[GNOME]] and others)|http://cyberelk.net/tim/software/system-config-printer/|{{Pkg|system-config-printer}}}}
+
* {{App|print-manager|Tool for managing print jobs and printers ([[KDE]]).|https://cgit.kde.org/print-manager.git|{{Pkg|print-manager}}}}
* {{App|gtklp|GTK+ interface to CUPS.|http://gtklp.sirtobi.com/index.shtml|{{AUR|gtklp}}}}
+
* {{App|system-config-printer|GTK+ printer configuration tool and status applet.|http://cyberelk.net/tim/software/system-config-printer/|{{Pkg|system-config-printer}}}}
  
 
== Configuration ==
 
== Configuration ==
Line 221: Line 258:
 
The CUPS server configuration is located in {{ic|/etc/cups/cupsd.conf}} and {{ic|/etc/cups/cups-files.conf}} (see {{man|5|cupsd.conf}} and {{man|5|cups-files.conf}}). After editing either file, [[restart]] {{ic|org.cups.cupsd.service}} to apply any changes. The default configuration is sufficient for most users.
 
The CUPS server configuration is located in {{ic|/etc/cups/cupsd.conf}} and {{ic|/etc/cups/cups-files.conf}} (see {{man|5|cupsd.conf}} and {{man|5|cups-files.conf}}). After editing either file, [[restart]] {{ic|org.cups.cupsd.service}} to apply any changes. The default configuration is sufficient for most users.
  
[[Groups]] with printer administration privileges are defined in {{ic|SystemGroup}} in the {{ic|/etc/cups/cups-files.conf}}. The {{ic|sys}} group is used by default.
+
[[User group]]s with printer administration privileges are defined in {{ic|SystemGroup}} in the {{ic|/etc/cups/cups-files.conf}}. The {{ic|sys}} and {{ic|root}} [[groups]] are used by default.
  
 
{{pkg|cups}} is built with {{pkg|libpaper}} support and libpaper defaults to the '''Letter''' paper size. To avoid having to change the paper size for each print queue you add, edit {{ic|/etc/papersize}} and set your system default paper size. See {{man|5|papersize}}.
 
{{pkg|cups}} is built with {{pkg|libpaper}} support and libpaper defaults to the '''Letter''' paper size. To avoid having to change the paper size for each print queue you add, edit {{ic|/etc/papersize}} and set your system default paper size. See {{man|5|papersize}}.
Line 228: Line 265:
  
 
=== cups-browsed ===
 
=== cups-browsed ===
 +
 +
{{Out of date|{{ic|cups-browsed.service}} is not required to discover printers advertised over DNS-SD, that is done by {{ic|org.cups.cupsd.service}}. The service is only required to discover printers on an LDAP server and those using the legacy CUPS protocol (CUPS servers ≤ 1.5).}}
  
 
CUPS can use [[Avahi]] browsing to discover unknown shared printers in your network. This can be useful in large setups where the server is unknown. To use this feature, set up [[Avahi#Hostname_resolution|.local hostname resolution]], and start both {{ic|avahi-daemon.service}} and {{ic|cups-browsed.service}}. Jobs are sent directly to the printer without any processing so the created queues may not work, however driverless printers such as those supporting [http://www.pwg.org/ipp/everywhere.html IPP Everywhere] or [[wikipedia:AirPrint|AirPrint]] should work out of the box.
 
CUPS can use [[Avahi]] browsing to discover unknown shared printers in your network. This can be useful in large setups where the server is unknown. To use this feature, set up [[Avahi#Hostname_resolution|.local hostname resolution]], and start both {{ic|avahi-daemon.service}} and {{ic|cups-browsed.service}}. Jobs are sent directly to the printer without any processing so the created queues may not work, however driverless printers such as those supporting [http://www.pwg.org/ipp/everywhere.html IPP Everywhere] or [[wikipedia:AirPrint|AirPrint]] should work out of the box.
{{Note|1=Searching for network printers [https://bbs.archlinux.org/viewtopic.php?pid=1720219#p1720219 may significantly increase the time it takes for your computer to boot].}}
+
 
 +
{{Note|1=<nowiki></nowiki>
 +
* Searching for network printers [https://bbs.archlinux.org/viewtopic.php?pid=1720219#p1720219 may significantly increase the time it takes for your computer to boot].
 +
* {{ic|cups-browsed.service}} is only needed to dynamically add and remove printers as they appear and disappear from a network. It is not required if you simply want to add a an DNS-SD/mDNS supporting network printer to CUPS.
 +
}}
  
 
=== Print servers and remote administration ===
 
=== Print servers and remote administration ===
Line 242: Line 285:
 
{{Note|1=You may need to install {{Pkg|cups-pk-helper}} for working this rules.}}
 
{{Note|1=You may need to install {{Pkg|cups-pk-helper}} for working this rules.}}
  
Here's an example that allows members of the wheel [[group]] to administer printers without a password:
+
Here is an example that allows members of the wheel [[user group]] to administer printers without a password:
  
 
{{hc|/etc/polkit-1/rules.d/49-allow-passwordless-printer-admin.rules|<nowiki>
 
{{hc|/etc/polkit-1/rules.d/49-allow-passwordless-printer-admin.rules|<nowiki>
Line 250: Line 293:
 
         return polkit.Result.YES;  
 
         return polkit.Result.YES;  
 
     }  
 
     }  
});</nowiki>}}
+
});
 +
</nowiki>}}
  
 
=== Without a local CUPS server ===
 
=== Without a local CUPS server ===
Line 256: Line 300:
 
CUPS can be configured to directly connect to remote printer servers instead of running a local print server. This requires [[install]]ation of the {{Pkg|libcups}} package. Some applications will still require the {{Pkg|cups}} package for printing.
 
CUPS can be configured to directly connect to remote printer servers instead of running a local print server. This requires [[install]]ation of the {{Pkg|libcups}} package. Some applications will still require the {{Pkg|cups}} package for printing.
  
{{Warning|Accessing remote printers without a local CUPS server is not recommended by the developers. [http://www.cups.org/pipermail/cups/2015-October/027229.html]}}
+
{{Warning|Accessing remote printers without a local CUPS server is not recommended by the developers. [https://lists.cups.org/pipermail/cups/2015-October/027229.html]}}
  
 
To use a remote CUPS server, set the {{ic|CUPS_SERVER}} [[environment variable]] to {{ic|printerserver.mydomain:port}}. For instance, if you want to use a different print server for a single [[Firefox]] instance (substitute {{ic|printserver.mydomain:port}} with your print server name/port):
 
To use a remote CUPS server, set the {{ic|CUPS_SERVER}} [[environment variable]] to {{ic|printerserver.mydomain:port}}. For instance, if you want to use a different print server for a single [[Firefox]] instance (substitute {{ic|printserver.mydomain:port}} with your print server name/port):
Line 276: Line 320:
 
* [[debian:Printing|Debian's Printing portal - detailed technical guides]]
 
* [[debian:Printing|Debian's Printing portal - detailed technical guides]]
 
* [[debian:SystemPrinting|Debian's printing overview - a basic view of the CUPS printing system]]
 
* [[debian:SystemPrinting|Debian's printing overview - a basic view of the CUPS printing system]]
* [https://www.cups.org/doc/man-cupsd.conf.html man cupsd.conf(5)]
 

Latest revision as of 08:29, 27 March 2019

CUPS is the standards-based, open source printing system developed by Apple Inc. for macOS® and other UNIX®-like operating systems.

Installation

Install the cups package.

If you intend to "print" into a PDF document, also install the cups-pdf package. By default, pdf files are stored in /var/spool/cups-pdf/username/. The location can be changed in /etc/cups/cups-pdf.conf.

Enable and start org.cups.cupsd.service.

Socket activation

cups provides a org.cups.cupsd.socket unit. If org.cups.cupsd.socket is enabled (and org.cups.cupsd.service is disabled), systemd will not start CUPS immediately, it will just listen to the appropriate sockets. Then, whenever a program attempts to connect to one of these CUPS sockets, systemd will start org.cups.cupsd.service and transparently hand over control of these ports to the CUPS process.

This way, CUPS is only started once a program wants to make use of the service.

Connection Interfaces

Additional steps for printer detection are listed below for various connection interfaces.

Note:
  • CUPS helper programs are run using the cups user and group. This allows the helper programs to access printer devices and read config files in /etc/cups/, which are owned by the cups group.
  • Prior to cups 2.2.6-2, the lp group was used instead. After the upgrade, the files in /etc/cups should be owned by the cups group and User 209 and Group 209 set in /etc/cups/cups-files.conf.

USB

To see if your USB printer is detected:

$ lsusb
(...)
Bus 001 Device 007: ID 03f0:1004 Hewlett-Packard DeskJet 970c/970cse

Parallel port

To use a parallel port printer, the lp, parport and parport_pc kernel modules are required.

$ dmesg | grep -i parport
 parport0: Printer, Hewlett-Packard HP LaserJet 2100 Series
 lp0: using parport0 (polling)

Network

To discover or share printers using DNS-SD/mDNS, setup .local hostname resolution with Avahi and restart org.cups.cupsd.service.

Note: DNS-SD is only supported when using Avahi. CUPS does not support using systemd-resolved for DNS-SD, see CUPS issue 5452.

To share printers with Samba, e.g. if the system is to be a print server for Windows clients, the samba package will be required.

Printer Drivers

The drivers for a printer may come from any of the sources shown below. See CUPS/Printer-specific problems for an incomplete list of drivers that others have managed to get working.

To drive a printer, CUPS needs a PPD file and, for most printers, some filters. For details on how CUPS uses PPDs and filters, see [1].

The OpenPrinting Printer List provides driver recommendations for many printers. It also supplies PPD files for each printer, but most are available through foomatic or the recommended driver package.

When a PPD file is provided to CUPS, the CUPS server will regenerate the PPD files and save them in /etc/cups/ppd/.

CUPS

CUPS includes support for AirPrint and IPP Everywhere printers.

OpenPrinting CUPS filters

The Linux Foundation's OpenPrinting workgroup provides cups-filters. Those are backends, filters, and other binaries that were once part of CUPS but are no longer maintained by Apple. They are available in the cups-filters package that is a dependency of cups.

Non-PostScript printers require ghostscript to be installed. For ghostscript, gsfonts may also be required.

Foomatic

The Linux Foundation's OpenPrinting workgroup's foomatic provides PPDs for many printer drivers, both free and nonfree. For more information about what foomatic does, see Foomatic from the Developer's View.

To use foomatic, install foomatic-db-engine and at least one of:

The foomatic PPDs may require additional filters, such as min12xxwAUR.

Gutenprint

The Gutenprint project provides drivers for Canon, Epson, Lexmark, Sony, Olympus, and PCL printers for use with CUPS and GIMP.

Install gutenprint and foomatic-db-gutenprint-ppds.

Note: When the Gutenprint packages get updated, the printers using Gutenprint drivers will stop working until you run cups-genppdupdate as root and restart CUPS. cups-genppdupdate will update the PPD files of the configured printers, see cups-genppdupdate(8) for more details.

Manufacturer-specific drivers

Many printer manufacturers supply their own Linux drivers. These are often available in the official Arch repositories or in the AUR.

Some of those drivers are described in more detail in CUPS/Printer-specific problems.

Printer URI

Listed below are additional steps to manually generate the URI if required. Some printers or drivers may need a special URI as described in CUPS/Printer-specific problems.

USB

CUPS should be able to automatically generate a URI for USB printers, for example usb://HP/DESKJET%20940C?serial=CN16E6C364BH.

If it does not, see CUPS/Troubleshooting#USB printers for troubleshooting steps.

Parallel port

The URI should be of the form parallel:device. For instance, if the printer is connected on /dev/lp0, use parallel:/dev/lp0. If you are using a USB to parallel port adapter, use parallel:/dev/usb/lp0 as the printer URI.

Network

If you have set up Avahi as in #Network, CUPS should detect the printer URI. You can also use avahi-discover to find the name of your printer and its address (for instance, BRN30055C6B4C7A.local/10.10.0.155:631).

The URI can also be generated manually, without using Avahi. A list of the available URI schemes for networked printers is available in the CUPS documentation. As exact details of the URIs differ between printers, check either the manual of the printer or CUPS/Printer-specific problems.

The URI for printers on SMB shares is described in the smbspool(8) man page.

Remote CUPS print servers can be accessed through a URI of the form ipp://hostname:631/printers/queue_name. See CUPS/Printer sharing#Between GNU/Linux systems for details on setting up the remote print server.

See CUPS/Troubleshooting#Networking issues for additional issues and solutions.

Warning: Avoid configuring both the server and the client with a printer filter - either the print queue on the client or the server should be 'raw'. This avoids sending a print job through the filters for a printer twice, which can cause problems (for instance, [2]). See #Usage for an example of setting a print queue to 'raw'.

Usage

CUPS can be fully controlled using the lp* and cups* CLI tools. Alternatively, the #Web interface or one of several #GUI applications can be used.

  • The queue name is a short but descriptive name used on the system to identify the queue. This name should not contain spaces or any special characters. For instance, a print queue corresponding to a HP LaserJet 5P could be named "hpljet5p". More than one queue can be associated with each physical printer.
  • The location is a description of the printer's physical location (for instance "bedroom", or "kitchen"). This is to aid in maintaining several printers.
  • The description is a full description of the print queue. A common use is a full printer name (like "HP LaserJet 5P").

CLI tools

See CUPS local documentation for more tips on the command-line tools.

Note: Command-line switches cannot be grouped

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements. See Help:Style for reference.Tango-edit-clear.png

Reason: Nonstandard use of definition lists, comments in command line. (Discuss in Talk:CUPS#)
List the devices
# lpinfo -v
$ /usr/lib/cups/backend/snmp ip_address  # Use SNMP to find a URI
List the models
$ lpinfo -m
Add a new queue
# lpadmin -p queue_name -E -v uri -m model

The queue_name is up to you. Examples:

# lpadmin -p HP_DESKJET_940C -E -v "usb://HP/DESKJET%20940C?serial=CN16E6C364BH" -m drv:///HP/hp-deskjet_940c.ppd.gz
# lpadmin -p AirPrint -E -v "ipp://10.0.1.25/ipp/print" -m everywhere    # Driverless queue (Apple AirPrint or IPP Everywhere)
# lpadmin -p SHARED_PRINTER -m raw    # Raw queue; no PPD or filter
# lpadmin -p Test_Printer -E -v "ipp://10.0.1.3/ipp/print" -m pxlmono.ppd    # Specifying a PPD instead of a model
Note: When specifying the PPD, use just the file name and not the full path (for instance, pxlmono.ppd instead of /usr/share/ppd/cupsfilters/pxlmono.ppd)
Set the default printer
$ lpoptions -d queue_name
Change the options
$ lpoptions -p queue_name -l # List the options
$ lpoptions -p queue_name -o option=value # Set an option

Example:

$ lpoptions -p HP_DESKJET_940C -o PageSize=A4
Check the status
$ lpstat -s
$ lpstat -p queue_name
Deactivate a printer
# cupsdisable queue_name
Activate a printer
# cupsenable queue_name
Set the printer to accept jobs
# cupsaccept queue_name
Remove a printer

First set it to reject all incoming entries:

# cupsreject queue_name

Then disable it.

# cupsdisable queue_name

Finally remove it.

# lpadmin -x queue_name
Print a file
$ lpr file
$ lpr -# 17 file            # print the file 17 times
$ echo 'Hello, world!' | lpr -p # print the result of a command. The -p switch adds a header.
Check the queue
$ lpq
$ lpq -a # on all queues
Clear the queue
# lprm   # remove last entry only
# lprm - # remove all entries

Web interface

The CUPS server can be fully administered through the web interface, available on http://localhost:631/.

Note: If an HTTPS connection to CUPS is used, it may take a very long time before the interface appears the first time it is accessed. This is because the first request triggers the generation of SSL certificates which can be a time-consuming job.

To perform administrative tasks from the web interface authentication is required. Authenticate either as root or make sure your user is member of a group with printer administration privileges, see #Configuration.

Add a queue

Go to the Administration page.

Modify existing queues

Go to the Printers page, and select a queue to modify.

Test a queue

Go to the Printers page, and select a queue.

GUI applications

If your user does not have sufficient privileges to administer CUPS, the applications will request the root password when they start. To give users administrative privileges without needing root access, see #Configuration.

  • GtkLP — GTK+ interface for CUPS.
https://gtklp.sirtobi.com/index.shtml || gtklpAUR
  • print-manager — Tool for managing print jobs and printers (KDE).
https://cgit.kde.org/print-manager.git || print-manager
  • system-config-printer — GTK+ printer configuration tool and status applet.
http://cyberelk.net/tim/software/system-config-printer/ || system-config-printer

Configuration

The CUPS server configuration is located in /etc/cups/cupsd.conf and /etc/cups/cups-files.conf (see cupsd.conf(5) and cups-files.conf(5)). After editing either file, restart org.cups.cupsd.service to apply any changes. The default configuration is sufficient for most users.

User groups with printer administration privileges are defined in SystemGroup in the /etc/cups/cups-files.conf. The sys and root groups are used by default.

cups is built with libpaper support and libpaper defaults to the Letter paper size. To avoid having to change the paper size for each print queue you add, edit /etc/papersize and set your system default paper size. See papersize(5).

By default, all logs are sent to files in /var/log/cups/. By changing the values of the AccessLog, ErrorLog, and PageLog directives in /etc/cups/cups-files.conf to syslog, CUPS can be made to log to the systemd journal instead. See the fedora wiki page for information on the original proposed change.

cups-browsed

Tango-view-refresh-red.pngThis article or section is out of date.Tango-view-refresh-red.png

Reason: cups-browsed.service is not required to discover printers advertised over DNS-SD, that is done by org.cups.cupsd.service. The service is only required to discover printers on an LDAP server and those using the legacy CUPS protocol (CUPS servers ≤ 1.5). (Discuss in Talk:CUPS#)

CUPS can use Avahi browsing to discover unknown shared printers in your network. This can be useful in large setups where the server is unknown. To use this feature, set up .local hostname resolution, and start both avahi-daemon.service and cups-browsed.service. Jobs are sent directly to the printer without any processing so the created queues may not work, however driverless printers such as those supporting IPP Everywhere or AirPrint should work out of the box.

Note:

Print servers and remote administration

See CUPS/Printer sharing and CUPS/Printer sharing#Remote administration.

Allowing admin authentication through PolicyKit

PolicyKit can be configured to allow users to configure printers using a GUI without the admin password.

Note: You may need to install cups-pk-helper for working this rules.

Here is an example that allows members of the wheel user group to administer printers without a password:

/etc/polkit-1/rules.d/49-allow-passwordless-printer-admin.rules
polkit.addRule(function(action, subject) { 
    if (action.id == "org.opensuse.cupspkhelper.mechanism.all-edit" && 
        subject.isInGroup("wheel")){ 
        return polkit.Result.YES; 
    } 
});

Without a local CUPS server

CUPS can be configured to directly connect to remote printer servers instead of running a local print server. This requires installation of the libcups package. Some applications will still require the cups package for printing.

Warning: Accessing remote printers without a local CUPS server is not recommended by the developers. [3]

To use a remote CUPS server, set the CUPS_SERVER environment variable to printerserver.mydomain:port. For instance, if you want to use a different print server for a single Firefox instance (substitute printserver.mydomain:port with your print server name/port):

$ CUPS_SERVER=printserver.mydomain:port firefox

Troubleshooting

See CUPS/Troubleshooting.

See also