cups - bunnyamin/bunnix GitHub Wiki

CUPS (Common Unix Printing System)

Distribution Package
Arch Linux cups
Arch Linux gostscript

SystemD

  • systemctl start cups.service

Web interface

  • /etc/cups/cupsd.conf
  1. Address
    • Listen <HOST IP or NAME>:631
    • DefaultEncryption IfRequested When prompted for username and password, provide the credentials of a user on the server.
  2. Enable remote admin cupsctl --remote-admin
  3. Enter location http://<HOST IP or NAME>:631.

Configure printer

Add printer

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>

Web interface

  1. Section: Administration
  2. Command: Add printer
    • When prompted for login, try the credentials for root.
  3. Connection:
    • Available connections can be found with lpinfo -v
    • Provide a valid connection, for example ipp://192.168.0.10/ipp/print
  4. Select driver
    • PPD are obsolete, when possible use IPP Everywhere.
      1. Locate the latest driver PPD file.
      2. Copy the PPD file $ cp device.ppd /usr/share/cups/model/.
      3. Copy CUPS wrappers to /usr/lib/cups/filter/
    • Make: Generic Model: IPP Everywhere

Share printers

Server

  • cupsctl --share-printers on same subnet

  • cupsctl --share-printers --remote-any on any subnet

  • /etc/cups/cupsd.conf

Listen <HOST IP or NAME>:631`
<Location />
    Order allow,deny
    Allow all    # or
    Allow @LOCAL # only local or specify what addresses are allow:
    Allow localhost
    Allow 192.168.0.*
</Location>

Client

  • Install CUPS
  • Configure CUPS
  • Setup up drivers and other necessary settings.
  • Add printer to the IPP address ipp://<LOCALHOST IP or NAME>/ipp/print
  • lpadmin -p <PRINTER NAME> -E -v ipp://<SERVER IP or NAME>:631/ipp/print -m everywhere

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
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.
⚠️ **GitHub.com Fallback** ⚠️