DebuggingPrintingProblems

Differences between revisions 3 and 58 (spanning 55 versions)
Revision 3 as of 2007-02-19 09:44:47
Size: 1004
Editor: 86-39-13-120
Comment:
Revision 58 as of 2010-10-07 14:16:53
Size: 11704
Editor: p5DDB9F5B
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
== I. Printer detection == <<Include(Debugging/Header)>>
||<tablestyle="float:right; font-size: 0.9em; width:30%; background:#F1F1ED; background-image: url('https://librarian.launchpad.net/1812570/bugsquad.png'); background-repeat: no-repeat; background-position: 98% 0.5ex; margin: 0 0 1em 1em; padding: 0.5em;"><<TableOfContents>>||

= Reporting Bugs =

Beginning with 9.04, Jaunty Jackalope, to report printing bugs use 'ubuntu-bug cups' which will gather useful information about your system related to printing like the version of Ubuntu you use, configured printers and the versions of important printing packages installed and automatically attach them to your bug report. You can also add the information after the bug is reported by executing 'apport-collect -p cups BUGNUMBER' where BUGNUMBER is the bug report you want to add information to.

In releases 8.10, Intrepid Ibex, and older, attach to your bug report the output of the printingbuginfo script located at: https://wiki.ubuntu.com/PrintingBugInfoScript. It manually collects the same information that is collected in the cups apport hook, used by ubuntu-bug and apport-collect above.

Starting with Intrepid the '''cupsys''' package has been renamed to '''cups'''. Subsequently, bugs about Intrepid (8.10) and newer releases should be assigned to the '''cups''' package and bug reports about previous releases should be assigned to '''cupsys'''.

= Printer detection =

