Comment 32 for bug 1642966

Revision history for this message
Martin Pitt (pitti) wrote :

I didn't reproduce this yet, answering Till's questions first.

> Does systemd care about keepalive files?

No, there is no such concept. You can certainly build such a thing using path units and others, but no Linux init system kills processes willy-nilly from the outside (except on shutdown, of course) -- daemons either have a built-in timeout and quit themselves, or have to be stopped explicitly.

> 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?

I have no idea. I haven't printed anything in years (I don't even have a printer), and that file exists, thus that .path unit always gets activated and starts cupsd.service even though I have no need for it. Does that ever actually get cleaned up?

Also, such "keepalive" stamps should *always* be in /run -- it makes no sense to put them on the file system in /var where they are persistent across reboot.

> Does this *.path also take down cupsd if one removes the keepalive file.

No, it doesn't (at least not in the way that path unit is written). This also doesn't make much sense, TBH -- you can never know from the outside if a daemon is still required to run, so you always need the daemon itself to make that decision. Instead of creating/removing keepalive files it could just stop itself, which is structurally a lot simpler.

> And why does shutdown of CUPS fail after removing the keepalive file (with "Job for cups.service canceled.")?

It sounds like cups.service gets stopped, but around the same time something tries to start it again, possibly via either cups.path or cups.socket. In generally, if you need to prevent a service from restarting, you need to first stop all "auto-activating" units (path, socket, timer) as well, and before stopping the .service.

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

The maintainer scripts don't, and I'm not at all convinced that anything is actually removing it (see above). Maybe cupsd is supposed to clean it on shutdown, but this doesn't happen sometimes?

So ISTM that the current cups.path serves no real purpose and apparently just gets in the way. I think what *would* make sense is to have a path unit that starts cups at boot if there are pending print jobs, e. g. something like "DirectoryNotEmpty=/var/spool/cups".