[systemd-devel] suggestion: auto reload as the default to help packagers?

Michael Chapman mike at very.puzzling.org
Fri May 31 10:31:45 UTC 2019

On Fri, 31 May 2019, Roger Pack wrote:
> Had a thought the other day...
> Seems like many packages (ex: rpm's) that includes a *.service file
> may eventually be required to call
> systemctl daemon-reload
> in the package, for new file changes to "take."
> This causes bugs like
> https://github.com/StackStorm/st2-packages/issues/495 (which lists
> other reports of this problem near the bottom).
> Seeing as one goal of systemd is to DRY up installation and running of
> services so that people can't "accidentally mess things up" through
> their own init.d files...perhaps that principle could be expanded upon
> to help make it so that package creators also can't "accidentally mess
> things up"?  Maybe the default could be to reload units automatically,
> ?  With a configuration option to not to, so that package creators
> don't *all* have to remember to daemon-reload, since not all do?
> Just a thought, thinking out loud.

There's a couple of reasons auto-reloading could be problematic.

First, it doesn't help with generated units. systemd has no way to 
know that the contents of generated units might be different than 
before, since the way these units are generated is entirely opaque to it.

It also means that the sysadmin can't prepare a set of interconnected 
changes and have them applied at once. For instance, you might want a 
timer unit and its associated service unit to be applied at the same time, 
rather than have the timer fire before the service has been properly 

For RPM on Fedora, the systemd package has %transfiletriggerin and 
%transfiletriggerun scriptlets that run automatically at the end of the 
RPM transaction if units were installed or removed. This is the cleanest 
approach since it means all changes from all updated packages are applied 
at once.

For RHEL 7, at least, it appears that RPM does not support file triggers. 
However, the %systemd_postun macro supplied by systemd for use by 
packagers always reloads systemd on this OS.

So either way, there should be no need for a packager to explicitly 
invoke daemon-reload from their own package's scriptlets. They should just 
use the macros provided systemd.

It looks like the project you linked to is using its own macros instead, 
which is probably why it didn't work properly.

More information about the systemd-devel mailing list