Difference between revisions of "CUPS (Polski)"

From ArchWiki
Jump to navigation Jump to search
Line 7: Line 7:
== Instalacja wymaganych pakietów ==
== Instalacja wymaganych pakietów ==
Na początek zainstalujmy podstawowe pakiety:
  # pacman -S cups ghostscript gsfonts
  # pacman -S cups ghostscript gsfonts
Dodajmy także <code>cups</code> do sekcji DAEMONS w {{filename|/etc/rc.conf}}.
== Instalacja sterownika drukarki ==
== Instalacja sterownika drukarki ==

Revision as of 06:01, 3 August 2010

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.

Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어

External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Tango-preferences-desktop-locale.pngThis article or section needs to be translated.Tango-preferences-desktop-locale.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:CUPS (Polski)#)

Instalacja wymaganych pakietów

Na początek zainstalujmy podstawowe pakiety:

# pacman -S cups ghostscript gsfonts

Dodajmy także cups do sekcji DAEMONS w Template:Filename.

Instalacja sterownika drukarki

Wybierz odpowiedni sterownik do swojej drukarki:

  • gutenprint - sterowniki do drukarek Canon, Epson, Lexmark, Sony, Olympus.
  • hplip - sterowki do drukarek firmy HP.
  • splix - sterowki do drukarek firmy Samsung.
  • cups-pdf - pakiet, który pozwala na konfigurację wirtualnej drukarki PDF tworzącej dokumenty o tym właśnie formacie.

W przypadku, drukarka nie pomimo zainstalowanych wymaganych pakietów,spróbuj zainstalować wszystkie sterowniki. Zdarzają się bowiem takie sytuacje, że drukarki mogą działać na innych sterownikach. Na przykład do prawidłowego działania drukarki Brother HL-2140 wymagany jest pakiet hplip.


Teraz, kiedy już masz zainstalowane podstawowe pakiety do obsługi drukarki, możesz przejść do etapu jej konfiguracji. W środowiskach graficznych, takich jak Gnome czy KDE, znajdziesz przydatne programy, które mogą pomóc w zarządzania drukarką. Jako, że nie wszyscy używają tych środowisk, poniższa konfiguracja koncentruje sie na zastosowaniach dostarczonych przez interfejs sieciowy CUPS.

Jeżeli planujesz udostępnić drukarkę sieciowej lub podłączyć się do takiej, zapoznaj sie z artykułem CUPS printer sharing (w języku angielskim).

USB printer users may need to blacklist the Template:Codeline module. Keep in mind that there seems to be a lot of uncertainty regarding blacklisting Template:Codeline, as some USB printers, including some Canon and Epson printer series, are not recognized without it. To disable the module, edit Template:Filename as shown:


Custom kernel users may need to manually load the Template:Codeline module before proceeding:

# modprobe usbcore

Once the modules are installed, plug in the printer and check if the kernel detected it by running the following:

# tail /var/log/messages.log


# dmesg

If you're using Template:Codeline, the output should indicate that the printer has been detected like so:

Feb 19 20:17:11 kernel: printer.c: usblp0: USB Bidirectional
printer dev 2 if 0 alt 0 proto 2 vid 0x04E8 pid 0x300E
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 Template:Codeline, you will see something like:

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

If planning on using a parallel port printer, note that the configuration is pretty much the same, except for the modules:

# modprobe lp
# modprobe parport
# modprobe parport_pc

Once again, check the setup by running:

# tail /var/log/messages.log

It should display something like this:

lp0: using parport0 (polling).


It's convenient to have the system automatically load the kernel module every time the it starts up. To do so, use a text editor to open up Template:Filename and add the appropriate module to the MODULES=() line. Here is an example:

MODULES=(!usbserial scsi_mod sd_mod snd-ymfpci snd-pcm-oss lp parport parport_pc ide-scsi)

CUPS daemon

With the kernel modules installed, the system is now ready to start the actual CUPS daemon. To do this, simply run this command:

# /etc/rc.d/cups start

For automatically starting CUPS every time the system is powered on, add it to the DAEMONS=() line in the Template:Filename file. For example:

DAEMONS=(pcmcia syslogd klogd !fam esd mono network autofs cups crond gdm)

Web interface and tool-kit

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 Template:Filename).

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 user-name 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, chose the appropriate drivers and the configuration is complete.

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.

Tip: GNOME users may be inclined towards installing the GNOME CUPS manager GUI frontend. See: #Alternative CUPS interfaces
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.

CUPS administration

A user-name and password will be required when administrating the printer in the web interface, such as: adding or removing printers, stopping print tasks, etc. The default user-name is the one assigned in the sys group, or root (change this by editing Template:Filename in the line of SystemGroup).

