The Ghost in the Machine: Why CUPS Shows Offline Network Printers as Idle
In the Ubuntu printing ecosystem, the Common Unix Printing System (CUPS) acts as the primary spooler. A common and confusing behavior occurs when a network printer is physically powered off or disconnected, yet the CUPS web interface and Ubuntu system settings continue to report the status as "Idle" rather than "Offline". This happens because CUPS, by design, is a "stateless" spooler; it assumes a printer is ready to receive jobs until a connection attempt actually fails. This discrepancy often leads to "stuck" print jobs that sit in the queue indefinitely without triggering a system alert. This guide explains how to force CUPS to perform more aggressive status polling and correctly identify the device state.
Table of Content
- Purpose of Accurate Printer Status
- Common Use Cases
- Step-by-Step: Forcing Correct Status Reporting
- Best Results: DNS-SD vs. Fixed IP
- FAQ
- Disclaimer
Purpose
The primary purpose of this tutorial is to synchronize the Logical State of the printer in Ubuntu with its Physical State. By default, CUPS uses mDNS/Avahi (DNS-SD) for discovery. Once a printer is added, CUPS doesn't constantly "ping" the device to save network bandwidth. It only realizes the printer is gone when it tries to open a socket during a print task. We will modify the backend behavior to ensure that the user interface provides real-time feedback, preventing the frustration of sending documents to a non-existent device.
Use Case
This troubleshooting guide is essential for:
- Office Environments: Where multiple users share a network printer that may be turned off at night or go into deep sleep mode.
- Home Networking: Where printers are connected via Wi-Fi and frequently drop off the network due to signal interference.
- System Administrators: Who need to script alerts based on printer availability using the
lpstatcommand.
Step-by-Step
1. Check the Current Connection URI
CUPS handles status differently depending on the protocol used.
- Open your terminal and run:
lpstat -v. - If the URI starts with
dnssd://ormdns://, the status is managed by Avahi. If it starts withsocket://oripp://, it uses a direct connection.
2. Enable SNMP Backend Polling
CUPS can use Simple Network Management Protocol (SNMP) to query the printer's hardware status.
- Edit the SNMP configuration file:
sudo nano /etc/cups/snmp.conf. - Ensure the Address is set to
@LOCALor the specific IP of your printer. - Set the Community name (usually
public). - Restart CUPS:
sudo systemctl restart cups.
3. Switch to a Fixed IP Address
Automatic discovery (DNS-SD) is often the culprit for the "Ghost Idle" status. Switching to a direct Socket connection forces a more immediate timeout.
- Go to Settings > Printers or
http://localhost:631. - Modify the printer and change the connection string to:
socket://[Printer-IP-Address]:9100. - This removes the "discovery" layer and forces CUPS to verify the route to the specific IP.
4. Adjust the ErrorPolicy
Tell CUPS how to behave when it finds the printer is actually unreachable.
- In the
/etc/cups/printers.conffile, look for theErrorPolicyline. - Change
retry-jobtoabort-joborstop-printerif you want the status to change immediately upon failure.
Best Results
| Protocol | Status Accuracy | Stability |
|---|---|---|
| DNS-SD (mDNS) | Low (Relies on cache) | High (Easy setup) |
| AppSocket (HP JetDirect) | High (Instant timeout) | Very High (Best for Fixed IP) |
| IPP / IPPS | Medium (Depends on attributes) | High (Secure) |
FAQ
Why does 'lpstat' show the printer as idle?
lpstat queries the local CUPS scheduler, not the physical printer. If the last communication was successful, the scheduler remains in the "Idle" (waiting) state until the next communication attempt fails.
Will this fix 'Printer not found' errors?
It won't fix the underlying connection issue, but it will make Ubuntu tell you immediately that the printer is gone, rather than letting you send a document to a black hole.
Does the Avahi daemon affect this?
Yes. If avahi-daemon is lagging or its cache is stale, Ubuntu might think the printer is still "broadcasting" its presence when it is actually offline.
Disclaimer
Manually editing /etc/cups/printers.conf while the CUPS service is running can result in your changes being overwritten. Always stop the service with sudo systemctl stop cups before manual file edits. This guide is based on CUPS versions standard for Ubuntu 22.04 LTS and 24.04 LTS as of March 2026.
Tags: CUPS, UbuntuPrinting, NetworkPrinter, LinuxTroubleshooting
