Resume CUPS Printer command line CentOS 6

Resume CUPS Printer command line CentOS 6

In this scenario we have a printer that is “paused” in CUPS for one reason or another, and we need to be able to print to it again. Login to your CUPS server

CUPS pauses (disables) a queue on its own when the printer backend fails, for example when the printer is switched off, out of paper or unreachable on the network, because the default error policy is stop-printer. Jobs keep queuing but nothing prints until the queue is enabled again.

Prerequisites

  • Root access, or a user in the CUPS admin group (lpadmin on most current distributions), on the CUPS server.
  • The queue name of the printer. lpstat -p lists them all.
  • The cause fixed first: turn the printer on, clear the jam or reconnect the network, otherwise CUPS will pause the queue again on the next job.
Root shell prompt on the CUPS server ldap2

Step 1: check the printer state

from here do a lpstat -p (shows all printers even if disabled)

lpstat -p | grep PrinterName
lpstat -p | grep PrinterName to check a printer's state

in this case, the printer is “paused, or disabled”

lpstat -p output: printer LexmarkT520 disabled since Mon 17 Mar 2014

lpstat -p prints one line per queue with its state and the time it changed. lpstat -t shows everything at once, including whether each queue is accepting jobs.

Step 2: resume the printer

to resume the printer issue the following command:

cupsenable PrinterName
cupsenable PrinterName typed at the root prompt

as you can see once we run lpstat -p again, our printer is enabled

cupsenable LexmarkT520, then lpstat -p shows printer LexmarkT520 is idle, enabled

Any jobs waiting in the queue start printing as soon as the printer is enabled.

Step 3: restart CUPS

you should also do your due diligence and restart cups

service cups restart
service cups restart: Stopping cups OK, Starting cups OK

On CentOS/RHEL 7 and later, and AlmaLinux or Rocky Linux 8, 9 and 10, use systemctl restart cups. A restart is not required for cupsenable to work, but it is a harmless way to make sure the scheduler is healthy.

Paused versus rejecting jobs

CUPS has two separate switches. cupsenable/cupsdisable control whether a queue prints; cupsaccept/cupsreject control whether it accepts new jobs. If users get a “not accepting jobs” error, run cupsaccept PrinterName as well. To pause a printer on purpose and leave a note for other admins, use cupsdisable -r "toner replacement" PrinterName.

Stop the queue from pausing again

If a printer that is often switched off keeps getting disabled, change its error policy so CUPS retries instead of stopping the queue:

lpadmin -p PrinterName -o printer-error-policy=retry-job

The other policies are abort-job, retry-this-job and the default stop-printer.

Troubleshooting

  • The queue is disabled again right after cupsenable: the backend still cannot reach the printer. Check /var/log/cups/error_log and test the connection to the printer.
  • cupsenable: Forbidden or a permission error: run it as root or as a user in the CUPS admin group.
  • Jobs are stuck even though the printer is enabled: list them with lpstat -o and cancel a bad one with cancel followed by the job ID.

That’s it!

Hosted Linux Servers at www.zwiegnet.com/go

Related guides: Enable/Disable CUPS Printer | Share CUPS UNIX printer with Windows IPP

Leave a Reply

Your email address will not be published. Required fields are marked *