Difference between revisions of "CUPS"

From ArchWiki
Jump to: navigation, search
(hp-setup asks to specify the PPD file for the discovered printer)
(Remote administration: Moved to CUPS/Printer sharing, see [https://wiki.archlinux.org/index.php?title=CUPS/Printer_sharing&diff=447480&oldid=445185])
 
(455 intermediate revisions by 82 users not shown)
Line 1: Line 1:
 
[[Category:Printers]]
 
[[Category:Printers]]
 
[[cs:CUPS]]
 
[[cs:CUPS]]
 +
[[de:CUPS]]
 
[[es:CUPS]]
 
[[es:CUPS]]
 
[[fr:CUPS]]
 
[[fr:CUPS]]
 
[[it:CUPS]]
 
[[it:CUPS]]
 +
[[ja:CUPS]]
 
[[pl:CUPS]]
 
[[pl:CUPS]]
 
[[ru:CUPS]]
 
[[ru:CUPS]]
Line 10: Line 12:
 
[[zh-CN:CUPS]]
 
[[zh-CN:CUPS]]
 
[[zh-TW:CUPS]]
 
[[zh-TW:CUPS]]
{{Article summary start|Summary}}
+
{{Related articles start}}
{{Article summary text|Installing and configuring CUPS}}
+
{{Related|CUPS/Printer sharing}}
{{Article summary heading|Related}}
+
{{Related|CUPS/Printer-specific problems}}
{{Article summary wiki|CUPS printer sharing}}
+
{{Related|CUPS/Troubleshooting}}
{{Article summary wiki|CUPS printer-specific problems}}
+
{{Related|Samba}}
{{Article summary wiki|Samba}}
+
{{Related|LPRng}}
{{Article summary end}}
+
{{Related articles end}}
  
From [http://www.cups.org/index.php CUPS' site]:
+
[http://www.cups.org/ CUPS] is the standards-based, open source printing system developed by Apple Inc. for OS X® and other UNIX®-like operating systems.
:"''[[Wikipedia:CUPS|CUPS]] is the standards-based, open source printing system developed by Apple Inc. for OS® X and other UNIX®-like operating systems''".
+
  
Although there are other printing packages such as LPRNG, the Common Unix Printing System is the most popular choice because of its relative ease of use.
+
== Installation ==
  
== CUPS Linux printing workflow ==
+
[[Install]] the {{Pkg|cups}}, {{Pkg|ghostscript}}, and {{Pkg|gsfonts}} packages.
As of {{Pkg|cups}} version 1.5.3-3, Arch Linux makes use of the new full pdf-based printing workflow. For
+
further reading check [http://www.linuxfoundation.org/collaborate/workgroups/openprinting/pdfasstandardprintjobformat PDF standard printing job format] and an old [https://wiki.linuxfoundation.org/en/OpenPrinting/Database/CUPS-Filter-Chart CUPS filtering chart] for history and fun.
+
A good starting point for general Linux printing questions is [http://www.linuxfoundation.org/collaborate/workgroups/openprinting here].
+
  
There are two ways to setup a printer.
+
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, also install the {{Pkg|samba}} package.
* If there's a CUPS server running in your network and sharing a printer you only need to install the client package.
+
* If the printer is connected directly to your system or you have access to an IPP network printer then setup a local CUPS server.
+
  
== Installing the client package ==
+
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}}.
  
The package {{Pkg|libcups}} is the only required package. [[pacman|Install]] it from the [[official repositories]].
+
[[Start]] and [[enable]] {{ic|org.cups.cupsd.service}}. Optionally, 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, start {{ic|cups-browsed.service}}.
  
Then add your CUPS server's IP address or hostname into {{ic|/etc/cups/client.conf}}. That is all you need. Every application should quickly find the printer(s) shared by that CUPS server.
+
== Connection Interfaces ==
 +
Before CUPS can attempt to use a printer, it must be able to detect the printer. Additional steps for printer detection are listed below for various connection interfaces.
  
=== Optional advanced network setup ===
+
{{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:
 +
* Adding extra users to the {{ic|lp}} group will allow those users to read CUPS files, and
 +
* CUPS helpers may gain access to any non-printer parallel port devices.
 +
If this is a concern, consider using an [[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.}}
  
It is also possible to run a entire cupsd+cups-browsed instance on your client with Avahi browsing enabled to discover unknown shared printers in your network. This can be useful in large setups where the server is unknown.
+
===USB===
{{Note|This behavior did not change with cups 1.6.x - the difference is that until 1.5.x cupsd was able to do printer browsing alone and now it can only browse its own shared printers.
+
To see if your USB printer is detected:
To get the local cupsd recognise other shared printers offered by a remote cupsd server you need a running local cups-browserd (supported since cups-filters 1.0.26) instance using Avahi to discover unknown printers.  
+
{{hc|lsusb|
There is [https://bbs.archlinux.org/viewtopic.php?id=161440 good news] in April 2013 (still has to be incorporated above).}}
+
(...)
 +
Bus 001 Device 007: ID 03f0:1004 Hewlett-Packard DeskJet 970c/970cse
 +
}}
  
=== Installing CUPS a 32 bit chroot environment ===
+
===Parallel port===
 +
To use a parallel port printer, the {{ic|lp}}, {{ic|parport}} and {{ic|parport_pc}} [[kernel modules]] are required.
  
If you have a 64 bit base installation with a [[Install_bundled_32-bit_system_in_Arch64|32 bit chroot environment]], explicit installation of CUPS is not necessary in the 32 bit environment. To access installed CUPS printers from the chroot environment, one needs to bind the {{ic|/var/run/cups}} directory to the same relative location in the chroot environment. Simply create the directory in the chroot (it probably doesn't exist), mount (with {{ic|-o bind}} passed to the command}}, and printers should be available from 32 bit chroot applications immediately.
+
{{hc|dmesg {{!}} grep -i print|
 +
parport0: Printer, Hewlett-Packard HP LaserJet 2100 Series
 +
lp0: using parport0 (polling)
 +
}}
  
{{bc|# mkdir /path/to/chroot/var/run/cups
+
If you are using a USB to parallel port adapter, add the printer using a different connection type and then change DeviceID in {{ic|/etc/cups/printers.conf}}:
# Example: # mkdir /opt/arch32/var/run/cups
+
  
# mount -o bind /var/run/cups /path/to/chroot/var/run/cups}}
+
DeviceID = parallel:/dev/usb/lp0
  
== Installing the server packages ==
+
===Local Network===
  
The following packages and some printer drivers are needed. [[pacman|Install]] them from the [[official repositories]].
+
Newer versions of CUPS tend to be good at detecting printers, and tend to pick the right hostname, but unless you have added the printer to your /etc/hosts, CUPS will fail to resolve for normal printer activities. Unless you want to make your printer ip static, Avahi can help autoresolve your printer hostname. Set up [[Avahi]] and [[Avahi#Hostname_resolution|.local hostname resolution]] then restart CUPS by [[restart]]ing the {{ic|org.cups.cupsd.service}} systemd unit.
  
* {{Pkg|cups}} - the actual CUPS daemon
+
You can use {{ic|avahi-discover}} find the name of your printer and its address (ex. Address: BRN30055C6B4C7A.local/10.10.0.155:631) or just add .local to the hostname CUPS was using (ex. BRN30055C6B4C7A.local). Double check that everything is working with ping:
* {{Pkg|cups-filters}} - essential filters
+
* {{Pkg|ghostscript}} - (optional) PostScript interpreter
+
* {{Pkg|gsfonts}} - GhostScript standard Type1 fonts
+
  
If you want to enable printer browsing through your network, also install {{Pkg|avahi}}. Make sure '''avahi-daemon''' is started before '''cupsd'''.
+
ping XXXXXX.local
  
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, also install {{Pkg|samba}}.
+
should work, if it doesn't go back and make sure that Avahi is running and that you have the right hostname. After this, make sure that the hostname in the CUPS web interface is the .local hostname.
  
=== Printer driver ===
+
== Printer Drivers ==
 +
The drivers for a printer may come from any of the sources shown below. See [[CUPS/Printer-specific problems]] for a non-comprehensive list of drivers that others have gotten to work.
  
Here are some of the driver packages. Choosing the right driver depends on the printer:
+
Usually CUPS requires either a prebuilt PPD file including the driver or some XML data files + a PPD file generating engine to work. Even when a PPD file is provided to CUPS, the CUPS server will install its own regenerated PPD file into {{ic|/etc/cups/ppd/}}
  
* '''{{Pkg|gutenprint}}''' - A collection of high quality drivers for Canon, Epson, Lexmark, Sony, Olympus, and PCL printers for use with GhostScript, CUPS, Foomatic, and the [[GIMP]]
+
=== CUPS Native Drivers ===
* '''{{Pkg|foomatic-db}}, {{Pkg|foomatic-db-engine}}, {{Pkg|foomatic-db-nonfree}}, and {{Pkg|foomatic-filters}}''' - Foomatic is a database-driven system for integrating free software printer drivers with common spoolers under Unix. Installing foomatic-filters should solve problems if the cups error_log is reporting "stopped with status 22!".
+
CUPS already includes a few printer drivers. In that case you can just select it in the list and your printer will likely work.
* '''{{Pkg|hplip}}''' - HP drivers for DeskJet, OfficeJet, Photosmart, Business Inkjet and some LaserJet printer models, as well as a number of Brother printers.
+
* '''{{Pkg|splix}}''' - Samsung drivers for SPL (Samsung Printer Language) printers.
+
  
* '''{{AUR|foo2zjs}}''' - Drivers for ZjStream protocol printers such as the HP Laserjet 1018. More info [http://foo2zjs.rkkda.com here]. Package is available in the [[AUR]].
+
=== Foomatic ===
* '''{{AUR|hpoj}}''' - If you are using an HP Officejet, you should also install this package and follow the instructions to avoid problems as in [https://answers.launchpad.net/hplip/+question/133425 this thread]. Package is available in the [[AUR]].
+
* '''{{AUR|samsung-unified-driver}}''' - Unified Linux Driver for Samsung printers and scanners. Required for new printers such as the ML-2160. Package is available in the [[AUR]].
+
* '''{{AUR|ufr2}}''' or '''{{AUR|cndrvcups-lb}}''' - Canon UFR2 driver with support for LBP, iR and MF series printers. Package is available in the [[AUR]].
+
  
* '''{{Pkg|cups-pdf}}''' - A package that allows one to setup a virtual PDF Printer that generates a PDF out of jobs sent to it
+
{{Pkg|foomatic-db-engine}} + {{Pkg|foomatic-db}} or {{Pkg|foomatic-db-nonfree}} are database-driven systems for integrating software printer drivers with common spoolers under Unix.
  
If you are not sure of what driver package to install or if the current driver is not working, it may be easiest to just install all of the drivers. Some of the package names are misleading because printers of other makes may rely on them. For example, the Brother HL-2140 needs the hplip driver installed.
+
{{Pkg|foomatic-db-ppds}} or {{Pkg|foomatic-db-nonfree-ppds}} provide prebuilt PPD files from manufacturers.
  
==== Download printer PPD ====
+
Note that foomatic only provides PPDs, not driver binaries. It can drive some printers using {{pkg|ghostscript}}, but other printers may need alternative drivers such as {{aur|min12xxw}}.
  
Depending on the printer, this step is optional and may not be needed, as the standard CUPS installation already comes with quite a few PPD (Postscript Printer Description) files. Moreover, the ''foomatic-filters'', ''gimp-print'' and ''hplip'' packages already include quite a few PPD files which will automatically be detected by CUPS.
+
=== Gutenprint ===
  
Here is an explanation of what a PPD file is from the Linux Printing website:
+
The {{Pkg|gutenprint}}, {{Pkg|foomatic-db-gutenprint}}, {{Pkg|foomatic-db-gutenprint-ppds}} drivers are high-quality, open source printer drivers for various Canon, Epson, HP, Lexmark, Sony, Olympus and PCL printers supporting CUPS. They also support ghostscript, The GIMP, and other applications.
:"''For every PostScript printer the manufacturers provide a PPD file which contains all printer-specific information about the particular printer model: Basic printer capabilities as whether the printer is a color printer, fonts, PostScript level, etc., and especially the user-adjustable options, as paper size, resolution, etc.''"
+
  
If the PPD for the printer is ''not'' already in CUPS, then:
+
=== OpenPrinting.org ===
*check [[AUR]] to see if there are packages for the printer/manufacturer
+
There might be a PPD available at the [http://www.openprinting.org/printers OpenPrinting Printer List]. Usually these driver files are included in the above foomatic packages. But searching for your printer model might help you decide which driver to chose from the list.
*visit the [http://www.openprinting.org/printers OpenPrinting database] and select the manufacturer and model of the printer
+
*visit the manufacturer's site and search for GNU/Linux drivers
+
  
{{Note|PPD files go in {{ic|/usr/share/cups/model/}}}}
+
Select the brand and type/model of the printer to find out what driver the site recommends. Download the PPD file from the site. When the CUPS web interface asks for a printer driver/PPD, select "Or Provide a PPD File: Choose file".
  
==== Another source for printer drivers ====
+
The website will also suggest a driver. For instance, for the HP LaserJet 5P, the site recommends the {{ic|ljet4}} driver. It is possible that this driver is already included with CUPS, otherwise you will need to install it through another source listed in this section.
  
[http://www.turboprint.de/english.html Turboprint] is a proprietary driver for many printers not yet supported by GNU/Linux (Canon i*, for example). Unlike CUPS, however, high quality prints are either marked with a watermark or are a pay-only service.
+
=== Manufacturer-specific drivers ===
  
== Hardware support and configuration ==
+
Many printer manufacturers supply their own Linux drivers. These are often available in the official Arch repositories or in the [[AUR]].
  
=== USB printers ===
+
Some of those drivers are described in more detail in [[CUPS/Printer-specific problems]].
  
{{Tip|Most USB printers should work out of the box, you can skip this section and come back if you can not get your printer to work.}}
+
== Print Queues ==
  
USB printers can get accessed with two methods: The usblp kernel module and libusb. The former is the classic way. It is simple: data is sent to the printer by writing it to a device file as a simple serial data stream. Reading the same device file allows bi-di access, at least for things like reading out ink levels, status, or printer capability information (PJL). It works very well for simple printers, but for multi-function devices (printer/scanner) it is not suitable and manufacturers like HP supply their own backends. Source: [http://lists.linuxfoundation.org/pipermail/printing-architecture/2012/002412.html here].
+
{{Merge|CUPS#Usage|This could be merged into the Usage section (web interface?), or at least the interface-specific information could be trimmed}}
  
==== Blacklisting usblp ====
+
{{Style}}
  
{{Warning|As of {{Pkg|cups}} version 1.6.0, you no longer need to [[Kernel modules#Blacklisting|blacklist]] the {{ic|usblp}} kernel module.
+
To have the printer installed on the system, fire up a browser and point it to [http://localhost:631 http://localhost:631]. The CUPS web interface should be displayed from which all administrative tasks can be performed.  
  
If you find out this is the only way to fix a remaining issue please report this upstream to the CUPS bug tracker and maybe also get in contact with Till Kamppeter (Debian CUPS maintainer). See [http://cups.org/str.php?L4128 upstream bug] for more.}}
+
{{Note|If an HTTPS connection to CUPS is used the first time the interface is accessed it ''may'' take a very long time before the page appears. This is because the first request triggers the generation of CUPS SSL certificates which can be a time-consuming job.}}
  
If you have problems getting your USB printer to work, you can try blacklisting the {{ic|usblp}} [[kernel module]]:
+
Go to Administration and enter the root login and password information your GNU/Linux system. Then, when the administrative interface has been reached, click on Add Printer. A new screen will be displayed allowing the following information to be entered:  
  
{{hc|/etc/modprobe.d/blacklistusblp.conf|
+
* The ''spooler name'', a short but descriptive name used on the system to identify the printer. This name should not contain spaces or any special characters. For instance, for the HP LaserJet 5P could be titled {{ic|hpljet5p}}.
blacklist usblp
+
* The ''location'', a description where the printer is physically located (for instance "bedroom", or "in the kitchen right next to the dish washer", etc.). This is to aid in maintaining several printers.
}}
+
* The ''description'' should contain a full description of the printer. A common use is the full printer name (like "HP LaserJet 5P").
  
Custom kernel users may need to manually load the {{ic|usbcore}} [[kernel module]] before proceeding.
+
The next screen requests the device the printer listens to.
  
Once the modules are installed, plug in the printer and check if the kernel detected it by running the following:
+
If installing a remote printer, the URL to the printer will be queried:  
# tail /var/log/messages.log
+
or
+
# dmesg
+
  
If you're using {{ic|usblp}}, the output should indicate that the printer has been detected like so:
+
* An LPD printer server requires a {{ic|lpd://hostname/queue}} syntax.
Feb 19 20:17:11 kernel: printer.c: usblp0: USB Bidirectional
+
* An HP JetDirect printer requires a {{ic|socket://hostname}} syntax.
printer dev 2 if 0 alt 0 proto 2 vid 0x04E8 pid 0x300E
+
* An IPP printer requires a {{ic|ipp://hostname/printers/printername}} or {{ic|<nowiki>http://hostname:631/printers/printername</nowiki>}} syntax.
Feb 19 20:17:11 kernel: usb.c: usblp driver claimed interface cfef3920
+
Feb 19 20:17:11 kernel: printer.c: v0.13: USB Printer Device Class driver
+
  
If you blacklisted {{ic|usblp}}, you will see something like:
+
Detection of local printers should be automatic, and the printer name should automatically be appended to the device name.
usb 3-2: new full speed USB device using uhci_hcd and address 3
+
usb 3-2: configuration #1 chosen from 1 choice
+
  
=== Parallel port printers ===
+
On the next screen, you can select the printer manufacturer along with the model type and number. Remember that you need to have downloaded/installed the correct printer driver in order to see your printer type among the others in the list. See the previous section on "Printer Drivers" to do this.
  
To use a parallel port printer, you will need to load the {{ic|lp}}, {{ic|parport}} and {{ic|parport_pc}} [[kernel modules]].
+
Once the driver is selected, CUPS will inform that the printer has been added successfully to the system. Navigate to the printer management page on the administration interface and select Configure Printer to change the printer's settings (resolution, page format, ...).
  
Check the setup by running:
+
=== Remote CUPS servers ===
# tail /var/log/messages.log
+
It should display something like this:
+
lp0: using parport0 (polling).
+
  
If you are using a USB to parallel port adapter, CUPS will not be able to detect the printer. As a workaround, add the printer using a different connection type and then change DeviceID in {{ic|/etc/cups/printers.conf}}:
+
See [[CUPS/Troubleshooting#Networking issues]] for common issues.
DeviceID = parallel:/dev/usb/lp0
+
  
=== HP Printer ===
+
{{Merge|CUPS/Printer sharing|This is specific to setups with remote CUPS servers, and so should probably be in CUPS/Printer sharing}}
  
HP printers can also be installed via HP's Linux setup tool. Install it by installing {{Pkg|hplip}} from the [[official repositories]].
+
==== Local CUPS server ====
  
To run with qt frontend:
+
Remote print servers can be accessed by adding an IPP "printer" to the local CUPS server, with a URI of {{ic|ipp://192.168.0.101:631/printers/<name-of-printer>}}.
# hp-setup -u
+
See [[CUPS/Printer sharing#Between GNU/Linux systems]] for details on setting up the remote print server.
  
To run with command line:
+
{{Note|1=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, [https://bbs.archlinux.org/viewtopic.php?pid=1589908#p1589908]).
# hp-setup -i
+
See [[#Usage]] for an example of setting a print queue to 'raw'.}}
  
PPD files are in {{ic|/usr/share/ppd/HP/}}.
+
==== Without a local CUPS server ====
  
For printers that require the proprietary HP plugin (like the Laserjet Pro P1102w), install the {{AUR|hplip-plugin}} package from [[AUR]].
+
{{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]}}
  
== Configuring ==
+
Install {{Pkg|libcups}}. To print from some applications, you will also need to install {{Pkg|cups}}.
  
Now that CUPS is installed, there are a variety of options on how to set up printing solutions. As always, the tried and true command line method is at your disposal. CUPS also embeds a full-featured web interface. Likewise, various desktop environments such as GNOME and KDE have useful programs that can help manage printers. Depending on your needs, you may choose one method or the other.
+
There are currently two methods for accessing a remote print server.
 +
The first method involves setting {{ic|CUPS_SERVER}} for each application, for instance for [[Firefox]]:
  
If you are planning on connecting to a network printer, rather than one that is directly connected to the computer, you might want to read the [[CUPS printer sharing]] page first. Printer sharing between GNU/Linux systems is quite easy and involves very little configuration, whereas sharing between a Windows and GNU/Linux host requires a little bit more effort.
+
{{bc|1=
 +
# (Substitute printserver.mydomain with your print server name)
 +
CUPS_SERVER=printserver.mydomain:port firefox
 +
}}
  
=== CUPS daemon ===
+
The second method involves editing {{ic|/etc/cups/client.conf}} and setting the {{ic|ServerName}} directive:
  
With the kernel modules installed, you can now start the '''cups''' and optionally, the '''cups-browsed''' [[daemons]].
+
{{Warning|{{ic|/etc/cups/client.conf}} is [http://www.cups.org/documentation.php/doc-2.1/man-client.conf.html deprecated]}}
  
=== Web interface and tool-kit ===
+
{{hc|/etc/cups/client.conf|
 +
# (Substitute printserver.mydomain with your print server name)
 +
ServerName printserver.mydomain
 +
}}
  
Once the daemon is running, open a browser and go to: http://localhost:631 (''The '''localhost''' string may need to be replaced with the hostname found in'' {{ic|/etc/hostname}}).
+
The remote system's default printer setting will be used by default.
  
From here, follow the various wizards to add the printer. A usual procedure is to start by clicking on ''Adding Printers and Classes'' and then ''Add Printer''.  When prompted for a username and password, log in as root. The name assigned to the printer does not matter, the same applies for 'location' and 'description'. Next, a list of devices to select from will be presented. The actual name of the printer shows up next to the label (e.g., next to ''USB Printer #1'' for USB printers). Finally, choose the appropriate drivers and the configuration is complete.
+
== Configuration ==
  
Now test the configuration by pressing the ''Maintenance'' drop-down menu then ''Print Test Page''. If it does not print and there is certainty regarding the correctness of applied settings, then the problem is most likely due to missing a proper printer driver.
+
The CUPS server configuration is located in {{ic|/etc/cups/cupsd.conf}} and {{ic|/etc/cups/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.
  
{{Tip|See: [[#Alternative CUPS interfaces]] for other other front-ends.}}
+
[[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.
{{Note|
+
* When setting up a USB printer, you should see your printer listed on ''Add Printer'' page. If you can only see a "SCSI printer" option, it probably means that CUPS has failed to recognize your printer.
+
* To enable wireless scanning on certain HP multi-function devices using the {{pkg|hplip}} package, you may need to add the printer as a Network Printer using the HTTP protocol. To determine the proper URI to use, run the {{ic|hp-makeuri}} command.}}
+
  
==== CUPS administration ====
+
{{pkg|cups}} is built with {{pkg|libpaper}} support and libpaper defaults to '''Letter''' paper size. To avoid having to change paper size for each printer you add, edit {{ic|/etc/papersize}} and set your system default paper size. See papersize(5).
  
A username and password will be required when administering the printer in the web interface, such as: adding or removing printers, stopping print tasks, etc. The default username is the one assigned in the ''sys'' group, or root. Other admin groups (e.g. lpadmin or printadmin) may be added to the {{ic|SystemGroup}} line in {{ic|/etc/cups/cups-files.conf}} (you might have to add this line). See [http://www.cups.org/articles.php?L237+T+Qprintadmin these instructions at cups.org].  You might also want to read [https://bbs.archlinux.org/viewtopic.php?id=35567 this post]. Create the group[s] ({{ic|man groupadd}}) and add the group[s] to users ({{ic|man usermod}}). cupsd must be restarted and the user must re-login for these changes to take affect.
+
=== Printer sharing ===
  
If the root account has been locked (i.e. when using sudo), it is not possible to log in the CUPS administration interface with the default username (root) and password. Follow the instructions above to add other users as cups administrators.
+
See [[CUPS/Printer sharing]].
  
==== Remote access to web interface ====
+
=== Test the printer ===
  
By default, the CUPS web interface can only be accessed by the ''localhost''; i.e. the computer that it is installed on. To remotely access the interface, make the following changes to the {{ic|/etc/cups/cupsd.conf}} file. Replace the line:
+
To verify if the printer is working correctly, go to the printer administration page, select the printer and click on Print Test Page.  
Listen localhost:631
+
with
+
Port 631
+
so that CUPS listens to incoming requests.
+
  
Three levels of access can be granted:
+
If the printer does not work, see [[CUPS/Troubleshooting]].
<Location />          #access to the server
+
<Location /admin> #access to the admin pages
+
<Location /admin/conf> #access to configuration files
+
  
To give remote hosts access to one of these levels, add an {{ic|Allow}} statement to that level's section. An {{ic|Allow}} statement can take one or more of the forms listed below:
+
== Usage ==
Allow from all
+
Allow from host.domain.com
+
Allow from *.domain.com
+
Allow from ip-address
+
Allow from ip-address/netmask
+
  
Deny statements can also be used. For example, if wanting to give all hosts on the 192.168.1.0/255.255.255.0 subnet full access, file {{ic|/etc/cups/cupsd.conf}} would include this:
+
CUPS can be fully controlled using the lp* and cups* command-line tools.
# Restrict access to the server...
+
Alternatively, several GUI applications exist.
# By default only localhost connections are possible
+
<Location />
+
    Order allow,deny
+
    Allow from localhost
+
    '''Allow from 192.168.1.0/255.255.255.0'''
+
</Location>
+
+
# Restrict access to the admin pages...
+
<Location /admin>
+
    # Encryption disabled by default
+
    #Encryption Required
+
    Order allow,deny
+
    Allow from localhost
+
    '''Allow from 192.168.1.0/255.255.255.0'''
+
</Location>
+
+
# Restrict access to configuration files...
+
<Location /admin/conf>
+
    AuthType Basic
+
    Require user @SYSTEM
+
    Order allow,deny
+
    Allow From localhost
+
    '''Allow From 192.168.1.0/255.255.255.0'''
+
</Location>
+
  
You might also need to add:
+
=== CLI tools ===
  
DefaultEncryption Never
+
See [http://localhost:631/help/options.html CUPS local documentation] for more tips on the command-line tools.
  
This should avoid the error: 426 - Upgrade Required when using the CUPS web interface from a remote machine.
+
{{Note|Command-line switches cannot be grouped}}
 
+
=== Command-line configuration ===
+
 
+
CUPS can be fully controlled from command-line with nice tools, ''i.e.'' the lp* and the cups* command families.
+
 
+
On Arch Linux, most commands support auto-completion with common shells.
+
Also note that command-line switches cannot be grouped.
+
  
 
;List the devices
 
;List the devices
Line 262: Line 207:
  
 
;Add a new printer
 
;Add a new printer
  # lpadmin -p ''printer'' -E -v ''device'' -P ''ppd''
+
  # lpadmin -p ''printer_name'' -E -v ''device'' -P ''ppd''
  
The ''printer'' is up to you. The device can be retrieved from the 'lpinfo -i' command.
+
The ''printer_name'' is up to you. The device can be retrieved from the 'lpinfo -v' command.
 
Example:
 
Example:
  # lpadmin -p HP_DESKJET_940C -E -v "usb://HP/DESKJET%20940C?serial=CN16E6C364BH" -P /usr/share/ppd/HP/hp-deskjet_940c.ppd.gz
+
  # lpadmin -p HP_DESKJET_940C -E -v "usb://HP/DESKJET%20940C?serial=CN16E6C364BH" -P /usr/share/ppd/HP/hp-deskjet_940c.ppd.gz
  
In the following, the ''printer'' references the name you have used here to set up the printer.
+
;Make the printer use the raw driver
 +
# lpadmin -p ''printer_name'' -m raw
  
 
;Set the default printer
 
;Set the default printer
  $ lpoptions -d ''printer''
+
  $ lpoptions -d ''printer_name''
  
 
;Check the status
 
;Check the status
 
  $ lpstat -s
 
  $ lpstat -s
  $ lpstat -p ''printer''
+
  $ lpstat -p ''printer_name''
  
 
;Deactivate a printer
 
;Deactivate a printer
  # cupsdisable ''printer''
+
  # cupsdisable ''printer_name''
  
 
;Activate a printer
 
;Activate a printer
  # cupsenable ''printer''
+
  # cupsenable ''printer_name''
  
 
;Remove a printer
 
;Remove a printer
 
First set it to reject all incoming entries:
 
First set it to reject all incoming entries:
  # cupsreject ''printer''
+
  # cupsreject ''printer_name''
 
Then disable it.
 
Then disable it.
  # cupsdisable ''printer''
+
  # cupsdisable ''printer_name''
 
Finally remove it.
 
Finally remove it.
  # lpadmin -x ''printer''
+
  # lpadmin -x ''printer_name''
  
 
;Print a file
 
;Print a file
 
  $ lpr ''file''
 
  $ lpr ''file''
  $ lpr -# 17 ''file''             # print the file 17 times
+
  $ 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.
 
  $ echo "Hello, world!" | lpr -p # print the result of a command. The -p switch adds a header.
  
Line 304: Line 250:
 
  # lprm - # remove all entries
 
  # lprm - # remove all entries
  
=== Alternative CUPS interfaces ===
+
=== GUI applications ===
  
==== GNOME ====
+
If your user does not have sufficient privileges to administer CUPS, the applications will request the root passwords when they start. To give users administrative privileges without needing root access, see [[#Configuration]].
  
If using [[GNOME]], a possibility is to manage and configure the printer by [[pacman|installing]] {{Pkg|system-config-printer}}.
+
* {{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|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}}}}
For system-config-printer to work as it should, running as root may be required, or alternatively set up a "normal" user to administer CUPS (if so '''follow steps 1-3''').
+
* {{App|gtklp|GTK+ interface to CUPS.|http://gtklp.sirtobi.com/index.shtml|{{AUR|gtklp}}}}
 
+
1. Create group, and add a user to it
+
# groupadd lpadmin
+
# usermod -aG lpadmin ''username''
+
 
+
2. Add {{ic|lpadmin}} to this line in {{ic|/etc/cups/cups-files.conf}}
+
SystemGroup sys root ''insert here''
+
 
+
3. Restart cups, log out and in again (or restart computer)
+
 
+
==== KDE ====
+
 
+
[[KDE]] users can modify their printers from the Control Center. Both should refer to those desktop environments' documentation for more information on how to use the interfaces.
+
 
+
==== Other ====
+
 
+
There is also {{AUR|gtklp}} in the [[AUR]].
+
 
+
== PDF virtual printer ==
+
 
+
{{Pkg|cups-pdf}} is a nice package that allows one to setup a virtual printer that will generate a PDF from anything sent to it. This package is not necessary, but it can be quite useful.
+
 
+
After installing the package, set it up as if it were for any other printer by using the web interface. Access the cups print manager: http://localhost:631 and select:
+
Administration -> Add Printer
+
Select CUPS-PDF (Virtual PDF), choose for the make and driver:
+
Make: Generic
+
Driver: Generic CUPS-PDF Printer
+
 
+
Find generated PDF documents in a sub-directory located at {{ic|/var/spool/cups-pdf}}. Normally, the subdirectory is named after the user who performed the job. A little tweak helps you to find your printed PDF documents more easily. Edit {{ic|/etc/cups/cups-pdf.conf}} by changing the line
+
#Out /var/spool/cups-pdf/${USER}
+
 
+
to
+
 
+
Out ${HOME}
+
 
+
=== Print to PostScript ===
+
 
+
The CUPS-PDF (Virtual PDF Printer) actually creates a PostScript file and then creates the PDF using the ps2pdf utility. To print to PostScript, just print as usual, in the print dialog choose "CUPS-PDF" as the printer, then select the checkbox for "print to file", hit print, enter the filename.ps and click save. This is handy for faxes, etc...
+
  
 
== Troubleshooting ==
 
== Troubleshooting ==
  
The best way to get printing working is to set 'LogLevel' in {{ic|/etc/cups/cupsd.conf}} to:
+
See [[CUPS/Troubleshooting]].
LogLevel debug
+
 
+
And then viewing the output from {{ic|/var/log/cups/error_log}} like this:
+
# tail -n 100 -f /var/log/cups/error_log
+
 
+
The characters at the left of the output stand for:
+
*D=Debug
+
*E=Error
+
*I=Information
+
*And so on
+
 
+
These files may also prove useful:
+
*{{ic|/var/log/cups/page_log}} -  Echoes a new entry each time a print is successful
+
*{{ic|/var/log/cups/access_log}} - Lists all cupsd http1.1 server activity
+
 
+
Of course, it is important to know how CUPS works if wanting to solve related issues:
+
# An application sends a .ps file (PostScript, a script language that details how the page will look) to CUPS when 'print' has been selected (this is the case with most programs).
+
# CUPS then looks at the printer's PPD file (printer description file) and figures out what filters it needs to use to convert the .ps file to a language that the printer understands (like PJL, PCL), usually GhostScript.
+
# GhostScript takes the input and figures out which filters it should use, then applies them and converts the .ps file to a format understood by the printer.
+
# Then it is sent to the back-end. For example, if the printer is connected to a USB port, it uses the USB back-end.
+
 
+
Print a document and watch {{ic|error_log}} to get a more detailed and correct image of the printing process.
+
 
+
=== Problems resulting from upgrades ===
+
 
+
''Issues that appeared after CUPS and related program packages underwent a version increment''
+
 
+
==== CUPS stops working ====
+
 
+
The chances are that a new configuration file is needed for the new version to work properly. Messages such as "404 - page not found" may result from trying to manage CUPS via localhost:631, for example.
+
 
+
To use the new configuration, copy {{ic|/etc/cups/cupsd.conf.default}} to {{ic|/etc/cups/cupsd.conf}} (backup the old configuration if needed) and restart CUPS to employ the new settings.
+
 
+
==== All jobs are "stopped" ====
+
 
+
If all jobs sent to the printer become "stopped", delete the printer and add it again.
+
Using the [http://localhost:631 CUPS web interface], go to Printers > Delete Printer.
+
 
+
To check the printer's settings go to ''Printers'', then ''Modify Printer''. Copy down the information displayed, click 'Modify Printer' to proceed to the next page(s), and so on.
+
 
+
==== All jobs are "The printer is not responding" ====
+
 
+
On networked printers, you should check that the name that CUPS uses as its connection URI resolves to the printer's IP via DNS, e.g.
+
If your printer's connection looks like this:
+
lpd://BRN_020554/BINARY_P1
+
 
+
then the hostname 'BRN_020554' needs to resolve to the printer's IP from the server running CUPS
+
 
+
==== The PPD version is not compatible with gutenprint ====
+
 
+
Run:
+
# /usr/bin/cups-genppdupdate
+
 
+
And restart CUPS (as pointed out in gutenprint's post-install message)
+
 
+
=== Other ===
+
 
+
===== CUPS permission errors =====
+
 
+
* Some users fixed 'NT_STATUS_ACCESS_DENIED' (Windows clients) errors by using a slightly different syntax:
+
smb://workgroup/username:password@hostname/printer_name
+
 
+
* Sometimes, the block device has wrong permissions:
+
# ls /dev/usb/
+
lp0
+
# chgrp lp /dev/usb/lp0
+
 
+
==== HPLIP printer sends "/usr/lib/cups/backend/hp failed" error ====
+
 
+
Make sure dbus is installed and running. If the error persists, try starting avahi-daemon.
+
 
+
Try adding the printer as a Network Printer using the http:// protocol. Generate the printer URI with {{ic|hp-makeuri}}.
+
 
+
{{Note|There might need to set permissions issues right. Follow indications here: [[CUPS#Device node permissions]].}}
+
 
+
==== HPLIP printer claims job is complete but printer does nothing ====
+
 
+
This happens on HP printers when you select the (old) hpijs driver (e.g. the Deskjet D1600 series). Instead, use the hpcups driver when adding the printer.
+
 
+
Some HP printers (e.g HP LaserJet) require their firmware to be downloaded from the computer every time the printer is switched on. If there is an issue with udev (or equivalent) and the firmware download rule is never fired, you may experience this issue.
+
As a workaround, you can manually download the firmware to the printer. Ensure the printer is plugged in and switched on, then enter
+
hp-firmware -n
+
 
+
==== hp-setup asks to specify the PPD file for the discovered printer ====
+
 
+
Install CUPS before running hp-setup.
+
 
+
==== I have installed Qt, but hp-setup reports "Qt/PyQt 4 initialization failed" ====
+
 
+
"hp-check -t" won't give you useful information to find the required package. You have to install all the "Dependent Packages" prefixed with "python2" in https://www.archlinux.org/packages/extra/x86_64/hplip/
+
 
+
==== hp-setup finds the printer automatically but reports "Unable to communicate with device" when printing test page immediately afterwards ====
+
 
+
This at least happens to hplip 3.13.5-2 for HP Officejet 6500A through local network connection. To solve the problem, specify the IP address of the HP printer for hp-setup to locate the printer.
+
 
+
==== hp-toolbox sends an error, "Unable to communicate with device" ====
+
 
+
If running hp-toolbox as a regular user results in:
+
# hp-toolbox
+
# error: Unable to communicate with device (code=12): hp:/usb/''printer id''
+
or, "{{ic|Unable to communicate with device"}}", then it may be needed to [[Groups#Group management|add the user to the lp and sys groups]].
+
 
+
This can also be caused by printers such as the P1102 that provide a virtual cd-rom drive for MS-Windows drivers. The lp dev appears and then disappears. In that case try the '''usb-modeswitch''' and '''usb-modeswitch-data''' packages, that lets one switch off the "Smart Drive" (udev rules included in said packages).
+
 
+
This can also occur with network attached printers if the [[Avahi|avahi-daemon]] is not running. Another possiblility is the specification of the printer's IP address in hp-setup fails to locate the printer because the IP address of the the printer changed due to DHCP.
+
 
+
==== CUPS returns '"foomatic-rip" not available/stopped with status 3' with a HP printer ====
+
 
+
If receiving any of the following error messages in {{ic|/var/log/cups/error_log}} while using a HP printer, with jobs appearing to be processed while they all end up not being completed with their status set to 'stopped':
+
Filter "foomatic-rip" for printer ''printer_name'' not available: No such file or director
+
or:
+
PID 5771 (/usr/lib/cups/filter/foomatic-rip) stopped with status 3!
+
make sure {{pkg|hplip}} has been [[pacman|installed]], in addition to [[#Packages|the packages mentioned above]]. See [https://bbs.archlinux.org/viewtopic.php?id=65615 this forum post] for more information.
+
 
+
==== Printing fails with unauthorised error ====
+
 
+
If the user has been added to the lp group, and allowed to print (set in {{ic|cupsd.conf}}), then the problem lies in {{ic|/etc/cups/printers.conf}}. This line could be the culprit:
+
AuthInfoRequired negotiate
+
 
+
Comment it out and restart CUPS.
+
 
+
==== Print button greyed-out in GNOME print dialogs ====
+
 
+
:''<small>Source: [https://bbs.archlinux.org/viewtopic.php?id=70418 I can't print from gnome applications. - Arch Forums]</small>''
+
 
+
Be sure the package: '''libgnomeprint''' is installed
+
 
+
Edit {{ic|/etc/cups/cupsd.conf}} and add:
+
# HostNameLookups Double
+
 
+
Restart cups.service.
+
 
+
==== Unknown supported format: application/postscript ====
+
 
+
Comment the lines:
+
application/octet-stream        application/vnd.cups-raw        0      -
+
from {{ic|/etc/cups/mime.convs}}, and:
+
application/octet-stream
+
in {{ic|/etc/cups/mime.types}}.
+
 
+
==== Finding URIs for Windows print servers ====
+
 
+
Sometimes Windows is a little less than forthcoming about exact device URIs (device locations).  If having trouble specifying the correct device location in CUPS, run the following command to list all shares available to a certain windows username:
+
$ smbtree -U ''windowsusername''
+
This will list every share available to a certain Windows username on the local area network subnet, as long as Samba is set up and running properly.  It should return something like this:
+
{{bc| WORKGROUP
+
\\REGULATOR-PC 
+
\\REGULATOR-PC\Z             
+
\\REGULATOR-PC\Public       
+
\\REGULATOR-PC\print$        Printer Drivers
+
\\REGULATOR-PC\G             
+
\\REGULATOR-PC\EPSON Stylus CX8400 Series EPSON Stylus CX8400 Series}}
+
What is needed here is first part of the last line, the resource matching the printer description.  So to print to the EPSON Stylus printer, one would enter:
+
smb://username.password@REGULATOR-PC/EPSON Stylus CX8400 Series
+
as the URI into CUPS.  Notice that whitespaces are allowed in URIs, whereas backslashes get replaced with forward slashes.
+
If it won't work try '%20' instead of spaces.
+
 
+
==== Print-Job client-error-document-format-not-supported ====
+
 
+
Try installing the foomatic packages and use a foomatic driver.
+
 
+
==== /usr/lib/cups/backend/hp failed ====
+
 
+
Change:
+
  SystemGroup sys root
+
to:
+
  SystemGroup lp root
+
in {{ic|/etc/cups/cupsd.conf}}
+
 
+
 
+
Following steps 1-3 in the Alternative CUPS interfaces below may be a better solution, since newer versions of cups will not allow the same group for both normal and admin operation.
+
 
+
==== Unable to get list of printer drivers ====
+
 
+
* Check your ServerName in /etc/cups/client.conf is written without http://
+
ServerName localhost:631
+
* Try to remove Foomatic drivers.
+
 
+
==== lp: Error - Scheduler Not Responding ====
+
 
+
If you get this error when printing a document using:
+
 
+
$ lp document-to-print
+
 
+
Try setting the CUPS_SERVER environment variable:
+
 
+
$ export CUPS_SERVER=localhost
+
 
+
If this solves your problem, make the solution permanent by adding the export line above to ~/.bash_profile.
+
 
+
==== CUPS prints only an empty and an error-message page on HP LaserJet ====
+
 
+
There is a bug that causes CUPS to fail when printing images on HP LaserJet (in my case 3380). The bug has been reported and fixed by [https://bugs.launchpad.net/ubuntu/+source/cups-filters/+bug/998087 Ubuntu].
+
The first page is empty, the second page contains the following error message:
+
  ERROR:
+
  invalidaccess
+
  OFFENDING COMMAND:
+
  filter
+
  STACK:
+
  /SubFileDecode
+
  endstream
+
  ...
+
 
+
In order to fix the issue, use the following command (as superuser):
+
  lpadmin -p ''printer'' -o pdftops-renderer-default=pdftops
+
 
+
==== "Using invalid Host" error message ====
+
 
+
Try to add "ServerAlias *" into cupsd.conf
+
 
+
==== Printer doesn't print with an "Filter failed" message on CUPS web interface (HP printer) ====
+
 
+
Change the permissions of the printer USB port:
+
 
+
Get the bus and device number from lsusb, then set the permission using:
+
 
+
chmod 0666 /dev/bus/usb/''bus number''/''device number''
+
 
+
To make the persistent permission change that will be triggered automatically each time the computer is rebooted, add the following line.
+
 
+
{{hc|/etc/udev/rules.d/10-local.rules|2=
+
SUBSYSTEM=="usb", ATTRS{idVendor}=="Printer_idVendor", ATTRS{idProduct}=="Printer_idProduct", GROUP="lp", MODE:="666"
+
}}
+
 
+
Obtain the right information by using {{ic|lsusb}} command, and don't forget to substitute {{ic|Printer_idVendor}} & {{ic|Printer_idProduct}} with the relevant ones.
+
 
+
Each system may vary, so consult [[udev#List_attributes_of_a_device]] wiki page.
+
 
+
==== Printer doesn't print with an "Filter failed" message on CUPS web interface (HP printer connected over network) ====
+
 
+
Start, enable and restart the avahi-daemon.
+
 
+
==== HPLIP 3.13: Plugin is installed, but HP Device Manager complains it is not ====
+
 
+
The issue might have to do with the file permission change that had been made to {{ic|/var/lib/hp/hplip.state}}. To correct the issue, a simple {{ic|chmod 644 /var/lib/hp/hplip.state}} and {{ic|chmod 755 /var/lib/hp}} should be sufficient. For further information, please read this [https://bugs.launchpad.net/hplip/+bug/1131596 link].
+
 
+
==== Printer is not recognized by CUPS ====
+
 
+
If your printer is not listed in the "Add Printers" page of the CUPS web interface, nor by lpinfo -v, try the following (suggested in [https://bbs.archlinux.org/viewtopic.php?pid=1037279#p1037279 this thread]):
+
 
+
* Remove {{ic|usblp}} from blacklist
+
* Load {{ic|usblp}} module
+
modprobe usblp
+
* Stop cups
+
* Add the following udev rule in a new rule file:
+
{{hc|/etc/udev/rules.d/10-cups_device_link.rules|2=
+
KERNEL=="lp[0-9]", SYMLINK+="%k", GROUP="lp"
+
}}
+
* Reload udev rules:
+
# udevadm control --reload-rules
+
* Unplug and re-plug the printer.
+
* Wait a few seconds and then start cups again.
+
 
+
==== Can't load /etc/samba/smb.conf ====
+
 
+
If you're printing to a remote printer over SMB and get this error message: "Can't load /etc/samba/smb.conf - run testparm to debug it", then create an empty smb.conf:
+
 
+
# mkdir /etc/samba
+
# touch /etc/samba/smb.conf
+
 
+
and restart cupsd.
+
 
+
==== CUPS' systemd service does not start even though it's enabled ====
+
 
+
The systemd .service file provided by CUPS uses socket activation, meaning the service is only started when an
+
application connects to CUPS' socket. However, the systemd .socket file provided by cups only works for the local
+
{{ic|/var/run/cups/cups.sock}} socket.
+
 
+
In order to have cupsd start when initiating a print job over the network, create the following file:
+
 
+
{{hc|/etc/systemd/system/cups.socket|
+
.include /usr/lib/systemd/system/cups.socket
+
 
+
[Socket]
+
ListenStream&#61;0.0.0.0:631
+
ListenDatagram&#61;0.0.0.0:631
+
BindIPv6Only&#61;ipv6-only
+
}}
+
 
+
Then reload systemd:
+
 
+
# systemctl --system daemon-reload
+
 
+
Confirm that everything is working correctly:
+
 
+
{{bc|
+
# systemctl is-enabled cups.service &#124;&#124; systemctl enable cups.service
+
# systemctl status cups.socket
+
cups.socket - CUPS Printing Service Sockets
+
        Loaded: loaded (/etc/systemd/system/cups.socket; enabled)
+
        Active: inactive (dead)
+
        Listen: /var/run/cups/cups.sock (Stream)
+
                0.0.0.0:631 (Stream)
+
                0.0.0.0:631 (Datagram)
+
}}
+
 
+
CUPS should now start automatically when printing locally or over the network.
+
  
 
== See also ==
 
== See also ==
  
* [http://localhost:631/documentation.html Official CUPS documentation], ''locally installed''
+
* [http://localhost:631/help Official CUPS documentation], ''locally installed''
* [http://www.cups.org/ Official CUPS website]
+
* [[Wikipedia:CUPS]]
* [http://www.linuxprinting.org/ Linux Printing], ''[http://www.linuxfoundation.org The Linux Foundation]''
+
* [http://www.linuxfoundation.org/collaborate/workgroups/openprinting OpenPrinting homepage]
* [http://www.gentoo.org/doc/en/printing-howto.xml Gentoo's printing guide], ''[http://www.gentoo.org/doc/en  Gentoo Documentation resources]''
+
* [https://en.opensuse.org/Concepts_printing OpenSuSE Concepts printing guide - explains the full printing workflow]
* [https://bbs.archlinux.org/ Arch Linux user forums]
+
* [https://en.opensuse.org/SDB:CUPS_in_a_Nutshell OpenSuSE CUPS in a Nutshell - a quick CUPS overwiev]
* [http://wiki.gotux.net/tutorials/software/hp-printer Install HP printers easy way]
+
* [https://wiki.gentoo.org/wiki/Printing Gentoo's printing guide]

Latest revision as of 00:59, 23 August 2016

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

Installation

Install the cups, ghostscript, and gsfonts packages.

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, also install the samba 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/$USER. The location can be changed in /etc/cups/cups-pdf.conf.

Start and enable org.cups.cupsd.service. Optionally, 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, start cups-browsed.service.

Connection Interfaces

Before CUPS can attempt to use a printer, it must be able to detect the printer. Additional steps for printer detection are listed below for various connection interfaces.

Note: CUPS helper programs are run using the lp group and daemon user. This allows the helper programs to access printer devices and read config files in /etc/cups/, which all belong to the lp group. This default may conflict with non-printer parallel port device access:
  • Adding extra users to the lp group will allow those users to read CUPS files, and
  • CUPS helpers may gain access to any non-printer parallel port devices.
If this is a concern, consider using an Udev rule to assign a different group for any non-printer parallel port device (FS#50009). The group and user that CUPS uses can be changed, but the permissions of some files may need to be manually fixed.

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 print
 parport0: Printer, Hewlett-Packard HP LaserJet 2100 Series
 lp0: using parport0 (polling)

If you are using a USB to parallel port adapter, add the printer using a different connection type and then change DeviceID in /etc/cups/printers.conf:

DeviceID = parallel:/dev/usb/lp0

Local Network

Newer versions of CUPS tend to be good at detecting printers, and tend to pick the right hostname, but unless you have added the printer to your /etc/hosts, CUPS will fail to resolve for normal printer activities. Unless you want to make your printer ip static, Avahi can help autoresolve your printer hostname. Set up Avahi and .local hostname resolution then restart CUPS by restarting the org.cups.cupsd.service systemd unit.

You can use avahi-discover find the name of your printer and its address (ex. Address: BRN30055C6B4C7A.local/10.10.0.155:631) or just add .local to the hostname CUPS was using (ex. BRN30055C6B4C7A.local). Double check that everything is working with ping:

ping XXXXXX.local

should work, if it doesn't go back and make sure that Avahi is running and that you have the right hostname. After this, make sure that the hostname in the CUPS web interface is the .local hostname.

Printer Drivers

The drivers for a printer may come from any of the sources shown below. See CUPS/Printer-specific problems for a non-comprehensive list of drivers that others have gotten to work.

Usually CUPS requires either a prebuilt PPD file including the driver or some XML data files + a PPD file generating engine to work. Even when a PPD file is provided to CUPS, the CUPS server will install its own regenerated PPD file into /etc/cups/ppd/

CUPS Native Drivers

CUPS already includes a few printer drivers. In that case you can just select it in the list and your printer will likely work.

Foomatic

foomatic-db-engine + foomatic-db or foomatic-db-nonfree are database-driven systems for integrating software printer drivers with common spoolers under Unix.

foomatic-db-ppds or foomatic-db-nonfree-ppds provide prebuilt PPD files from manufacturers.

Note that foomatic only provides PPDs, not driver binaries. It can drive some printers using ghostscript, but other printers may need alternative drivers such as min12xxwAUR.

Gutenprint

The gutenprint, foomatic-db-gutenprint, foomatic-db-gutenprint-ppds drivers are high-quality, open source printer drivers for various Canon, Epson, HP, Lexmark, Sony, Olympus and PCL printers supporting CUPS. They also support ghostscript, The GIMP, and other applications.

OpenPrinting.org

There might be a PPD available at the OpenPrinting Printer List. Usually these driver files are included in the above foomatic packages. But searching for your printer model might help you decide which driver to chose from the list.

Select the brand and type/model of the printer to find out what driver the site recommends. Download the PPD file from the site. When the CUPS web interface asks for a printer driver/PPD, select "Or Provide a PPD File: Choose file".

The website will also suggest a driver. For instance, for the HP LaserJet 5P, the site recommends the ljet4 driver. It is possible that this driver is already included with CUPS, otherwise you will need to install it through another source listed in this section.

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.

Print Queues

Merge-arrows-2.pngThis article or section is a candidate for merging with CUPS#Usage.Merge-arrows-2.png

Notes: This could be merged into the Usage section (web interface?), or at least the interface-specific information could be trimmed (Discuss in Talk:CUPS#)

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements.Tango-edit-clear.png

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in Talk:CUPS#)

To have the printer installed on the system, fire up a browser and point it to http://localhost:631. The CUPS web interface should be displayed from which all administrative tasks can be performed.

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

Go to Administration and enter the root login and password information your GNU/Linux system. Then, when the administrative interface has been reached, click on Add Printer. A new screen will be displayed allowing the following information to be entered:

  • The spooler name, a short but descriptive name used on the system to identify the printer. This name should not contain spaces or any special characters. For instance, for the HP LaserJet 5P could be titled hpljet5p.
  • The location, a description where the printer is physically located (for instance "bedroom", or "in the kitchen right next to the dish washer", etc.). This is to aid in maintaining several printers.
  • The description should contain a full description of the printer. A common use is the full printer name (like "HP LaserJet 5P").

The next screen requests the device the printer listens to.

If installing a remote printer, the URL to the printer will be queried:

  • An LPD printer server requires a lpd://hostname/queue syntax.
  • An HP JetDirect printer requires a socket://hostname syntax.
  • An IPP printer requires a ipp://hostname/printers/printername or http://hostname:631/printers/printername syntax.

Detection of local printers should be automatic, and the printer name should automatically be appended to the device name.

On the next screen, you can select the printer manufacturer along with the model type and number. Remember that you need to have downloaded/installed the correct printer driver in order to see your printer type among the others in the list. See the previous section on "Printer Drivers" to do this.

Once the driver is selected, CUPS will inform that the printer has been added successfully to the system. Navigate to the printer management page on the administration interface and select Configure Printer to change the printer's settings (resolution, page format, ...).

Remote CUPS servers

See CUPS/Troubleshooting#Networking issues for common issues.

Merge-arrows-2.pngThis article or section is a candidate for merging with CUPS/Printer sharing.Merge-arrows-2.png

Notes: This is specific to setups with remote CUPS servers, and so should probably be in CUPS/Printer sharing (Discuss in Talk:CUPS#)

Local CUPS server

Remote print servers can be accessed by adding an IPP "printer" to the local CUPS server, with a URI of ipp://192.168.0.101:631/printers/<name-of-printer>. See CUPS/Printer sharing#Between GNU/Linux systems for details on setting up the remote print server.

Note: 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, [1]). See #Usage for an example of setting a print queue to 'raw'.

Without a local CUPS server

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

Install libcups. To print from some applications, you will also need to install cups.

There are currently two methods for accessing a remote print server. The first method involves setting CUPS_SERVER for each application, for instance for Firefox:

# (Substitute printserver.mydomain with your print server name)
CUPS_SERVER=printserver.mydomain:port firefox

The second method involves editing /etc/cups/client.conf and setting the ServerName directive:

Warning: /etc/cups/client.conf is deprecated
/etc/cups/client.conf
# (Substitute printserver.mydomain with your print server name)
ServerName printserver.mydomain

The remote system's default printer setting will be used by default.

Configuration

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

Groups with printer administration privileges are defined in SystemGroup in the /etc/cups/cups-files.conf. The sys group is used by default.

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

Printer sharing

See CUPS/Printer sharing.

Test the printer

To verify if the printer is working correctly, go to the printer administration page, select the printer and click on Print Test Page.

If the printer does not work, see CUPS/Troubleshooting.

Usage

CUPS can be fully controlled using the lp* and cups* command-line tools. Alternatively, several GUI applications exist.

CLI tools

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

Note: Command-line switches cannot be grouped
List the devices
# lpinfo -v
List the drivers
# lpinfo -m
Add a new printer
# lpadmin -p printer_name -E -v device -P ppd

The printer_name is up to you. The device can be retrieved from the 'lpinfo -v' command. Example:

# lpadmin -p HP_DESKJET_940C -E -v "usb://HP/DESKJET%20940C?serial=CN16E6C364BH" -P /usr/share/ppd/HP/hp-deskjet_940c.ppd.gz
Make the printer use the raw driver
# lpadmin -p printer_name -m raw
Set the default printer
$ lpoptions -d printer_name
Check the status
$ lpstat -s
$ lpstat -p printer_name
Deactivate a printer
# cupsdisable printer_name
Activate a printer
# cupsenable printer_name
Remove a printer

First set it to reject all incoming entries:

# cupsreject printer_name

Then disable it.

# cupsdisable printer_name

Finally remove it.

# lpadmin -x printer_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 printing queue
$ lpq
$ lpq -a # on all printers
Clear the printing queue
# lprm   # remove last entry only
# lprm - # remove all entries

GUI applications

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

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

Troubleshooting

See CUPS/Troubleshooting.

See also