== USB printer ==
Line 3: Line 17:
 2. Unplug the printer cable from your computer, open a terminal/console and enter this command: [[BR]] {{{$ tail -f /var/log/messages | tee ~/messages.log}}}
 3. Find out if your printer gets detected by CUPS: [[BR]] {{{$ lpinfo -v | tee lpinfo.txt}}}
 2. Open a terminal/console and check if the usb kernel modules are loaded: <<BR>> {{{$ lsmod | grep usb}}}
 3. Unplug the USB printer cable from your computer and enter this command: <<BR>> {{{$ tail -f /var/log/messages }}}
 4. Reconnect the USB printer cable, you should see some messages appearing.
 5. Press Ctrl-C to stop the logging.
 6. Check whether the printer gets correctly detected by the USB subsystem and determine its USB vendor/product IDs and the USB bus and device addresses: <<BR>> {{{$ lsusb}}} <<BR>> Note: The USB bus and device addresses change if you turn off or unplug the printer. Please re-run this command if needed.
 7. Check whether the device files for the printer get created and the ownerships ("root lp") and permissions (non-HP: "crw-rw-r--", HP: "crw-rw-r--+") correctly set: <<BR>> {{{$ ls -l /dev/usb/lp* /dev/bus/usb/*/*}}}
 8. Determine the printer's device ID strings: <<BR>> {{{$ sudo usb_printerid /dev/usb/lp0}}} <<BR>> {{{$ sudo usb_printerid /dev/usb/lp1}}} <<BR>> {{{...}}} <<BR>> For HP printers also use <<BR>> {{{$ hp-info -i}}} <<BR>> and choose the printer with the problem from the text menu, then copy the "deviceid" entry from the output (can be several lines).
 9. For HP printers: Check whether HPLIP connects to them: <<BR>> {{{$ hp-makeuri <Bus>:<Device>}}} <BR> Replace "<Bus>" and "<Device>" by the bus and device numbers from the "lsusb" output (not vendor and product ID). The numbers must be supplied with three digits, zero-padded from the left, like "008:015".
 9. Find out if your printer gets detected by CUPS: <<BR>> {{{$ lpinfo -v}}}
 10. Attach the output of the above commands to the bug report.
Line 6: Line 28:
== II. Printingbuginfo ==
Attach the output of the printingbuginfo script for some useful information related to printing about your system like the version of Ubuntu you use, configured printers and the versions of important printing packages installed. The printingbuginfo script can be found here: https://wiki.ubuntu.com/PrintingBugInfoScript.
Note that problems cannot only caused by CUPS but also by the kernel (package "linux"), libusb, HPLIP (package "hplip"), and several third-party printer drivers.
Line 9: Line 30:
== III. CUPS error_log ==
 1. Edit the file /etc/cups/cupsd.conf, find the section "loglevel" and change "info" to "debug", save the file.
 2. Restart CUPS: [[BR]] {{{$ sudo /etc/init.d/cupsys restart}}}
 3. Try to print something.
 4. Attach /var/log/cups/error_log to the bug report.
== Parallel port printer ==

 1. Make sure that the printer is connected to your system and powered on.
 2. Open a terminal/console and check if the lp, ppdev, and parport_pc kernel modules are loaded: <<BR>> {{{$ lsmod | grep lp}}} <<BR>> {{{$ lsmod | grep ppdev}}} <<BR>> {{{$ lsmod | grep parport_pc}}}
 3. Check if the kernel detected the parallel port during bootup: <<BR>> {{{$ dmesg | grep par }}}
 4. Find out if your printer gets detected by CUPS: <<BR>> {{{$ lpinfo -v}}}
 5. Attach the output of the above commands to the bug report.

Note that problems cannot only caused by CUPS but also by the kernel (package "linux"), HPLIP (package "hplip"), and several third-party printer drivers.

= CUPS web interface =

The CUPS web interface at [[http://127.0.0.1:631/]] provides some useful messages and diagnostic capabilities.

= CUPS error_log =
This is a file where CUPS writes information about what it is doing. Almost all printing problems can be diagnosed from the error log, so it is the first place to look to start solving problems. To be useful, you must change the logging level: <<BR>>
 1. In Ubuntu Gutsy or newer, select "System" -> "Administration" -> "Printing" in the main menu of your desktop. The printer setup tool system-config-printer will open. Select "Server Settings" in the list on the left. Then check the checkbox "Save debugging information for troubleshooting" and click "Apply".
 2. In all Ubuntu flavors (also Kubuntu and server editions) you can run <<BR>> {{{$ cupsctl LogLevel=debug}}} <<BR>> to activate debug logging.
 3. In Karmic and later (CUPS 1.4.x) there is an automatic debug logging only for failed print jobs. So if you problem was a failed print job, the error_log can already contain the desired information. Unfortunately, only 200 debug message lines get logged per failed job. Run the command <<BR>> {{{$ cupsctl LogDebugHistory=999999}}} <<BR>> for practically unlimited logging of failed jobs.
 4. In older versions of all flavors, where there is not yet a "cupsctl" command, edit the file {{{/etc/cups/cupsd.conf}}}, find the line '''Log``Level ...''' and change it to '''Log``Level debug''', save the file. Then restart CUPS: <<BR>> {{{$ sudo /etc/init.d/cupsys restart}}}
 5. Clear the queue from any stuck jobs by deleting the jobs in the job viewer or running the "{{{cancel -a}}}" command.
 6. Try to print something. Wait until the job disappears from the queue or turns into "Stopped" state, independent whether something gets out of the printer. If the job never reaches "Stopped" state after the printer not showing any reaction for a longer time you also can go on to the next step.
 7. Scan or photograph the printout if it is not correct and attach the images to the bug report.
 8. Add {{{/var/log/cups/error_log}}} as an attachment to the bug report. Note that the file is not accessible for normal users. From Jaunty on you can access it from the account of the first user set up (in general users in the "adm" group). Otherwise you need to access it as root. To view the file run <<BR>> {{{$ sudo less /var/log/cups/error_log}}} <<BR>> and to copy it for attaching to a bug report run <<BR>> {{{$ sudo cp /var/log/cups/error_log ~}}} <<BR>> {{{$ sudo chmod 777 ~/error_log}}}

= Troubleshooting Wizard =

There is a troubleshooting wizard in system-config-printer (System -> Administration -> Printing). You find it by in the "Help" menu of system-config-printer. It produces a text file with a lot of useful information to attach to bug reports. Follow the instructions of the wizard. If you reach the test page step, you can either click the button to print the test page or you can print a job to the selected printer from any application or from the command line. The job will be shown in the integrated job viewer. Wait until it completes or goes into "Stopped" state. ONLY THEN AND NOT BEFORE mark the checkbox at the job, answer whether the job got printed correctly, and click "Forward". After that the file will get generated. Save it and attach it to your bug report.

= Print Error pop-up window =

If a print job fails, a job viewer with the failed job ("Stopped" state) and pop-up window telling that the job has problems will appear. If you click the "Diagnose" button, the troubleshooting wizard will open. Do not delete the job before having completed the wizard. Take care to choose the printer with which the problem occured. In the "Test Page" step you do not need to print anything, nor to wait. Mark the stopped job in the integrated job viewer, click "No" at the question and then "Forward". After that save the file and attach it to the bug report.

= AppArmor Protection of the printing system =
From Gutsy on the security of the CUPS printing system is improved by using App``Armor. Unfortunately, the configuration is not perfect yet, especially if third-party printer drivers are used. If you have any problems with printing, try deactivating the App``Armor protection with {{{sudo aa-complain cupsd}}}. If this helps, look for messages containing '''audit''' in the {{{/var/log/messages}}} file. These show which components are accessed by the printing system for which there is no explicit permission given in {{{/etc/apparmor.d/usr.sbin.cupsd}}}. You can re-activate App``Armor via {{{sudo aa-enforce cupsd}}}. Report a bug, about the package '''cups''' ('''cupsys''' on 8.04 and older), so that we can correct the default configuration of App``Armor.

= Capturing print job data =
Often it is needed to find out what actually got sent to the printer in order to determine whether the problem is caused by the application or by the printing subsystem. For that it is the easiest way to capture the job data from the application so that it can analyzed whether it is already broken or not. To do so, follow these steps: <<BR>>

 1. Clear the print queues from old jobs. Either use the job viewer or run the command <<BR>> {{{$ cancel -a}}} <<BR>> in a terminal window.
 2. Disable the print queue with which you have the problem. Use system-config-printer (System -> Administration -> Printing), right-click the appropriate printer icon, and click "Enabled" in the pop-up menu, so that the check mark disappears or run the command <<BR>> {{{$ cupsdisable <PRINTER>}}} <<BR>> in a terminal window (Replace "<PRINTER>" by the name of the print queue). This makes jobs staying in the queue so that you can capture them.
 3. Now print the job from your application. When the application has finished sending the job, check via the job viewer or the command <<BR>> {{{$ lpstat -o}}} <<BR>> whether it is in the queue.
 4. Display the content of CUPS' spool directory using the command <<BR>> {{{$ sudo ls -1 /var/spool/cups}}} <<BR>> (Enter your password when getting asked).
 5. There should be exactly one file beginning with a "d". Copy this file to your home directory: <<BR>> {{{$ sudo cp /var/spool/cups/d... ~/printout}}} <<BR>> {{{$ sudo chmod 777 ~/printout}}}
 6. Re-enable the print queue: <<BR>> {{{$ cupsenable <PRINTER>}}} <<BR>>
 7. If the file gets correctly printed now, try the above procedure with another file, we need a file where the problem occurs.
 8. Check via the command <<BR>> {{{$ file ~/printout}}} <<BR>> what format the file is. It is usually PDF or PostScript. Display the file on the screen to see whether the problem already occurs (error message, missing characters, wrong colors, ...). If you see the problem already, the application is the culprit, assign your bug report to the application's package, otherwise assign it to the "cups" package.
 9. Attach the original file of your application and the ~/printout file to your bug report.

= Known bugs =

Description of known issues, how to recognise them and stock responses/actions.

## '''Open'''
##||<rowbgcolor="#eeeeee"> '''Bug#''' || '''Description''' || '''Action''' ||
##|| [[https://bugs.launchpad.net/ubuntu/+source/cupsys/+bug/29050|29050]] || Parallel/LPT printer not detected in Dapper and Edgy. Fixed in Feisty. || add "ppdev" to {{{/etc/modules}}} ||

## '''Closed'''
## ||<rowbgcolor="#eeeeee"> '''Bug#''' || '''Description''' || '''Action''' ||
## || TBD. || TBD. || TBD. ||

----
 * [[/PageDiscussion|Discuss this page]]
CategoryBugSquad CategoryDebugging

Debugging Central

This page is part of the debugging series — pages with debugging details for a variety of Ubuntu packages.

Reporting Bugs

Beginning with 9.04, Jaunty Jackalope, to report printing bugs use 'ubuntu-bug cups' which will gather useful information about your system related to printing like the version of Ubuntu you use, configured printers and the versions of important printing packages installed and automatically attach them to your bug report. You can also add the information after the bug is reported by executing 'apport-collect -p cups BUGNUMBER' where BUGNUMBER is the bug report you want to add information to.

In releases 8.10, Intrepid Ibex, and older, attach to your bug report the output of the printingbuginfo script located at: https://wiki.ubuntu.com/PrintingBugInfoScript. It manually collects the same information that is collected in the cups apport hook, used by ubuntu-bug and apport-collect above.

Starting with Intrepid the cupsys package has been renamed to cups. Subsequently, bugs about Intrepid (8.10) and newer releases should be assigned to the cups package and bug reports about previous releases should be assigned to cupsys.

Printer detection

USB printer

  1. Make sure that the printer is connected to your system and powered on.
  2. Open a terminal/console and check if the usb kernel modules are loaded:
    $ lsmod | grep usb

  3. Unplug the USB printer cable from your computer and enter this command:
    $ tail -f /var/log/messages 

  4. Reconnect the USB printer cable, you should see some messages appearing.
  5. Press Ctrl-C to stop the logging.
  6. Check whether the printer gets correctly detected by the USB subsystem and determine its USB vendor/product IDs and the USB bus and device addresses:
    $ lsusb
    Note: The USB bus and device addresses change if you turn off or unplug the printer. Please re-run this command if needed.

  7. Check whether the device files for the printer get created and the ownerships ("root lp") and permissions (non-HP: "crw-rw-r--", HP: "crw-rw-r--+") correctly set:
    $ ls -l /dev/usb/lp* /dev/bus/usb/*/*

  8. Determine the printer's device ID strings:
    $ sudo usb_printerid /dev/usb/lp0
    $ sudo usb_printerid /dev/usb/lp1
    ...
    For HP printers also use
    $ hp-info -i
    and choose the printer with the problem from the text menu, then copy the "deviceid" entry from the output (can be several lines).

  9. For HP printers: Check whether HPLIP connects to them:
    $ hp-makeuri <Bus>:<Device> <BR> Replace "<Bus>" and "<Device>" by the bus and device numbers from the "lsusb" output (not vendor and product ID). The numbers must be supplied with three digits, zero-padded from the left, like "008:015".

  10. Find out if your printer gets detected by CUPS:
    $ lpinfo -v

  11. Attach the output of the above commands to the bug report.

Note that problems cannot only caused by CUPS but also by the kernel (package "linux"), libusb, HPLIP (package "hplip"), and several third-party printer drivers.

Parallel port printer

  1. Make sure that the printer is connected to your system and powered on.
  2. Open a terminal/console and check if the lp, ppdev, and parport_pc kernel modules are loaded:
    $ lsmod | grep lp
    $ lsmod | grep ppdev
    $ lsmod | grep parport_pc

  3. Check if the kernel detected the parallel port during bootup:
    $ dmesg | grep par 

  4. Find out if your printer gets detected by CUPS:
    $ lpinfo -v

  5. Attach the output of the above commands to the bug report.

Note that problems cannot only caused by CUPS but also by the kernel (package "linux"), HPLIP (package "hplip"), and several third-party printer drivers.

CUPS web interface

The CUPS web interface at http://127.0.0.1:631/ provides some useful messages and diagnostic capabilities.

CUPS error_log

This is a file where CUPS writes information about what it is doing. Almost all printing problems can be diagnosed from the error log, so it is the first place to look to start solving problems. To be useful, you must change the logging level:

  1. In Ubuntu Gutsy or newer, select "System" -> "Administration" -> "Printing" in the main menu of your desktop. The printer setup tool system-config-printer will open. Select "Server Settings" in the list on the left. Then check the checkbox "Save debugging information for troubleshooting" and click "Apply".

  2. In all Ubuntu flavors (also Kubuntu and server editions) you can run
    $ cupsctl LogLevel=debug
    to activate debug logging.

  3. In Karmic and later (CUPS 1.4.x) there is an automatic debug logging only for failed print jobs. So if you problem was a failed print job, the error_log can already contain the desired information. Unfortunately, only 200 debug message lines get logged per failed job. Run the command
    $ cupsctl LogDebugHistory=999999
    for practically unlimited logging of failed jobs.

  4. In older versions of all flavors, where there is not yet a "cupsctl" command, edit the file /etc/cups/cupsd.conf, find the line LogLevel ... and change it to LogLevel debug, save the file. Then restart CUPS:
    $ sudo /etc/init.d/cupsys restart

  5. Clear the queue from any stuck jobs by deleting the jobs in the job viewer or running the "cancel -a" command.

  6. Try to print something. Wait until the job disappears from the queue or turns into "Stopped" state, independent whether something gets out of the printer. If the job never reaches "Stopped" state after the printer not showing any reaction for a longer time you also can go on to the next step.
  7. Scan or photograph the printout if it is not correct and attach the images to the bug report.
  8. Add /var/log/cups/error_log as an attachment to the bug report. Note that the file is not accessible for normal users. From Jaunty on you can access it from the account of the first user set up (in general users in the "adm" group). Otherwise you need to access it as root. To view the file run
    $ sudo less /var/log/cups/error_log
    and to copy it for attaching to a bug report run
    $ sudo cp /var/log/cups/error_log ~
    $ sudo chmod 777 ~/error_log

Troubleshooting Wizard

There is a troubleshooting wizard in system-config-printer (System -> Administration -> Printing). You find it by in the "Help" menu of system-config-printer. It produces a text file with a lot of useful information to attach to bug reports. Follow the instructions of the wizard. If you reach the test page step, you can either click the button to print the test page or you can print a job to the selected printer from any application or from the command line. The job will be shown in the integrated job viewer. Wait until it completes or goes into "Stopped" state. ONLY THEN AND NOT BEFORE mark the checkbox at the job, answer whether the job got printed correctly, and click "Forward". After that the file will get generated. Save it and attach it to your bug report.

Print Error pop-up window

If a print job fails, a job viewer with the failed job ("Stopped" state) and pop-up window telling that the job has problems will appear. If you click the "Diagnose" button, the troubleshooting wizard will open. Do not delete the job before having completed the wizard. Take care to choose the printer with which the problem occured. In the "Test Page" step you do not need to print anything, nor to wait. Mark the stopped job in the integrated job viewer, click "No" at the question and then "Forward". After that save the file and attach it to the bug report.

AppArmor Protection of the printing system

From Gutsy on the security of the CUPS printing system is improved by using AppArmor. Unfortunately, the configuration is not perfect yet, especially if third-party printer drivers are used. If you have any problems with printing, try deactivating the AppArmor protection with sudo aa-complain cupsd. If this helps, look for messages containing audit in the /var/log/messages file. These show which components are accessed by the printing system for which there is no explicit permission given in /etc/apparmor.d/usr.sbin.cupsd. You can re-activate AppArmor via sudo aa-enforce cupsd. Report a bug, about the package cups (cupsys on 8.04 and older), so that we can correct the default configuration of AppArmor.

Capturing print job data

Often it is needed to find out what actually got sent to the printer in order to determine whether the problem is caused by the application or by the printing subsystem. For that it is the easiest way to capture the job data from the application so that it can analyzed whether it is already broken or not. To do so, follow these steps:

  1. Clear the print queues from old jobs. Either use the job viewer or run the command
    $ cancel -a
    in a terminal window.

  2. Disable the print queue with which you have the problem. Use system-config-printer (System -> Administration -> Printing), right-click the appropriate printer icon, and click "Enabled" in the pop-up menu, so that the check mark disappears or run the command
    $ cupsdisable <PRINTER>
    in a terminal window (Replace "<PRINTER>" by the name of the print queue). This makes jobs staying in the queue so that you can capture them.

  3. Now print the job from your application. When the application has finished sending the job, check via the job viewer or the command
    $ lpstat -o
    whether it is in the queue.

  4. Display the content of CUPS' spool directory using the command
    $ sudo ls -1 /var/spool/cups
    (Enter your password when getting asked).

  5. There should be exactly one file beginning with a "d". Copy this file to your home directory:
    $ sudo cp /var/spool/cups/d... ~/printout
    $ sudo chmod 777 ~/printout

  6. Re-enable the print queue:
    $ cupsenable <PRINTER>

  7. If the file gets correctly printed now, try the above procedure with another file, we need a file where the problem occurs.
  8. Check via the command
    $ file ~/printout
    what format the file is. It is usually PDF or PostScript. Display the file on the screen to see whether the problem already occurs (error message, missing characters, wrong colors, ...). If you see the problem already, the application is the culprit, assign your bug report to the application's package, otherwise assign it to the "cups" package.

  9. Attach the original file of your application and the ~/printout file to your bug report.

Known bugs

Description of known issues, how to recognise them and stock responses/actions.


CategoryBugSquad CategoryDebugging

DebuggingPrintingProblems (last edited 2018-07-03 19:37:28 by vorlon)