I think this might be caused by an interesting interaction between
systemd, debhelper and the CUPS scheduler.

I can reproduce a very similar error with the following. I think (though
am not sure) that this is related to the root cause. On a fresh Xenial
system:

sudo apt-get update && sudo apt-get -y install cups
sudo -i
systemctl stop cups.service
sleep 4
touch /var/cache/cups/org.cups.cupsd
sleep 4
sudo rm /var/cache/cups/org.cups.cupsd
sleep 4
systemctl stop cups.service

(the sleeps are to avoid any unknown, additional and unintentional race
conditions)

This results in an exit status of 1 and the message "Job for
cups.service canceled." which matches the error that reporters have been
seeing.

In other words, if cups.service is started via cups.path, that cause is
removed, and then we request a manual stop of cups.service, then systemd
refuses to stop the service the first time (a retry always succeeds for
me).

In cups-daemon.prerm, debhelper has added "deb-systemd-invoke stop
cups.path" followed by "invoke-rc.d cups stop || exit $?". I believe the
second invocation is ultimately equivalent to "systemctl stop
cups.service" and fails the same way as in my example, causing the prerm
to exit 1, causing the dpkg failure reported.

I'm not sure of the intended logic for /lib/systemd/system/cups.path
here. AFAICT, it exists because when using CUPS with launchd, the CUPS
daemon leaves the file in place as long as it doesn't want to be
terminated, and removes it when it wants to be terminated before it
exits anyway. Is this because launchd kills daemons itself unless the
keepalive file exists?

With systemd, I can't find any documentation that suggests that systemd
ever intends to automatically kill a socket activated daemon. AFAICT,
it's entirely up to the daemon when it chooses to exit. So there appears
to be no need for cupsd to maintain /var/cache/cups/org.cups.cupsd when
running under systemd.

As configured right now, systemd will also start cupsd if
/var/cache/cups/org.cups.cupsd is created while cupsd is not running. I
can't find anything that might use this function. So either this is an
accidental side-effect that is not needed, or I have missed some other
path that does need this.

systemd talks about CUPS in a blog post that is relevant:
http://0pointer.de/blog/projects/socket-activation2.html. Note that this
only sets up a path unit for /var/spool/cups, not any kind of keepalive
file for cupsd.

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to cups in Ubuntu.
https://bugs.launchpad.net/bugs/1642966

Title:
  package cups-daemon 2.1.3-4 failed to install/upgrade: subprocess new
  pre-removal script returned error exit status 1

Status in cups package in Ubuntu:
  Confirmed

Bug description:
  This is in xenial-proposed, please block release to -updates
  accordingly :)

  ProblemType: Package
  DistroRelease: Ubuntu 16.04
  Package: cups-daemon 2.1.3-4
  ProcVersionSignature: Ubuntu 4.4.0-46.67-generic 4.4.24
  Uname: Linux 4.4.0-46-generic x86_64
  NonfreeKernelModules: zfs zunicode zcommon znvpair zavl
  ApportVersion: 2.20.1-0ubuntu2.1
  Architecture: amd64
  CupsErrorLog:
   
  Date: Fri Nov 18 11:13:15 2016
  ErrorMessage: subprocess new pre-removal script returned error exit status 1
  InstallationDate: Installed on 2016-05-02 (200 days ago)
  InstallationMedia: Ubuntu 16.04 LTS "Xenial Xerus" - Release amd64 
(20160420.1)
  Lpstat: device for mallards-officejet-pro-8600: 
dnssd://Officejet%20Pro%208600%20%5BD63461%5D._ipp._tcp.local/?uuid=1c852a4d-b800-1f08-abcd-d89d67d63461
  MachineType: Dell Inc. XPS 15 9550
  Papersize: a4
  PpdFiles: mallards-officejet-pro-8600: HP Officejet Pro 8600, hpcups 3.16.3
  ProcCmdline: BOOT_IMAGE=/boot/vmlinuz-4.4.0-46-generic.efi.signed 
root=UUID=3643ef37-7cee-41b3-9387-2faa819c44db ro quiet splash vt.handoff=7
  ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-4.4.0-46-generic.efi.signed 
root=UUID=3643ef37-7cee-41b3-9387-2faa819c44db ro quiet splash vt.handoff=7
  RelatedPackageVersions:
   dpkg 1.18.4ubuntu1.1
   apt  1.2.15
  SourcePackage: cups
  Title: package cups-daemon 2.1.3-4 failed to install/upgrade: subprocess new 
pre-removal script returned error exit status 1
  UpgradeStatus: No upgrade log present (probably fresh install)
  dmi.bios.date: 04/07/2016
  dmi.bios.vendor: Dell Inc.
  dmi.bios.version: 01.02.00
  dmi.board.name: 0N7TVV
  dmi.board.vendor: Dell Inc.
  dmi.board.version: A00
  dmi.chassis.type: 9
  dmi.chassis.vendor: Dell Inc.
  dmi.modalias: 
dmi:bvnDellInc.:bvr01.02.00:bd04/07/2016:svnDellInc.:pnXPS159550:pvr:rvnDellInc.:rn0N7TVV:rvrA00:cvnDellInc.:ct9:cvr:
  dmi.product.name: XPS 15 9550
  dmi.sys.vendor: Dell Inc.

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

-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : desktop-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to