- How to debug printing problems
- Identifying your problem area
- CUPS logging
- Location of CUPS logging
- Enable CUPS debug logging
- CUPS job log
- Incident-bound cupsd log (broken print queue isn’t HPLIP supported)
- Incident-bound cupsd log (broken print queue is HPLIP supported)
- Turning off debug logging
- More commands for working with systemd-journald
- How to Enable Debug (collect logs) in CUPS
- Root access
- Debian / Ubuntu
- macOS
- Gather Logs
How to debug printing problems
If you are experiencing a problem with printing, please take a look at the common bugs page before filing a bug. If the problem you are seeing is not listed there or none of the workarounds seem to help, please consider filing a bug report to help us make Fedora run better on your hardware.
Identifying your problem area
Printing issues can be fairly complex and active cooperation or lots of data can be requested from reporter by maintainer to helping maintainer to at least understand and (if it is not hardware specific issue) reproduce the issue, so please have a patience and try to narrow the problem as much you are able to for maintainers.
- issues with seeing or connecting to the printer (it can be cups backend issues, avahi issues, libusb issues, cups-browsed issues),
- accessibility issues (correct/wrong setup in cupsd.conf or its bad interpretation by cupsd daemon, bad cooperation with NIS, SSSD…),
- printing with help of samba (issues with smb backend, which is part of samba) or with samba authenticated through Kerberos (samba_krb5_printing),
- issues with filters used during filtering the document into document format supported by printer, which influence how or if the document will be printed (issue with filters — pdftops, pdftopdf, pstops, bannertopdf etc. — or issues with binaries or libraries which filters uses — libgs, qpdf, poppler…),
- issues with Postscript Printer Description files, which are old way of defining printers capabilities like supported page sizes, borders etc…
Not mentioning possible limitations or issues in firmware or hardware of printer itself, so any kind of data or narrowing the issue is welcomed.
The best start is to attach files with logs described further down.
CUPS logging
All CUPS logging is redirected to journal by default since Fedora 28 (there was a redirecting of error_log to journal by default before Fedora 28).
We need to define two different ways of capturing incident-bound CUPS whole logs — the one if the broken print queue isn’t provided by HPLIP and the other if it is. They differs in the filter option of journald — if you use non-HPLIP queue for debugging, it is okay to gather the logs from cups systemd unit (by ‘-u cups’), because all error messages are correctly redirected to cups systemd unit logging and they are accessible in the output after unit filtering. HPLIP libraries are not implemented to do the same (upstream is unresponsive to accept a potencial fix into the project and the issue is not critical enough to drag a downstream patch forever), so their messages aren’t marked for cups systemd unit and they’re filtered out after calling journald with ‘-u cups’. For such queues journald log without filtering is required.
Incident-bound journald log without filtering is required only for HPLIP print queues (their device uri starts with hp://) and it is unwanted for other queues, because it can be hard to read in larger cases. Please attach incident-bound journald log only when it is necessary.
Location of CUPS logging
CUPS logging is located in the system journal by default, but the logging into a file can be set in /etc/cups/cups-files.conf with directive ErrorLog . If you want to change the default settings, then the name of the logging file is irrelevant, but it is recommended to put the file into path /var/log/cups , otherwise SELinux will block cupsd from accessing it.
Setting the logging to a file has following cons (without further operations):
- unable to get only logs connected to a job without chaining more commands
- unable to get logs for specified time frame without chaining more commands
For capturing a incident-bound logs tail -f can be used e.g.:
tail -f /var/log/cups/error_log
Enable CUPS debug logging
Enable full debugging information with:
CUPS job log
If the problem appears when you sent document to print or if you are trying to, capture logs for this job. If the job log is available, its attaching is REQUIRED.
Prepare CUPS for job logging
For being able to see specific job log, please turn on:
in your /etc/cups/cupsd.conf file and restart cup service. Do not forget to remove the line after you are done with debugging. lpstat -W all seems to be empty after printing if you do not enable the directive.
Get a job log for a specific job ID
To capture job log you need to know Job ID (JID) of the job — it is the number after dash in a request ID:
Request ID looks like this:
and can be seen in terminal if you send a document to print by lp command:
$ lp -d . request id is - (N file(s))
Or when you list jobs (see man lpstat ) — the latest job is at the end:
$ lpstat -W all . - 1024 Wed 11 Jan 2017 05:52:19 PM CET
You can get the latest job logs automatically (if you have awk installed and lpstat -W all returns jobs) by:
$ journalctl -u cups JID=`lpstat -W all | awk '' | awk -F '-' '' | tail -n 1` > cups_job_log
Or manually, if you found JID by yourself:
journalctl -u cups JID= > cups_job_log
Incident-bound cupsd log (broken print queue isn’t HPLIP supported)
Sometimes we cannot bind the error with a specific print job, so the job log is uneffective. Incident-bound cupsd log is needed.
How to start to capture incident-bound cupsd logging
In new terminal/terminal tab, please issue:
journalctl -f -u cups > cups_whole_log
How to get incident-bound cupsd logging
After you trigger the error condition you are trying to diagnose e.g. printing something, try to find a printer via lpinfo etc., you terminate capturing incident-bound cupsd log from step above by + .
Incident-bound cupsd log (broken print queue is HPLIP supported)
Unfortunately, HPLIP libraries don’t log into CUPS unit in journal, so if your print queue is installed with HPLIP driver (its device uri starts with hp:// ), we need incident-bound journal log.
How to start to capture incident-bound journal logging
In new terminal/terminal tab, please issue:
journalctl -f > journal_whole_log
How to get incident-bound journal logging
After you trigger the error condition you are trying to diagnose e.g. printing something, running HP script etc., you terminate capturing incident-bound journal log from step above by + .
Turning off debug logging
Please attach cups_job_log for the problematic job, cups_whole_log or journal_log if you caught whole cupsd log during the problematic event to bug report as an attachment.
Then to turn off debugging information, do this:
$ sudo sed -i 's,LogLevel debug2,LogLevel warn,' /etc/cups/cupsd.conf $ sudo systemctl restart cups
More commands for working with systemd-journald
View the log messages with:
How to Enable Debug (collect logs) in CUPS
From time to time, PaperCut Technical Support will request additional logs from the CUPS printing environment found on many Linux servers, clients and Mac environments. This will aid PaperCut in diagnosing issues that you may have. This KB article is best used in conjunction with the HowToEnableDebugInThePrintProvider article.
CUPS creates a few log files in the default logs directory (normally /var/log/cups/ for Ubuntu, Debian and macOS). We will want to look at error_log primarily. This is a file where CUPS writes information about what it is doing. However, for this file to be useful to us, we have to enable Debug Logging in CUPS first.
Root access
To modify these settings you will likely need root access in a shell or terminal. Once you’ve opened a shell or terminal, you can then elevate yourself to root by “sudo’ing to it” with:
This should work on all modern Linux operating systems as well as macOS.
Debian / Ubuntu
Enabling and disabling CUPS debug logging is done via cupsctl
- Enable CUPS debug logging. cupsctl —debug-logging
- Disable CUPS debug logging. cupsctl —no-debug-logging
Then restart CUPS using one of the locations:
macOS
Enabling and disabling CUPS debug logging is done via cupsctl
- Enable CUPS debug logging. cupsctl —debug-logging
- Disable CUPS debug logging. cupsctl —no-debug-logging
- In macOS 10.5 and later, use this command (it will then relaunch on demand):
- sudo launchctl stop org.cups.cupsd
- sudo /System/Library/StartupItems/PrintingServices/PrintingServices restart
Gather Logs
Once you have enabled debug in CUPS, you will then need to reproduce the issue following any procedures requested by PaperCut Technical Support, then compress and email the /var/log/cups/error_log log file. By the way: your log files and other information you send to us will be treated with care in accordance with our privacy policy.