If the root account has been locked, it is not possible to log in the CUPS administration interface with the default user-name and password. In this case, it may be needed to change the default SystemGroup in cupsd.conf and read this post.

Remote access to web interface

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 Template:Filename file. Replace the line:

Listen localhost:631


port 631

so that CUPS listens to incoming requests.

There are three levels of access that can be granted:

<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 Template:Codeline statement to that level's section. An Template:Codeline statement can take one or more of the forms listed below:

Allow all
Allow host.domain.com
Allow *.domain.com
Allow ip-address
Allow ip-address/netmask

Deny statements can also be used. For example, if wanting to give all hosts on the subnet full access, file Template:Filename would include this:

# Restrict access to the server...
# By default only localhost connections are possible
<Location />
   Order allow,deny
   Allow From localhost
   Allow From

# Restrict access to the admin pages...
<Location /admin>
   # Encryption disabled by default
   #Encryption Required
   Order allow,deny
   Allow From localhost
   Allow From

# Restrict access to configuration files...
<Location /admin/conf>
   AuthType Basic
   Require user @SYSTEM
   Order allow,deny
   Allow From localhost
   Allow From


The best way to get printing working is to set 'LogLevel' in Template:Filename to:

LogLevel debug

And then viewing the output from Template:Filename 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:

Of course, it is important to know how CUPS works if wanting to solve related issues:

  1. 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).
  2. 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.
  3. 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.
  4. 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 Template:Filename 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" my result from trying to manage CUPS via localhost:631, for example.

To use the new configuration, copy /etc/cups/cupsd.conf.default to /etc/cups/cupsd.conf (backup the old the configuration if needed):

# cp /etc/cups/cupsd.conf.default /etc/cups/cupsd.conf

and restart CUPS to employ the new settings.

Error with gnutls

If receiving errors such as:

/usr/sbin/cupsd: error while loading shared libraries: libgnutls.so.13: cannot open shared object file: No such file or directory

gnutls may be in need of updating:

# pacman -S gnutls

After updating, there may be a file named Template:Filename in Template:Filename. This is the unmodified original configuration file that has been placed as part of the update. Compare it with the currently installed version and adjust to preference.

All jobs are "stopped"

If all jobs sent to the printer become "stopped", delete the printer and add it again. Using the 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.

The PPD version is not compatible with gutenprint


# /usr/sbin/cups-genppdupdate

And restart CUPS (as pointed out in gutenprint's post-install message)

USB printers under CUPS 1.4.x

New CUPS 1.4.x introduces many changes:

Configuration file

The syntax of the configuration file cupsd.conf changed. Start with a new cupsd.conf file based on /etc/cups/cupsd.conf.default.

Blacklisting usblp

CUPS now uses libusb and printer USB devices (under /dev/bus/usb/) instead of the usblp generated /dev/usb/lpX ones. In order to get USB printers working, the usblp module needs disabling. This can be done by blacklisting it in /etc/rc.conf, or by adding "blacklist usblp" to a configuration file in /etc/modprobe.d. Some users have also reported that they needed to reinstall their printer.

Device node permissions

In addition to usblp not being loaded, CUPS also needs the ownership of the USB device file of the printer to be root:lp, and permissions to be 660. E.g.

$ ls -l /dev/bus/usb/003/002
crw-rw---- 1 root lp 189, 257 20. Okt 10:32 /dev/bus/usb/003/002

This is supposed to be achieved by two udev rules in /lib/udev/rules.d/50-udev-default.rules:

# hplip and cups 1.4+ use raw USB devices, so permissions should be similar to
# the ones from the old usblp kernel module
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="", IMPORT{program}="usb_id --export %p"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}==":0701*:", GROUP="lp", MODE="660"

However, for some devices, in particular combined printer/scanner devices, these rules either do not trigger, or are overwritten by rules of the 'sane' package. In these cases a custom udev rule needs to be added. See below.

Device node permission troubleshooting

Get the printer's device file and its permissions with:

$ lsusb
Bus 003 Device 002: ID 04b8:0841 Seiko Epson Corp.
$ ls -l /dev/bus/usb/003/002
crw-rw---- 1 root lp 189, 257 20. Okt 10:32 /dev/bus/usb/003/002

If the permissions are not already root:lp 660, enforce it by creating a custom udev rule, e.g

cat /etc/udev/rules.d/10-usbprinter.rules
ATTR{idVendor}=="04b8", ATTR{idProduct}=="0841", MODE:="0660", GROUP:="lp"

Note that idVendor and idProduct are from the lsusb listing above.

