[systemd-devel] runtime directories for services vs. tmpfiles

Lennart Poettering lennart at poettering.net
Tue Jul 16 11:47:28 PDT 2013


On Tue, 16.07.13 17:59, Colin Guthrie (colin at mageia.org) wrote:

> 
> 'Twas brillig, and Kay Sievers at 16/07/13 17:24 did gyre and gimble:
> > On Tue, Jul 16, 2013 at 6:01 PM, Lennart Poettering
> > <lennart at poettering.net> wrote:
> > 
> >> Hmm, I'd like such an automatism, but I'd really prefer if we could come
> >> up with some scheme to automatically determine all tmpfiles snippets in
> >> the package and apply them all automatically. But I am not sure how that
> >> could be done with current RPM.
> >>
> >> In fact, I'd actually like to do the same for the %systemd_post macros,
> >> and suchlike, where people tend to be pretty bad at always listing all
> >> unit files correctly.
> 
> Actually rereading this bit above, I can see the desire for automated
> snippets, but are there not some cases where you would want to avoid
> calling %systemd_post macros for some shipped units? e.g. they may only
> be used internally by others (Requires=, Also= and similar). I think
> such automation might not be good. (just look at the NFS units which I
> think we've finally cleaned up a bit in Mageia - enough to actually work
> at least).

No. You really want the macros for all units, always. 

The macros use the preset information to enable units if that's
what the vendor or admin wants. This preset information should be what
decides what is enabled and what is not, not the packager who accidently
forgot to invoke "systemctl preset" on one of his units.

The unit names also matter to shutdown running units before uninstalling
them. For that too you really need the list of all units the package
installs and not just the ones the package might have though about
listing.

So yeah, we want that the scritps process *all* units the package
installs, not just some subset. Only that guarantees correct behaviour
regarding presets and regarding stopping things when we uninstall.

Of coruse, this is not obvious to people, which is why many packages
don't get this right. With the automatic logic we'd avoid this confusion.

> 
> > Hmm, an rpmlint check for stuff like this maybe is the first step? At
> > least people who care and look at that would fix their stuff?
> 
> Misc was looking at doing most of that. Not sure what you mean about
> naming tho'... do you just mean the folder name (etc vs usr) or just not
> picking very nice unit names?

The rpmlint should just check that all units a package ships are listed
as arguments for the RPM macro.

> For the folder, I put rpmlint checks in Mageia a while ago to ban units,
> tmpfiles and udev rules from shipping in /etc.

That's a very good choice.

> And another to do with non-ghost files in /run or /var/run.

Also a good choice!

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list