> Robie, thanks for the investigations. I have looked into what the file
/var/cache/cups/org.cups.cupsd (CUPS calls it "keepalive" file) is good
for and what CUPS does with it. The file is created by the CUPS daemon
cupsd when it needs to keep running, having active jobs, being in the
course of a reload, having the web interface active or sharing printers,
otherwise the file is removed. CUPS updates presence/no presence on
start-up and shutdown of the daemon and it does exactly the same in both
cases, so it can remain present after shutdown, depending on CUPS'
configuration. CUPS never reads this file (or checks its presence),
meaning that it is purely for advising external processes.

> So for me it looks like that there is a certain system service manager
(what one usually runs as PID 1 under Linux) which checks for the
presence of keepalive files and decides based on this which daemons to
kill and which to keep running.

Right - I believe this is launchd (under OS X).

I do not know everything about systemd. Does systemd care about
keepalive files?

> AFAIK, no, not at all. You can configure systemd to start cupsd when a
named file appears ("systemd.path"). I can't find anything documented
about systemd stopping any service ever. The source that handles
"systemd.path" doesn't ever appear to stop a service. Upstream appears
to have configured this in their supplied systemd units, but I believe
it may be unnecessary.

> The CUPS upstream *.path makes cupsd being triggered by creating the
file, but only if the file is not there already. What is this good for?

Exactly :-)

AFAICT, it serves no purpose.

> Does this *.path also take down cupsd if one removes the keepalive
file or is systemd supposed to do so? For me cupsd does not get stopped
by that.

AFAICT, removing the file isn't supposed to cause any action. Nothing
should happen when the file is removed, and nothing does happen (apart
from perhaps some state change within systemd, or some timing delay
helping us trigger the race).

> And why does shutdown of CUPS fail after removing the keepalive file
(with "Job for cups.service canceled.")? As CUPS does not care about it,
systemd seems to depend on it.

This I'm not sure about. It may be a systemd race or bug. I pinged pitti
to take a look, but he was busy. But if we definitely don't need
cups.path, perhaps removing it will fix the problem (whether that's
working around a bug in systemd or in the current CUPS systemd
arrangements I don't know).

>  And what in the prerm script of the CUPS Debian package deletes the
keepalive file?

Nothing, AFAICT. It's only cupsd that deletes it on exit. The prerm
stops cups.path, then stops cups.service. I don't know that my example
above reproduces the root cause. But it does seem to reproduce a race
that produces the same symptoms that seems to fit reasonably well.

You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to cups in Ubuntu.

  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:

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
  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 
  Lpstat: device for mallards-officejet-pro-8600: 
  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
   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.product.name: XPS 15 9550
  dmi.sys.vendor: Dell Inc.

To manage notifications about this bug go to:

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

Reply via email to