Loading firmware

Some printers and drivers need to load firmware to the printer (such as HP LaserJet 10xx printers using foo2zjs) and do this by writing directly to the lp device, a functionality provided by usblp. A work around until this issue is resolved is to install the usblp module until the firmware is loaded, then remove the module to allow CUPS to work. This can be accomplished by manually running "$ modprobe usblp", waiting for the firmware to load, then "$ rmmod usblp". You can also not blacklist usblp, then put "rmmod usblp" to /etc/rc.local, allowing the firmware to be loaded on boot before rc.local is run, then removing usblp.


CUPS permission errors
  • Some users fixed 'NT_STATUS_ACCESS_DENIED' (Windows clients) errors by using a slightly different syntax:
  • Sometimes, the block device has wrong permissions:
# ls /dev/usb/
# chgrp lp /dev/usb/lp0

HPLIP printer sends "/usr/lib/cups/backend/hp failed" error

Make sure dbus is installed and running, e.g. check DAEMONS in Template:Filename or run Template:Codeline.

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, "Template:Codeline", then it may be needed to add the user to the lp group by running the following command:

# gpasswd -a <username> lp

CUPS returns '"foomatic-rip" not available/stopped with status 3' with a HP printer

If receiving any of the following error messages in Template:Filename 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


PID 5771 (/usr/lib/cups/filter/foomatic-rip) stopped with status 3!

make sure hplip has been installed, in addition to the packages mentioned above, net-snmp is also needed. See this forum post.

# pacman -S hplip

Printing fails with unauthorised error

If the user has been added to the lp group, and allowed to print (set in Template:Filename), then the problem lies in Template:Filename. This line could be the culprit:

AuthInfoRequired negotiate

Comment it out and restart CUPS.

Print button greyed-out in GNOME print dialogs

Source: I can't print from gnome applications. - Arch Forums

Be sure the package: libgnomeprint is installed

Edit Template:Filename and add

# HostNameLookups Double

Restart CUPS:

# /etc/rc.d/cups restart

CUPS fails to print with 'Unable to open device "hal:///[...]": Permission denied'

The permissions on some files are wrong:

# cd /usr/lib/cups/backend
# chmod 700 hal # (previously 755)
# chmod 700 usb # (previously 755)

Unknown supported format: application/postscript

Comment the lines:

application/octet-stream        application/vnd.cups-raw        0      -

from Template:Filename, and:


in Template:Filename.

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:

		\\REGULATOR-PC\print$         	Printer Drivers
		\\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.


Alternative CUPS interfaces

If using GNOME, a possibility is to manage and configure the printer by using system-config-printer-gnome. This package is available through pacman:

# pacman -S system-config-printer-gnome

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)

  • 1. Create group, and add a user
# groupadd lpadmin
# usermod -aG lpadmin <username>
SystemGroup sys root <insert here>
  • 3. Restart cups, log out and in again (or restart computer)
# /etc/rc.d/cups restart

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.

There is also gtklp:

# pacman -S gtklp

PDF virtual printer

CUPS-PDF is a nice package that allows one to setup a virtual printer that will generate a PDF from anything sent to it. Obviously this package is not necessary, but it can be quite useful.

Find generated PDF documents in a sub-directory located at /var/spool/cups-pdf. Normally, the subdirectory is named after the user who performed the job.

This package can be installed by the following command:

# pacman -S cups-pdf

After installing the package, set it up as if it were for any other printer by using the web interface. For the Device, select CUPS-PDF (Virtual PDF Printer); Make/Manufacturer, choose Generic; Model/Driver, select Generic postscript color printer or Generic Cups-PDF Printer. Alternatively, provide the PPD file from this link.

Print to postscript: CUPS-PDF virtual printer trick

Printing to PDF in most applications like OpenOffice is no problem; just hit the button. Yet when printing out to postscript, matters take a little more work. For applications like OpenOffice where printing to kprinter is nebulous at best, there has to be another way -- and there is. The CUPS-PDF (Virtual PDF Printer) actually creates a postscript file and then creates the PDF using the ps2pdf utility. To print to postscript, what needs to be done is capturing the intermediate postscript file created by CUPS-PDF. This is easily accomplished with by selecting the "print to file" option in the print dialog. (choose either .ps or .eps as the extension) After selecting the "print to file" checkbox simply enter the filename and click "print".

Configuring CUPS-PDF virtual printer

1. Install cups & cups-pdf from extra.

2. Start cups with:

# /etc/rc.d/cups 
Note: Add 'cups' to the deamons line in /etc/rc.conf to start automatically at boot.

3. 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

Now 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...

Another source for printer drivers

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.