#377 tmpfiles.d guidelines update
Closed: Fixed None Opened 5 years ago by zbyszek.

Recently [1] the tmpfiles creation mechanism was changed to be able to run tmpfiles snippets safely during boot. In short, tmpfiles lines which should only be executed during boot are suffixed with '!', and only executed when systemd-tmpfiles is called with --unsafe.
This change was done to avoid problems which happen when people run 'systemd-tmpfiles --create' which would create /run/nologin and lock them out of their machine [2], but is useful in other cases.

I'd like to propose the following changes to https://fedoraproject.org/wiki/Packaging:Tmpfiles.d:

  1. Mention the split between 'safe' and 'unsafe' (i.e. boot-only) tmpfiles lines
  2. Suggest running 'systemd-tmpfiles --create --remove <package>.conf' during package installation to immediately adjust permissions/create/remove files, if necessary.

I want to modify systemd package itself to follow 2. to fix issues like [3].

It'd also be nice to remove the duplication of putting directories in /run both in the tmpfiles config and in the rpm content itself, but that's harder to fix.

[1] http://cgit.freedesktop.org/systemd/systemd/commit/?id=c4708f132381e4

[2] https://bugzilla.redhat.com/show_bug.cgi?id=1043212

[3] https://bugzilla.redhat.com/show_bug.cgi?id=1045849


IMO, item 2 should generally be handled by making sure that rpm "owns" the dir(s) in question, so that they get created at package install. No need to rely on systemd for that. I suppose there may be cases where that may be insufficient for all usecases (though i can't think of any off the top of my head).

Replying to [comment:1 rdieter]:

IMO, item 2 should generally be handled by making sure that rpm "owns" the dir(s) in question, so that they get created at package install.

Yes, that's the way it's done currently. It just feels error-prone to have to duplicate this list of files in two places.

No need to rely on systemd for that.
systemd-tmpfiles is more or less independent, and can be run without systemd present.

I suppose there may be cases where that may be insufficient for all usecases (though i can't think of any off the top of my head).

For example when extended attributes should be set. Also, local administrator can add tmpfiles snippets overrides, and then even if the rpm package would contain all files/directories specified in the tmpfiles configuration, in the window between package upgrade and reboot those local overrides wouldn't be honored.

This guideline update was declined at the 2014-01-09-16 meeting:

info Proposal to use systemd-tmpfiles --create and not have packages specify the directories under /var/lock in rpm's %files rejected. Vote to approve the proposal was (+1:0, 0:0, -1:5)

You can see the meeting logs here: http://meetbot.fedoraproject.org/teams/fpc/fpc.2014-01-09-16.59.log.html if you want more information.

Login to comment on this ticket.

Metadata