CUPS – Hilfreiche Tricks
Einrichtung einer Druckerwarteschlange
Ob Sie einen Drucker installieren müssen oder nicht, hängt von verschiedenen Faktoren ab:
-
Um welches Gerät handelt es sich, das Sie installieren möchten – einen Drucker von einem entfernten CUPS-Server (sogenannte Remote-Druckwarteschlange) oder einen Drucker?
-
Wo befindet sich das Gerät, das Sie installieren möchten – per USB an Ihren PC angeschlossen, in Ihrem lokalen Netzwerk, in einem anderen Netzwerk oder auf einem entfernten Server installiert?
-
Wie alt ist das Gerät, das Sie installieren möchten:
-
Standalone-Drucker – die meisten SOHO-Drucker (Small Office, Home Office) und Bürodrucker, die nach 2010 hergestellt wurden, verfügen über mindestens eine Möglichkeit zur Unterstützung des treiberlosen Druckens; ältere Geräte sind auf Treiber angewiesen – klassische Treiber oder Druckeranwendungen.
-
Remote-Druckwarteschlangen auf einem Server - jedes Betriebssystem mit CUPS 2.2.8 und neuer oder ein Betriebssystem, bei dem die IPP Everywhere-Unterstützung nachträglich integriert wurde (z.B. RHEL 8), ist in der Lage, IPP Everywhere zu unterstützen; andernfalls ist eine Kombination aus Treiber und Rohwarteschlange in der Client-Server-Kommunikation erforderlich.
-
-
Welchen Zweck hat das Gerät, auf dem der Drucker installiert ist – ein Endgerät, das vom Benutzer als Desktop-Computer genutzt wird, oder ein Server, der die installierten Drucker weiterverbreitet?
-
Welche persönlichen Präferenzen haben Sie – Verwendung oder Nichtverwendung des IPP-Protokolls, Verwendung oder Nichtverwendung von mDNS für die automatische Installation, falls dies anhand des Netzwerk-Layouts möglich ist?
Es gibt also mehrere Benutzergeschichten, die auf diesen Abhängigkeiten basieren und weiter unten beschrieben werden.
Häufige Erfahrungsberichte
Ich besitze einen Drucker, der nach 2015 hergestellt wurde, bin zu Hause und möchte von meinem PC aus drucken
-
die gängigste Konfiguration auf dem Desktop
-
der Drucker ist neu genug, um treiberlose Standards über USB und Netzwerk zu unterstützen, daher hängt die treiberlose Unterstützung nicht von Ihrer Verbindung ab
-
der PC ist ein Endgerät, ich möchte den Drucker nicht freigeben
-
I don’t mind using mDNS and IPP, mDNS is enabled in my firewall, IPP and mDNS (or similar settings) are enabled on the printer, and mDNS resolution works (checked by pinging .local hostname)
I have an older printer, I’m at home and want to print from my PC
Currently there are two options - install the printer in printer application and CUPS will automatically see it, or install it with classic driver permanently. Installation with classic driver is deprecated and will be removed in CUPS 3.0.
I’m in a company which has a print server where office printers are installed, I want to print to the print server - no mDNS, but with driverless
-
the print server supports IPP Everywhere and is in a different network or doesn’t register on mDNS, or I don’t want to use mDNS
-
remote print queue has the URI ipp://<server_hostname>:631/printers/<queue_name>, where <server_hostname> is the hostname of print server and <queue_name> is a name of a print queue I want to connect to
-
ipptool command passes if the URI is used
Such printers has to be installed permanently with IPP Everywhere driver.
I’m in a company which has a printer server where office printers are installed, I want to print to the print server - with working mDNS in local network
Such remote printers are discovered automatically via mDNS and used as CUPS temporary queues on network - they are seen on mDNS and automatically picked up by dialogs.
I want to print, but I don’t want to or can’t use mDNS, regardless whether my printer supports driverless printing
Every printer which can’t be discovered by mDNS has to be installed permanently in CUPS or, in CUPS 3.0, by printer profile.
-
Treiberlose Drucker:
-
all of them supported by IPP Everywhere model under Manufacturer entry in CUPS Web UI and as everywhere in CLI
-
types based on origin:
-
Network:
-
URI: ipp://<hostname_or_ip>:631/ipp/print , where <hostname_or_ip> is hostname or IP address of the printer
-
-
IPP-über-USB-Drucker über ipp-usb:
-
URI: ipp://localhost:60000/ipp/print
-
-
Printers installed via printer application:
-
URI: ipp://localhost:8000/ipp/print/<printer_name> , where <printer_name> is the printer name chosen in printer application
-
-
-
-
Remote-Druckerwarteschlangen auf einem Druckerserver:
-
URI: ipp://<server_ip_or_server_hostname>:631/printers/<remote_print_queue> , where <server_ip_or_server_hostname> is server’s IP address or hostname and <remote_print_queue> is a name of the print queue installed on the server
-
it depends on CUPS on the server whether a local printer which points to a printer on the server can be installed as IPP Everywhere model - usually CUPS 2.2.8 and newer support driverless and some distributions such as CentOS 8 backported the functionality as well
-
otherwise it depends on printer’s driver on the old server - the key is to prevent applying the options multiple times (so one of the connections has to be raw and loses some of the functionality)
-
-
Legacy or specialized printers
-
(deprecated, to be removed in CUPS 3.0) can be discovered by CUPS and installed with classic drivers
-
can be installed in printer application and then installed in CUPS as a permanent queue (see driverless printers - printers installed via printer application above)
-
Driverless options don’t do the trick for me on my driverless printer, I want to use features from the driver
The current recommended action is to install the printer via printer application, which contains the classic driver, because installation the printer permanently in CUPS with classic driver is deprecated and it will be removed in CUPS 3.0. Then mDNS can be used to catch it by CUPS or the printer from printer application has to be installed permanently in CUPS as a IPP Everywhere printer.
In case of IPP-over-USB printers, a reject rule has to be added as described in known issues.
I install the printer on a server, which will share the printer further
Printers on the server have to be installed permanently to be shared. IPP Everywhere model (directly to the printer or via printer application) is the ideal, but a classic driver with standardized PPD options on a server capable of using driverless is fine as well - clients can use IPP Everywhere model when pointing to the server and options are translated properly. Otherwise there is a possibility that some options aren’t applied or applied twice. Don’t forget about enabling IPP in firewall, setting ACLs to the server via /etc/cups/cupsd.conf and attaching the daemon to port 631 instead of localhost.
I’m in a company with old print server incapable of driverless, I want to print
The important thing is to prevent applying options multiple times in this scenario. There are several ways how to do it:
-
ask your IT support for the driver (print queue on the server has to be raw)
-
use ServerName directive in
/etc/cups/client.confor CUPS_SERVER environment variable to connect to the server directly - you won’t be able to do admin tasks, but capable of printing.
How to find out whether my printer is capable of driverless printing?
Network printers have the prerequisites - enablement of IPP port on the printer is the minimum, mDNS is required for automatic printer discovery by libcups. If needed, enable AirPrint, IPP Everywhere or any other driverless standards related options in the printer settings, either via the printer panel or the printer web interface.
-
ipptoolcommand which sends IPP Get-Printer-Attributes request to the network printer passes:
$ ipptool -tv ipp://printer.example.com:631/ipp/print get-printer-attributes.test
"/usr/share/cups/ipptool/get-printer-attributes.test":
Get-Printer-Attributes:
attributes-charset (charset) = utf-8
attributes-natural-language (naturalLanguage) = en
printer-uri (uri) = ipp://printer.example.com:631/ipp/print
requested-attributes (1setOf keyword) = all,media-col-database
Get printer attributes using get-printer-attributes [PASS]
...
, wobei printer.example.com der Rechnername oder die IP-Adresse Ihres Netzwerkdruckers ist,
How to find out if my USB device supports IPP over USB
Check whether your USB device has a following text in lsusb -v output:
...
bInterfaceClass 7 Printer
bInterfaceSubClass 1 Printer
bInterfaceProtocol 4
iInterface 0
...
If the device has the bInterfaceClass 7, bInterfaceSubClass 1 and bInterfaceProtocol 4 in the sequence, it supports IPP over USB which is critical for USB device driverless printing and scanning.
Note: Some manufacturers bind IPP over USB support with network driverless standards, which is not correct. If the printer has network and USB connectivity and IPP over USB is not shown in lsusb output, try to look into printer settings, enable AirPrint and check the lsusb -v output again.
Einrichten temporärer CUPS-Warteschlangen
Für die korrekte Einrichtung der temporären Warteschlangen müssen mehrere Voraussetzungen erfüllt sein:
-
der Drucker/die Remote-Druckerwarteschlange verfügt über treiberlose Unterstützung und diese ist aktiviert,
-
auf Ihrem PC läuft der avahi-daemon-Dienst oder der avahi-daemon-Socket,
-
your PC has cups socket or service running,
-
mDNS-Hostnamen sind auflösbar – testen Sie dies durch Anpingen eines .local-Hostnamens
Einrichten temporärer CUPS-Warteschlangen mit einem Netzwerkdrucker
-
additional requirement:
-
enable MDNS in your firewall settings
-
After this the temporary queue will appear in the print dialog and you don’t need to install a specific print queue unless you have a reason for it.
You can check if your printer is seen in mDNS messages by (avahi-tools must be installed):
$ avahi-browse -avrt ... = enp0s25 IPv4 HP LaserJet M1536dnf MFP (42307C) _ipp._tcp local hostname = [NPI42307C.local] address = [192.168.1.10] port = [631] txt = ["UUID=434e4239-4243-4a42-5859-3c4a9242307c" "Scan=T" "Duplex=T" "Color=F" "note=" "adminurl=http://NPI42307C.local." "priority=10" "product=(HP LaserJet M1536dnf MFP)" "ty=HP LaserJet M1536dnf MFP" "URF=CP99,W8,OB10,PQ3-4-5,DM1,IS1-4,MT1-2-3-5,MT1-2-3-5,RS600" "rp=ipp/printer" "pdl=application/postscript,application/vnd.hp-PCL,application/vnd.hp-PCLXL,application/pdf,image/urf" "qtotal=1" "txtvers=1"] ...
and if CUPS or its backends see the printer by commands:
(lists all existing print queues - permanent or temporary - temporary ones contain network as the second string on a line)
$ lpstat -l -e HP_LaserJet_M1536dnf_MFP_42307C network none ipp://HP%20LaserJet%20M1536dnf%20MFP%20(42307C)._ipp._tcp.local/ myprinter permanent ipp://localhost/printers/myprinter beh:/1/3/5/socket://printer:9100
oder
(alle Geräte auflisten, die CUPS im lokalen Netzwerk oder über USB erkennt)
$ lpinfo -l -v
...
Device: uri = ipp://HP%20LaserJet%20M1536dnf%20MFP%20(42307C)._ipp._tcp.local/
class = network
info = HP LaserJet M1536dnf MFP (driverless)
make-and-model = HP LaserJet M1536dnf MFP
device-id = MFG:HP;MDL:LaserJet M1536dnf MFP;CMD:PDF,PS,PCL,AppleRaster,URF;
location =
...
Einrichten temporärer CUPS-Warteschlangen mit einem USB-Drucker
-
additional requirements:
-
Installieren Sie ipp-usb, wodurch IPP über USB-Geräte in einen Netzwerkdrucker auf localhost umgewandelt wird:
-
$ sudo dnf -y install ipp-usb
Then you can follow the steps in manual for network printers.
Einrichten einer permanenten Druckerwarteschlange
Voraussetzungen für permanent treiberlose Drucker: Aktivieren Sie IPP in Ihrer Firewall und, wenn möglich, auch auf Ihrem Drucker.
Installation über die Web-Oberfläche von CUPS
-
start cups.service
$ sudo systemctl start cups
-
Öffnen Sie http://localhost:631 in Ihrem Browser
-
Gehen Sie zum Reiter Administration
-
Klicken Sie auf Add printer
-
Geben Sie Ihre Anmeldedaten ein
-
Wählen Sie das gefundene Gerät oder die gewünschte Verbindung aus – für eine treiberlose permanente Warteschlange wählen Sie Internet Printing Protocol (IPP)
-
Falls Sie kein gefundenes Gerät ausgewählt haben, geben Sie auf der nächsten Seite die Geräte-URI ein – bei treiberlosen Druckern lautet diese üblicherweise:
Netzwerkdrucker: ipp://<Drucker_IP_oder_Drucker_Rechnername>:631/ipp/print USB-Drucker über ipp-usb: ipp://localhost:60000/ipp/print Nicht-treiberlose Drucker über eine Drucker-Anwendung: ipp://localhost:8000/ipp/print/<Druckername> Printers pointing to a remote CUPS server: ipp://<server_ip_or_server_hostname>:631/printers/<remote_print_queue>
-
choose device manufacturer and model (IPP Everywhere for driverless printers)
-
set a different default options if needed and finish
Hinweise:
Adding a permanent queue for driverless USB printers or non-driverless printers installed in a printer application is usually unnecessary, because they are shared by mDNS on localhost, so any application using CUPS 2.0+ API functions (cupsGetDests(), cupsGetNamedDest(), cupsCopyDestInfo()) should be able to pick them automatically (for network printer it depends whether the device is in the same subnet as your machine). Installing them permanently should be necessary only if an application doesn’t use the recent API or to work around a bug which happens when using them as temporary queues.
If there are more devices via ipp-usb or printer applications, they listen on different ports - devices via ipp-usb start on port 60000, separate printer applications start on port 8000.
Installation über die Befehlszeile
-
you will need a device uri -
<device_uri>, which you can find bylpinfo -v:
$ lpinfo -v
direct usb://HP/Officejet%20Pro%208500%20A909a?serial=NNNNNNNNN&interface=1
====================================================================
network dnssd://Officejet%20Pro%208500%20A909a%20%5B43FD8E%5D._pdl-datastream._tcp.local/
=================================================================================
oder Sie erstellen sie manuell – z.B. für IPP-Drucker:
ipp://<IP/Rechnername>:631/ipp/print
and a driver name - <driver>, f.e.:
$ lpinfo -m .... everywhere IPP Everywhere ========== ...
$ lpadmin -p <Name> -v <Geräte_URI> -m <Treiber> -E
where <device_uri> and <driver> are underscored strings from previous commands and <name> is a print queue name, which is chosen by you.
How to install a printer via printer application in SNAP and making it available for CUPS
Currently printer applications are available in SNAPs on Fedora. I’m planning to release them as RPMs, but the code base will be the same, so its testing can happen even with SNAPs.
-
install snapd,
First we have to install snapd for testing purposes:
$ sudo dnf -y install snapd $ sudo ln -s /var/lib/snapd/snap /snap $ snap version
If the installation had been successful, the last command will show snapd’s version.
-
install and run printer application,
First the SNAP with printer application has to be installed and started by the commands below. All printer applications are available in SNAP Store under the same names as they are at OpenPrinting repositories. We will use ps-printer-app printer application in the next steps.
$ sudo snapd install --edge ps-printer-app $ sudo snapd run ps-printer-app
-
go to http://localhost:8000,
After starting the printer application its web interface becomes available at http://localhost:8000 - if user installs and runs another printer application, it will become available at localhost on the next port (8001). The printer application can contain several printers (as cupsd does).
-
click on
Add Printeron the main page, -
choose the printer’s name,
-
select the found device or choose
Network printerfromDevicescroll menu and provide hostname or IP of the device, -
choose to auto-detect driver or select the driver by yourself,
-
click on
Add Printer, -
now the printer should be available at least on localhost via mDNS (if
avahi-daemonis running andnss-mdnsis installed)- check it byavahi-browse(avahi-toolshas to be installed):
$ avahi-browse -avrt ... = lo IPv4 HP Laserjet M1536 _ipp._tcp local hostname = [fedora-2.local] address = [127.0.0.1] port = [8000] txt = ["Scan=F" "PaperMax=legal-A4" "Fax=F" "product=(HP LaserJet M1536dnf MFP Postscript (recommended))" "mopria-certified=1.3" "priority=0" "qtotal=1" "txtvers=1" "Duplex=T" "Color=F" "TLS=1.2" "URF=V1.5,W8,PQ3-4-5,DM1,FN3,IS0-20,MT1-5-6-3,OB10,RS300-600" "UUID=24837a30-5f87-3ac9-6d85-086d486092dd" "pdl=image/pwg-raster,image/urf,application/vnd.printer-specific,application/pdf,application/postscript,image/jpeg,image/png" "note=" "adminurl=http://fedora-2.local:8000/HP_Laserjet_M1536/" "ty=HP LaserJet M1536dnf MFP Postscript (recommended)" "rp=ipp/print/HP_Laserjet_M1536"] ...
-
und mit
lpstat -e:
$ lpstat -e ... HP_Laserjet_M1536 ...
Die verfügbaren Druckoptionen für den über die Druckeranwendung installierten Drucker können mit dem Befehl lpoptions überprüft werden:
$ lpoptions -p HP_Laserjet_M1536 -l PageSize/Media Size: 184.15x260mm 195.09x269.88mm A4 A5 B5 DoublePostcardRotated Env10 EnvC5 EnvDL EnvMonarch Executive FanFoldGermanLegal ISOB5 Legal *Letter Postcard roc16k Custom.WIDTHxHEIGHT InputSlot/Media Source: *Auto Tray1 Auto MediaType/Media Type: *Unspecified Stationery Light6074 MidWeight96110 Heavy111130 ExtraHeavy131175 MonochromeLaserTransparency Labels StationeryLetterhead Envelope StationeryPreprinted Prepunched Colored Bond StationeryRecycled Rough Vellum cupsPrintQuality/cupsPrintQuality: Draft *Normal High ColorModel/Output Mode: *Gray Duplex/Duplex: *None DuplexNoTumble DuplexTumble OutputBin/OutputBin: *FaceDown
Installation eines Scanners
Scanner müssen unter Linux nicht auf die gleiche Weise installiert werden wie Drucker, wenn sie sich im selben Netzwerk befinden oder über USB angeschlossen sind – es genügt, wenn sane-backends installiert ist, und jede Scan-Anwendung kommuniziert mit dem Scanner/Multifunktionsgerät über das Backend, das den Scanner unterstützt.
However, the older HP scanners and multifunction devices require an additional package - hplip - and its binary plugins downloaded via hp-plugin -i if they aren’t supported by sane-backends already.
How to find out my multifunction device or standalone scanner is capable of driverless scanning?
-
check the device specification and look for eSCL/AirScan/WSD - if any of these are mentioned, the device is capable of driverless scanning
-
most devices which advertise they can do AirPrint are capable of AirScan too
-
[USB devices only] check for IPP over USB (manual here).
How to make driverless scanning work
For LAN located and USB devices:
-
have avahi-daemon enabled and running
$ sudo systemctl enable avahi-daemon $ sudo systemctl start avahi-daemon
-
enable MDNS in firewall
-
[USB devices only] install ipp-usb
For network scanners in a different network:
-
set the scanner device uri in
/etc/sane.d/airscan.conf- see:
man sane-airscan
How to setup mDNS with systemd-resolved
systemd-resolved is enabled and running by default since F33 and can be setup to work with Avahi on mDNS support which CUPS needs - Avahi does the advertising, registering and sharing devices, and resolved will handle '.local' address resolution. It will work with following steps:
-
put
MulticastDNS=resolveinto/etc/systemd/resolved.conf
$ sudo systemctl restart systemd-resolved $ sudo nmcli connection modify <connection_name> connection.mdns yes connection.llmnr yes $ sudo systemctl restart NetworkManager
How to compress files
Beispiel:
$ tar -czvf cups-information.tar.gz /etc/cups cups.logs troubleshoot.txt lpinfo.log
Want to help? Learn how to contribute to Fedora Docs ›