cups - bunnyamin/bunnix GitHub Wiki

Package

CUPS (Common Unix Printing System)

Distribution Package
Arch Linux cups
Arch Linux gostscript

SystemD

  • systemctl start cups.service

Configuration

  • /etc/cups/cupsd.conf

Network

Identify printer IP or MAC.

Server

Enable acces from local clients to server CUPS:

  1. Configure /etc/cups/cupsd.conf

    Listen <CLIENT IP>:631
    DefaultEncryption Basic
    DefaultEncryption Never # Prevent redirection to HTTPS
    <Location />
      Order allow,deny
      Allow @LOCAL
    </Location>
    <Location /admin>
      Encryption Never # Prevent redirection to HTTPS
      AuthType Default
      Require user @SYSTEM
      Order allow,deny
      Allow @LOCAL
    </Location>
    <Location /admin/conf>
      AuthType Default
      Require user @SYSTEM
      Order allow,deny
      Allow @LOCAL
    </Location>
    
  2. Enable remote admin cupsctl --remote-admin

Available connections can be found with

  • lpinfo -l -v It may however not show the printer IP.

Client

  • Install CUPS
  • Configure using Web interface or CLI
    • Login to local CUPS (localhost) and add printer at target IP
  • Setup up drivers and other necessary settings

Web interface

  1. Enter location http://<CLIENT IP or NAME>:631.
  • When prompted for username and password, provide the credentials of a user on the server, usually root for administration.
  • Section: "Administration" and either
    • Command: "Find new printers"
    • Command: Add printer
      • Provide a valid connection, for example
        • lpd://XXXY00000000Z00/BINARY_P1 Deprecated
        • ipp://<PRINTER IP>/ipp/print
        • ipp://<PRINTER IP>/printers/<NAME OF PRINTER ON SERVER>
  1. Add name, description and location information
    • Share This Printer: Yes (only necessary on server not clients)
  2. Select driver
    • PPD are obsolete, unless necessary use "IPP Everywhere".
      1. Locate the latest driver PPD file.
      2. Copy the PPD file $ cp device.ppd /usr/share/cups/model/.
    • Make: Generic
    • Model: IPP Everywhere
  3. Copy CUPS and, or LPD wrappers to /usr/lib/cups/filter/

CLI

  • lpadmin -o printer-is-shared=true -p <NAME> -D "<DESCRIPTION>" -L "<LOCATION>" -E -v "ipp://<SERVER IP>/ipp/print" -m everywhere
  • If PPD: -P printer PPD file, for example, /usr/share/cups/model/generic_lp3000.ppd. CUPS copies the PPD, modifies it and uses the modified version stored at /etc/cups/ppd/sslc460fw.ppd.
Command Example Comment
Drivers, list lpinfo -m List all available drivers.
Print lp -d <PRINTER NAME> <FILE> lp and lpr are equivalent; they exist because of legacy and compatibility support. lp vs lpr. What to use in case of CUPS and what historical difference?
Printer, add (IPP everywhere) lpadmin -p <PRINTER NAME> -D "<PRINTER DESCRIPTION>" -L "<PRINTER LOCATION>" -E -v <PRINTER URI> -o printer-is-shared=false -m everywhere" -p printer name, for example, glp3000.
-D printer description, for example, Generic Lazer Printer 3000.
-L printer location description, for example, The Room.
-m printer model, for example, Generic LP Series or the PPD file name generic_lp3000.ppd. List modules lpinfo -m.
-v printer URI, for example, ipp://192.168.0.109/ipp/printer or socket://192.168.0.109/.
-E Enable printer. When specified before the -d, -p, or -x options, the -E option forces encryption when connecting to the server.
-o printer-is-shared=false default is true.
• Restart CUPS.
Printer, declare default lpadmin -d 'glp3000'
Printer, delete 1. lpoptions -x <PRINTER NAME> remove printer options.
2. cupsreject <PRINTER NAME> prevent any new requests from entering the printer's queue before removing the printer.
3. # cupsdisable <PRINTER NAME> stop the printer.
4. # lpadmin -x <PRINTER NAME> delete the printer.
5. $ lpstat -p <PRINTER NAME> -l verify that printer is removed.
Printer, enable 1. cupsaccept printer-name
2. # cupsenable printer-name
If -E was not provided when the printer was added lpadmin.
Printer options, current lpoptions -l -d <PRINTER NAME>
Printer options, change lpoptions <PRINTER NAME> -o <OPTION>=<VALUE> -o ColorMode=False -o Quality=Normal -o PageSize=A4
Printer, status lpstat -p <PRINTER NAME> -l -> printer <PRINTER NAME> is idle. enabled since Sat 30 Dec 2017 11:43:57 PM UTC -a Shows the accepting state of printer queues. If no printers are specified then all printers are listed.
-e Shows all available destinations on the local network.
-l Shows a long listing of printers, classes, or jobs.
-o [destination(s)] Shows the jobs queued on the specified destinations. If no destinations are specified all jobs are shown.
-p Shows the printers and whether they are enabled for printing. If no printers are specified then all printers are listed.
-r Shows whether the CUPS server is running.
-s Shows a status summary, including the default destination, a list of classes and their member printers, and a list of printers and their associated devices. This is equivalent to using the -d, -c, and -v options.
-t Shows all status information. This is equivalent to using the -r, -d, -c, -v, -a, -p, and -o options.
-u [user(s)] Shows a list of print jobs queued by the specified users. If no users are specified, lists the jobs queued by the current user.
-v [printer(s)] Shows the printers and what device they are attached to. If no printers are specified then all printers are listed.
Printer, status lpc status
Printer, status lpstat -t
Printers lpinfo -v
Queue, list for all printers lpq -a
Queue, list for specific printer lpq -P <PRINTER NAME>
Queue, remove all jobs lprm - (Did not work.)
Queue, remove last job lprm (Did not work.)
Queue, remove job lprm <JOB NUMBER>

Error, problem, troubleshooting

  • Enable LogLevel debug in /etc/cups/cupsd.conf
  • Then tail -n 100 -f /var/log/cups/error_log

Confirm settings were created correctly:

  • /etc/cups/printers.conf
Event Error Cause Remedy
CUPS "No viable font found" Install a viable font, for example, ttf-dejavu.
File "/usr/lib/cups/filter/rastertospl" not available: No such file or directory Install from <DEVICE DRIVER DIRECTORY>/rastertospl /usr/lib/cups/filter/.
Unable to execute gs program: No such file or directory Install ghostscript.
Forbidden You cannot access this page. cupsctl --remote-admin
Unable to launch Ghostscript: gs: No such file or directory Install Ghostscript.
HTTP_STATE_WAITING Closing for error 32 (Broken pipe) On server: lpadmin -p <PRINTER NAME> -v "ipp://<NAME>._ipp._tcp.local/" -E -m everywhere On client: lpadmin -p <PRINTER NAME> -v ipp://<SERVER IP or NAME>:631/ipp/print -E -m everywhere
Server not available Edit /etc/cups/cupsd.conf update listen to correct hostname.
lpadmin: Unable to create PPD: Printer does not support required IPP attributes or document formats The IP to printer is wrong.
WUI Modify printer Printer drivers and raw queues are deprecated and will stop working in a future version of CUPS. Use IPP Everywhere (TM), not Generic IPP
WUI Modify printer CIPS unable to modify printer Cannot change printer-is-shared for remote queues. Local client attempts to share network printer Do not share network printers locally
⚠️ **GitHub.com Fallback** ⚠️