[Software] [SOLVED] Cancel -a fails to clear printer queue

If none of the specific sub-forums seem right for your thread, ask here.
Message
Author
Haines
Posts: 30
Joined: 2014-07-29 01:57
Been thanked: 1 time

[Software] [SOLVED] Cancel -a fails to clear printer queue

#1 Post by Haines »

For a new installation Debian I set up CUPS and printed a test page. However there are print jobs stuck in queue that prevent my use of the printer.

Code: Select all

    $ lpq
    Warning: no daemon present
     Rank   Owner      Job  Files                Total Size
     [2 jobs shown]

    $ clear -a

    [the jobs remain]
What daemon is referred to here? I guessed at this but had no luck:

Code: Select all

    # sudo systemctl restart cups
    # sudo systemctl restart lpd
Last edited by Haines on 2025-01-08 11:12, edited 2 times in total.

arzgi
Posts: 1777
Joined: 2008-02-21 17:03
Location: Finland
Has thanked: 1 time
Been thanked: 103 times

Re: [Software] Clear -a fails to clear printer queue

#2 Post by arzgi »

Can you tell the model and manufacturer of your printer?

NakedRider
Posts: 27
Joined: 2024-02-29 00:33
Been thanked: 3 times

Re: [Software] Clear -a fails to clear printer queue

#3 Post by NakedRider »

Did you try to restart CUPS?

User avatar
wizard10000
Global Moderator
Global Moderator
Posts: 1316
Joined: 2019-04-16 23:15
Location: southeastern us
Has thanked: 135 times
Been thanked: 235 times

Re: [Software] Clear -a fails to clear printer queue

#4 Post by wizard10000 »

Haines wrote: 2024-12-24 17:30$ clear -a

[the jobs remain]
The command to clear print queues is cancel -a.
we see things not as they are, but as we are.
-- anais nin

Haines
Posts: 30
Joined: 2014-07-29 01:57
Been thanked: 1 time

Re: [Software] Clear -a fails to clear printer queue

#5 Post by Haines »

My printer is HP LaserJet Pro MFP M428fdw

Yes I restarted CUPS

When I do $ lpq -a I'm told this:

Code: Select all

lp:
Warning: no daemon present
What daemon is here referred to?

That "$ clear -a" was a typo. When I run $ cancel -a there is no feedback and the jobs in queue are not removed.

arzgi
Posts: 1777
Joined: 2008-02-21 17:03
Location: Finland
Has thanked: 1 time
Been thanked: 103 times

Re: [Software] Clear -a fails to clear printer queue

#6 Post by arzgi »


Haines
Posts: 30
Joined: 2014-07-29 01:57
Been thanked: 1 time

Re: [Software] Clear -a fails to clear printer queue

#7 Post by Haines »

No, printer supports wifeless but is actually wired.

arzgi
Posts: 1777
Joined: 2008-02-21 17:03
Location: Finland
Has thanked: 1 time
Been thanked: 103 times

Re: [Software] Clear -a fails to clear printer queue

#8 Post by arzgi »

CUPS ppds are to be removed and I think wireless is easier to set up.

But if you insist using wire, install hplip. Nice typo 'wifeless printer' :mrgreen: I do typos all the time, so don't upset!

Haines
Posts: 30
Joined: 2014-07-29 01:57
Been thanked: 1 time

Re: [Software] Clear -a fails to clear printer queue

#9 Post by Haines »

The hplip package was already installed.

Wireless easier to set up? I looked at the documentation and was a bit overwhelmed. So many choices! I'd like several machines to access my printer, including my wife's Mac and a Windows machines. How do I know if my printer supports IPP Everywhere? I'm told that a CUPS generated PPD uses the everywhere model and can be identified from the *PCFileName "ippeve.ppd" line in the PPD. Where is this PPD?

