Public bug reported:

Package: cups-daemon
Version: 2.4.7-1.2ubuntu7.14
OS: Ubuntu 24.04 LTS (via Linux Mint 22.3)

Description
-----------
/etc/logrotate.d/cups-daemon does a full CUPS restart in its postrotate
script:

    postrotate
        invoke-rc.d --quiet cups restart > /dev/null
    endscript

When logrotate runs (daily, around midnight) this fully stops and starts
cupsd. The scheduler socket is recreated and cups-browsed re-creates its
queues. Any long-running application that cached the printer list at
startup (or holds an open connection to cupsd) is then left with a stale
reference: the printer disappears from the print dialog or the print
button is grayed out. So printing fails until the application is restarted.

This is easy to hit with long-lived desktop apps, especially if a Flatpak
build is used, which bundles their own CUPS client libraries. It is not
Flatpak-specific, though: any application left running across the nightly
rotation can be affected.

Steps to reproduce
------------------
1. Start an application and open its print dialog; confirm the printer
   is listed.
2. Force the CUPS log rotation:
       sudo logrotate -f /etc/logrotate.d/cups-daemon
3. Without restarting the application, open the print dialog again.

Expected: the printer is still available and the print button is active.
Actual:   the printer is gone or the print button is grayed out - until
the application is restarted.

Suggested fix
-------------
Replace "restart" with "reload" in the postrotate script:

    postrotate
        invoke-rc.d --quiet cups reload > /dev/null
    endscript

"reload" sends SIGHUP, which makes cupsd reopen its log files (the actual
purpose of the postrotate) without tearing down the daemon, its socket,
or the cups-browsed queues, so long-running clients keep working.

** Affects: cups (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2165964

Title:
  logrotate restarts cups (instead reloading it) and most programs fail
  to print (due to a cached printer list)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cups/+bug/2165964/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to