CUPS

From ArchWiki
(Redirected from Samsung ML-1640)
Jump to: navigation, search

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