Why do I need a driverless print queue? I'm told to get the URI of the printer. It is ipps://HP%20LaserJet%20Pro%20M428f-M429f%20%5B8264A8%5D._ipps._tcp.local/. And then set up the print queue with $ lpadmin -p <print_queue_name> -v <URI> -E -m everywhere.
Is this all there is to set up wireless printing?

arzgi
Posts: 1777
Joined: 2008-02-21 17:03
Location: Finland
Has thanked: 1 time
Been thanked: 103 times

Re: [Software] Clear -a fails to clear printer queue

#10 Post by arzgi »

Check your username is lpadmin groups

Code: Select all

arto@dell:~$ groups
arto adm dialout cdrom floppy sudo audio dip video plugdev users netdev bluetooth
arto@dell:~$ 
I have not, since this is my laptop, I print over wifi.

Then in browser, open localhost:631 add / select you printer, make it as server default.

And you have to decice, which one will you use. Well I can give a bit back, if you have not used wireiess priting, make it firs wiredt. Then study on your own time the wireless setup, you said you have to share the printer to many computers, I thend to think wireless in those cases the ritght way to go.

Haines
Posts: 30
Joined: 2014-07-29 01:57
Been thanked: 1 time

Re: [Software] Clear -a fails to clear printer queue

#11 Post by Haines »

Thanks, arzgi. I was already in lpadmin group. I made my printer server default. but I presume this is to enable wireless printing. In any case,
$ cancel -a has no effect. $ lpq still tells me no daemon is present. I restarted cups and lpd to no effect. What daemon is lpq referring to?

Aki
Global Moderator
Global Moderator
Posts: 4262
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 124 times
Been thanked: 576 times

Re: [Software] Clear -a fails to clear printer queue

#12 Post by Aki »

Haines wrote: 2024-12-26 19:34 $ lpq still tells me no daemon is present. I restarted cups and lpd to no effect. What daemon is lpq referring to?
The lpq command from cups-bsd package [1] interacts with the cups server using a unix socket named /run/cups/cups.sock.

You can verify with the following command (the strace package must be installed):

Code: Select all

strace -o log.txt lpq
The log.txt file will store the OS systems calls invoked.

Therefore, it is possible that the cups server is not answering to the lpq program. Is the cups server running ? What is its status ? You can verify with the following command:

Code: Select all

$ sudo systemctl status cups
Hope this helps.

--
[1] Package: cups-bsd (2.4.2-3+deb12u8) Common UNIX Printing System™ - comandi BSD
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

Haines
Posts: 30
Joined: 2014-07-29 01:57
Been thanked: 1 time

Re: [Software] Clear -a fails to clear printer queue

#13 Post by Haines »

Code: Select all

$ strace -o log.txt lpq
Warning: no daemon present
Rank   Owner      Job  Files 
Where is the lpq log fiie? locate finds hundreds of log.txt files (many backups accessible)

Code: Select all

$ sudo systemctl status cups
● cups.service - CUPS Scheduler
     Loaded: loaded (/lib/systemd/system/cups.service; enabled; preset: enabled)
     Active: active (running) since Thu 2024-12-26 00:00:02 EST; 15h ago
TriggeredBy: ○ cups.path
             ● cups.socket
       Docs: man:cupsd(8)
   Main PID: 943821 (cupsd)
     Status: "Scheduler is running..."
      Tasks: 1 (limit: 18965)
     Memory: 3.0M
        CPU: 136ms
     CGroup: /system.slice/cups.service
             └─943821 /usr/sbin/cupsd -l

Dec 26 00:00:02 iskra systemd[1]: Starting cups.service - CUPS Scheduler...
Dec 26 00:00:02 iskra systemd[1]: Started cups.service - CUPS Scheduler.
Dec 26 14:27:23 iskra cupsd[943821]: pam_unix(cups:auth): authentication failure; logname= uid=0 euid=0 tty=cups ruser= rhost=localhost  
  user=haines
I'm successfully logged into CUPS because I just set my printer to server-default. I'm unclear where the authentication failure occurs.

Aki
Global Moderator
Global Moderator
Posts: 4262
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 124 times
Been thanked: 576 times

Re: [Software] Clear -a fails to clear printer queue

#14 Post by Aki »

Hello,
Haines wrote: 2024-12-26 21:11

Code: Select all

$ strace -o log.txt lpq
Warning: no daemon present
Rank   Owner      Job  Files  
Where is the lpq log fiie? locate finds hundreds of log.txt files (many backups accessible)
The log file with the name log.txt is located in the same directory in which the command was executed.
Haines wrote: 2024-12-26 21:11

Code: Select all

$ sudo systemctl status cups
● cups.service - CUPS Scheduler
     Loaded: loaded (/lib/systemd/system/cups.service; enabled; preset: enabled)
     Active: active (running) since Thu 2024-12-26 00:00:02 EST; 15h ago
TriggeredBy: ○ cups.path
             ● cups.socket
       Docs: man:cupsd(8)
   Main PID: 943821 (cupsd)
     Status: "Scheduler is running..."
      Tasks: 1 (limit: 18965)
     Memory: 3.0M
        CPU: 136ms
     CGroup: /system.slice/cups.service
             └─943821 /usr/sbin/cupsd -l

Dec 26 00:00:02 iskra systemd[1]: Starting cups.service - CUPS Scheduler...
Dec 26 00:00:02 iskra systemd[1]: Started cups.service - CUPS Scheduler.
Dec 26 14:27:23 iskra cupsd[943821]: pam_unix(cups:auth): authentication failure; logname= uid=0 euid=0 tty=cups ruser= rhost=localhost  
  user=haines
[..] I'm unclear where the authentication failure occurs.
You may search system logs for more clues.

According to:

Code: Select all

Dec 26 14:27:23 iskra cupsd[943821]: pam_unix(cups:auth): authentication failure; logname= uid=0 euid=0 tty=cups ruser= rhost=localhost user=haines
the pam_unix module called by cups daemon does not authenticate your user name.

Can you please report more information about your Debian installation and CUPS installation ?

--
note:
1) please, use code tags to include commands and/or their logs in the body of a message; I fixed for you in the previous message. Thanks.
2) please update the subject of the first message with the correct command (cancel instead of clear)
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

Haines
Posts: 30
Joined: 2014-07-29 01:57
Been thanked: 1 time

Re: [Software] Cancel -a fails to clear printer queue

#15 Post by Haines »

The $ strace -o log.txt lpq produced copious output. Some files in /etc missing, but they were commented witn "F_OK". I note these lines"

Code: Select all

setresgid(-1, 1000, -1)                 = 0
openat(AT_FDCWD, "lock", O_RDONLY|O_NONBLOCK|O_NOFOLLOW) = -1 EACCES (Permission denied)	
...
setresuid(-1, 1000, -1)                 = 0
newfstatat(1, "", {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x13), ...}, AT_EMPTY_PATH) = 0
write(1, "Warning: no daemon present\n", 27) = 27
...
[the permission denied message is repeated several times.]
I did a netinst of Debian on an SSD. Ten partitions (/var/mail broken out). Mail system not sending or receiving (no time yet to fix) and lualatex command does not work (default lmroman font missing) . What is really a problem is that log files are missing in /var/log (no daemon.log, debug, dmesg, fsck, kern.log, mail.err, mail.info. mail.log, mail.warn, messages, pgcarts, syslog, systat, user.log). Nevertheless root can somehow view dmesg. At its end is:

Code: Select all

[823613.994060] ieee80211 phy0: Hardware restart was requested
[825192.091836] audit: type=1400 audit(1735275602.309:23): apparmor="DENIED" operation="capable" profile="/usr/sbin/cupsd" pid=1000201 comm="cupsd" capability=12  capname="net_admin"
I looked at what logs there were after both root and user ran cancel -a. In the /var/log/cups/localhost file:

Code: Select all

	    localhost - - [27/Dec/2024:05:39:07 -0500] "POST /admin/ HTTP/1.1" 401 161
      Cancel-Jobs successful-ok
    localhost - root [27/Dec/2024:05:39:07 -0500] "POST /admin/ HTTP/1.1"
    200 161 Cancel-Jobs successful-ok
In fact $ lpq tells me the $ cancel -a command was not successful. There was nothing in /var/log/cups/error-log or lp-errors.

Aki
Global Moderator
Global Moderator
Posts: 4262
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 124 times
Been thanked: 576 times

Re: [Software] Cancel -a fails to clear printer queue

#16 Post by Aki »

Hello,
Haines wrote: 2024-12-27 12:14 The $ strace -o log.txt lpq produced copious output [..]
You can report logs in one of the following ways:
  • attaching the logs to a follow-up forum message as a compressed zip or gz file
  • paste logs into the body of a follow-up message between code tags (if they fit the size of a forum message)
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

Haines
Posts: 30
Joined: 2014-07-29 01:57
Been thanked: 1 time

Re: [Software] Cancel -a fails to clear printer queue

#17 Post by Haines »

The command $ strace -o log.txt no longer has any return and so there is nothing to paste :

Code: Select all

$ strace -o log.txt lpq
Warning: no daemon present
Rank   Owner    Job  Files  Total Size
The command cancel -a has no effect, but I discover the command $ lprm haines that does
remove my jobs, and so I was able to clear the queue successfully. However when I
do $ lpr test.txt. the job gets stuck in the queue:

Code: Select all

$ lpq
Warning: no daemon present
Rank   Owner      Job  Files             Total Size
1st    haines      10   test.txt           5 bytes
There is some ambiguity about my printer name. Its actual name is "HP
LaserJet Pro MFP M428fdw", but that did not appear on list of printers.
When I installed the printer I chose the closest one I would,
HP_LaserJet_Pro_M428f-M429f. However it seems that the choice
works:

Code: Select all

$ lpstat -p -d
printer HP_LaserJet_Pro_M428f-M429f is idle.  enabled since
Tue 24 Dec 2024 12:05:37 PM EST system default destination:
HP_LaserJet_Pro_M428f-M429f

Aki
Global Moderator
Global Moderator
Posts: 4262
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 124 times
Been thanked: 576 times

Re: [Software] Cancel -a fails to clear printer queue

#18 Post by Aki »

Haines wrote: 2024-12-31 13:03 The command $ strace -o log.txt no longer has any return and so there is nothing to paste :

Code: Select all

$ strace -o log.txt lpq
Warning: no daemon present
Rank   Owner    Job  Files  Total Size
The output of the command strace, as already suggested, is in the log.txt file generated by the command, it is not printed on the console.
Haines wrote: 2024-12-31 13:03 I discover the command $ lprm haines that does
remove my jobs, and so I was able to clear the queue successfully.

However when I
do $ lpr test.txt. the job gets stuck in the queue
What are the installed packages supplying lpqrm lprm? You can check with:

Code: Select all

apt list cups cups-client lpr lprng hplip
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

Haines
Posts: 30
Joined: 2014-07-29 01:57
Been thanked: 1 time

Re: [Software] Cancel -a fails to clear printer queue

#19 Post by Haines »

I don't understand your question. Is it what installs lprm or what installs lpqrm? I don't see how to check the origin of lprm
with the apt list command. What it returns is simply the version and status of the packages. The lprm command appeared
in 3.0BSD. But neither bsdutils nor bsdextrautils dragged it in.

Aki
Global Moderator
Global Moderator
Posts: 4262
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 124 times
Been thanked: 576 times

Re: [Software] Cancel -a fails to clear printer queue

#20 Post by Aki »

Haines wrote: 2024-12-31 18:31 I don't understand your question. Is it what installs lprm or what installs lpqrm?
lpqrm was a typo. Thanks for pointing that out. I have corrected it in my previous post. The suggestion in my previous post still stands.
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

Post Reply