Dear Maintainer, dear LTS team,

Since cups 2.4.2-3+deb12u10 (DLA-4952-1, bookworm-security, 2026-11-29), a fresh
install of printer-driver-cups-pdf 3.0.1-14 on bookworm no longer completes
unattended. The postinst blocks forever on a password prompt and the package is
left half-configured (dpkg state "iF").

This is the problem that was already fixed in unstable by cups-pdf 3.0.2-7:

  * [postinst]: Stop using '-h localhost'. Fixes the issue where installing the
    package with CUPS 2.4.17+ ... gets stuck in postinst asking for the root
    password. (upstream commit e052dc44d)

deb12u10 backports that same CUPS change (debian/patches/CVE-2026-34990.patch =
upstream e052dc44d "Don't allow local certificates over the loopback
interface"). Bookworm's cups-pdf postinst still uses "-h localhost", so the
companion fix is missing in bookworm.


Cause
-----

The postinst creates the PDF queue with

  echo | lpadmin -h localhost -p $queue -v cups-pdf:/ ...

With "-h localhost" libcups connects over TCP. Since e052dc44d, Local/PeerCred
authentication is only accepted over the domain socket, so lpadmin falls back
to Basic auth and asks for a password. libcups reads the password from /dev/tty
rather than stdin, so the "echo |" does not answer it.

apt-get runs dpkg on a pty (Dpkg::Use-Pty, the default), and dpkg and its
maintainer scripts get that pty as their controlling terminal. When apt is
driven non-interactively (configuration management, unattended installs), nobody
writes to that pty, so lpadmin waits in read() on /dev/tty forever and the
apt-get never returns. The last line of /var/log/apt/term.log is then:

  Password for root on localhost?

The process tree at that point:

  apt-get install ... printer-driver-cups-pdf
   └─ dpkg --configure ...
       └─ /var/lib/dpkg/info/printer-driver-cups-pdf.postinst configure
           └─ lpadmin -h localhost -p PDF -v cups-pdf:/ -m
lsb/usr/cups-pdf/CUPS-PDF_opt.ppd -o
pdftops-renderer-default=pdftocairo -o printer-is-shared=no -o
PageSize=a4

When there is no controlling terminal at all, lpadmin fails immediately with
"Unauthorized" instead. The "|| :" lets the postinst continue, but the PDF
queue is then silently not created.

Systems that already had printer-driver-cups-pdf configured are not affected by
the cups upgrade itself. The postinst only creates a queue if no cups-pdf:/
queue exists yet, and cups-pdf itself is not being upgraded. Fresh installs
are affected.


Steps to reproduce
------------------

On bookworm with cups-daemon/libcups2 2.4.2-3+deb12u10 and cupsd running:

  # timeout 15 lpadmin -h localhost -p PDFTEST -v cups-pdf:/ \
      -m lsb/usr/cups-pdf/CUPS-PDF_opt.ppd
  Password for root on localhost?
  # echo $?
  124

The same command without "-h localhost" (domain socket) creates the queue
fine as root:

  # lpadmin -p PDFTEST -v cups-pdf:/ -m lsb/usr/cups-pdf/CUPS-PDF_opt.ppd

For the full symptom, run "apt-get install -y printer-driver-cups-pdf" from a
non-interactive process on a system without a cups-pdf queue (we hit it from a
Salt state). It never finishes.

Observed with:
  Debian 12.15, amd64
  cups-daemon 2.4.2-3+deb12u10, libcups2 2.4.2-3+deb12u10
  printer-driver-cups-pdf 3.0.1-14
With deb12u9 the same installation completes normally.


Suggested fix
-------------

Backport the 3.0.2-7 postinst change to bookworm, i.e. drop "-h localhost"
from all lpstat/lpadmin/cupsenable/cupsaccept calls so they use the default
domain socket. This matches the current unstable postinst. The patch against
3.0.1-14 is below. We verified by hand that lpadmin without "-h" works with
deb12u10. We have not tested the rebuilt package.

Because the regression comes from the cups security update, it might best go
out with the next cups update in bookworm-security (several other deb12u10
regressions are already reported against src:cups).

--- a/debian/printer-driver-cups-pdf.postinst
+++ b/debian/printer-driver-cups-pdf.postinst
@@ -32,10 +32,10 @@
                        invoke-rc.d cups force-reload || invoke-rc.d
cups start || :
                fi
                # Wait until CUPS has reloaded its configuration.
-               if lpstat -h localhost -r 2>/dev/null | grep -q not
+               if lpstat -r 2>/dev/null | grep -q not
                then
                        t=0
-                       while lpstat -h localhost -r 2>/dev/null | grep -q not
+                       while lpstat -r 2>/dev/null | grep -q not
                        do
                                t=$(($t + 1))
                                if [ $t = 10 ]
@@ -47,12 +47,12 @@
                        done
                fi
                # Create a PDF queue if we have none yet (but NOT
inside chroots; see Debian bugs #539156,#614713)
-               if [ -z "$(LC_ALL=C lpstat -h localhost -v 2>/dev/null
| grep 'cups-pdf:/')" ] && [ -d /run/cups/certs ]
+               if [ -z "$(LC_ALL=C lpstat -v 2>/dev/null | grep
'cups-pdf:/')" ] && [ -d /run/cups/certs ]
                then
                        # 1) Find a name for the PDF queue.
                        queue=PDF
                        number=0
-                       while $(LC_ALL=C lpstat -h localhost -v
2>/dev/null | cut -d ':' -f 1 | cut -d ' ' -f 3 | grep -q ^$queue\$)
+                       while $(LC_ALL=C lpstat -v 2>/dev/null | cut
-d ':' -f 1 | cut -d ' ' -f 3 | grep -q ^$queue\$)
                        do
                                number=$(($number + 1))
                                queue="PDF$number"
@@ -60,14 +60,14 @@
                        # 2) Find the default paper size.
                        size="$(LC_ALL=C paperconf 2>/dev/null)" || size=a4
                        # 3) Create the queue.
-                       echo | lpadmin -h localhost -p $queue -v
cups-pdf:/ -m lsb/usr/cups-pdf/CUPS-PDF_opt.ppd -o
pdftops-renderer-default=pdftocairo -o printer-is-shared=no -o
PageSize=$size 2>/dev/null || :
+                       echo | lpadmin -p $queue -v cups-pdf:/ -m
lsb/usr/cups-pdf/CUPS-PDF_opt.ppd -o
pdftops-renderer-default=pdftocairo -o printer-is-shared=no -o
PageSize=$size 2>/dev/null || :
                        # 4) Enable the queue.
-                       echo | cupsenable -h localhost $queue 2>/dev/null || :
-                       echo | cupsaccept -h localhost $queue 2>/dev/null || :
+                       echo | cupsenable $queue 2>/dev/null || :
+                       echo | cupsaccept $queue 2>/dev/null || :
                        # 5) Set the PDF queue as default if there is
no default printer yet.
-                       if [ -z "$(LC_ALL=C lpstat -h localhost -d
2>/dev/null | grep 'system default destination:')" ]
+                       if [ -z "$(LC_ALL=C lpstat -d 2>/dev/null |
grep 'system default destination:')" ]
                        then
-                               echo | lpadmin -h localhost -d $queue
2>/dev/null || :
+                               echo | lpadmin -d $queue 2>/dev/null || :
                        fi
                else
                        echo "Skipped automated creation of the PDF queue."

-- 
Thanks,
Danny Smit

Reply via email to