sodcalculator

10 Tech How-To

Fix CUPS Printer Errors & Clear Stuck Queue on Ubuntu

Guide 10-50758 · Updated · Step by step

If your Ubuntu machine shows a printer error like “Printer not connected” or a job stuck in the queue that won’t cancel, it’s usually a stalled CUPS service or a corrupted print job. This guide walks you through clearing the queue, restarting CUPS, and resolving common driver and connection errors—without needing to reinstall anything.

What You’ll Need

  • A user account with sudo privileges
  • Access to a terminal (Ctrl+Alt+T)
  • Your printer’s model name (optional, but helpful for driver fixes)

Step-by-Step

  1. Check the current queue status. Open a terminal and run lpstat -o. This lists all pending jobs. If you see jobs stuck in “processing” or “held”, note their job IDs (e.g., printer-123).
  2. Cancel all jobs with a single command. Run cancel -a to cancel every job on all printers. If that fails, try cancel -a printer-name (replace printer-name with the name from lpstat -p).
  3. Force-remove stuck jobs. If jobs remain, use lpstat -W not-completed to see them, then cancel individually with cancel job-id. For truly stubborn jobs, stop CUPS first: sudo systemctl stop cups, then delete the job cache files: sudo rm -f /var/spool/cups/* (this removes all pending jobs).
  4. Restart the CUPS service. Run sudo systemctl start cups (or sudo systemctl restart cups if it was already running). Then check status with systemctl status cups—it should show “active (running)”.
  5. Verify the printer is enabled and accepting jobs. Run cupsenable printer-name and cupsaccept printer-name. Then test with lp -d printer-name /etc/nsswitch.conf to print a test file.
  6. Check the error log if problems persist. Look at sudo tail -f /var/log/cups/error_log while trying to print. Common messages include “filter failed” (driver issue) or “connection refused” (network issue).
  7. Reinstall the printer driver if needed. Go to Settings → Printers, remove the printer, then add it again. For USB printers, unplug and replug after removal. For network printers, ensure the IP address is correct in the printer’s settings.
  8. As a last resort, purge and reinstall CUPS. Run sudo apt purge cups, then sudo apt install cups. This resets configuration, so back up any custom settings first.

Common Mistakes

  • Not using sudo for system commands. Commands like systemctl stop cups require admin rights; without sudo, they fail silently.
  • Deleting the wrong spool files. Removing files in /var/spool/cups is safe only when CUPS is stopped. Doing it while running can corrupt the queue.
  • Ignoring the printer’s own error state. If the printer shows “offline” on its display, no software fix will help. Check paper, ink, and physical connections first.
  • Assuming the queue is the only issue. A stuck job is often a symptom of a driver problem. If jobs fail immediately after clearing, focus on the driver.

Tips

  • Use the CUPS web interface. Open http://localhost:631 in a browser. You can manage printers, view jobs, and cancel them graphically—sometimes easier than the terminal.
  • Set a default printer. Run lpoptions -d printer-name to avoid sending jobs to the wrong device.
  • Enable debug logging. Run sudo cupsctl --debug-logging to get detailed logs in /var/log/cups/error_log. Turn it off later with sudo cupsctl --no-debug-logging.
  • Keep drivers updated. For many printers, the built-in driver in Ubuntu works fine. If not, check the manufacturer’s website for a Linux .deb package, but avoid generic “universal” drivers unless necessary.
  • Use a different driver as a test. In Printer Properties, try switching to a generic PostScript or PCL driver to see if the issue is driver-specific.

Troubleshooting

If the steps above don’t resolve the issue, here’s what to try next:

  • Job still stuck after cancel? Restart the printer itself (power off, wait 10 seconds, power on). This clears the printer’s internal memory, which can hold a job hostage.
  • “Filter failed” error? This usually means the driver is missing or broken. Reinstall the driver package, or try a different driver as mentioned. Also check if the printer is set to the correct model in Settings.
  • Network printer not found? Verify the printer’s IP address with ping printer-ip. If it doesn’t respond, the printer may be off or on a different subnet. Re-add the printer using its hostname instead of IP if possible.
  • CUPS won’t start? Run journalctl -u cups to see why. Common causes: corrupted configuration file (/etc/cups/cupsd.conf) or a port conflict. Rename the config file (sudo mv /etc/cups/cupsd.conf /etc/cups/cupsd.conf.bak) and restart—CUPS will create a default one.
  • Permission denied when deleting spool files? Ensure CUPS is stopped and you’re using sudo. If the directory is owned by another user, use sudo chown -R lp:lp /var/spool/cups to fix ownership.

Frequently Asked Questions

Why does my print queue get stuck so often?

Frequent stuck queues often point to a flaky network connection or a driver that crashes. Check the printer’s connection (USB or Wi-Fi) and consider updating the driver. Also, avoid sending large or complex PDFs that may overwhelm the printer’s memory.

Can I clear the queue without restarting CUPS?

Yes, cancel -a usually works without restarting. If jobs remain, you may need to stop CUPS to delete the spool files, but try the simple cancel first.

What does “printer is not responding” mean?

This means the computer can’t communicate with the printer. Check that the printer is powered on, connected to the network (if wireless), and that the USB cable is secure. Try pinging the printer’s IP address if it’s network-connected.

How do I reset the CUPS configuration to defaults?

You can rename the configuration files and restart CUPS: sudo mv /etc/cups/cupsd.conf /etc/cups/cupsd.conf.bak and sudo mv /etc/cups/printers.conf /etc/cups/printers.conf.bak, then sudo systemctl restart cups. This will create fresh defaults, but you’ll need to re-add your printers.

Is it safe to delete files in /var/spool/cups?

Yes, but only when CUPS is stopped. Those files are temporary print jobs. Deleting them while CUPS is running could cause errors, so always stop the service first.

Why does my printer work on Windows but not Ubuntu?

This is usually a driver issue. Windows has manufacturer-provided drivers, while Ubuntu relies on open-source drivers. Check if your printer is supported by the open-source driver project (most are). If not, you may need to install a proprietary driver from the manufacturer, or use a generic driver.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →