#932360 systemctl daemon-reload not added in postinst script in --no-start --no-restart-after-upgrade case

#932360#5
Date:
2019-07-18 12:40:57 UTC
From:
To:
Hi,

When calling "dh_installsystemd -ppolicycoreutils --no-start --no-restart-after-upgrade"
the call to systemctl daemon-reload is only added in the postrm script,
not the postinst one

Is that expected?

Kind regards,

Laurent Bigonville

#932360#10
Date:
2019-07-18 13:09:54 UTC
From:
To:
Hi Laurent

Am 18.07.19 um 14:40 schrieb Laurent Bigonville:

Hm, good question. Strictly speaking, a daemon-reload is not necessary,
unless you (re)start the service. Do you expect your users to (re)start
the service manually? Can you elaborate on the use case here?
If a user would do that manually, we would get a warning from systemctl
that the file has changed on disk (in case it actually has...)

What we might do is to run daemon-reload implicitly via a dpkg
file-trigger. This would cover cases like yours.
Not sure. Thoughts?


See also
https://salsa.debian.org/systemd-team/systemd/blob/master/debian/systemd.triggers
https://salsa.debian.org/systemd-team/systemd/blob/master/debian/systemd.postinst#L16

#932360#15
Date:
2019-07-18 13:54:13 UTC
From:
To:
Hello Michael,

For my specific case here, it's not expected that the user will manually
start the service after the package installation.

But I can imagine cases (even if it's not the habit in debian to not
automatically start the service after installation) where this will be
desired.

Is it a good idea to have a different way of calling daemon-reload only
for this case?

In the other cases you still need to do that synchronously

#932360#20
Date:
2019-07-18 14:50:20 UTC
From:
To:
Am 18.07.19 um 15:54 schrieb Laurent Bigonville:

My idea was, to avoid unnecessary daemon-reloads as much as possible.

If your use case is, that at some point in the future, the user might
(re)start the service, then it is sufficient if we do a single
daemon-reload after the dpkg run.

Let's say we have 10 packages using "--no-start
--no-restart-after-upgrade", then a single daemon-reload at the end
would be sufficient instead of having to directly call daemon-reload
from postinst.

On the other hand, having a dpkg file-trigger for /lib/system/system
would mean we trigger daemon-reload at least twice for the common case
(one via postinst and one via file trigger).

#932360#25
Date:
2024-07-25 13:59:41 UTC
From:
To:
buggy as this can yield a race for the dpkg frontend lock:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1070027

Depending on which gets the lock first:
  * This can make (at least) aptitude fail, leaving the system
    in an inconsistent state.
  * This can make the apt.systemd.daily script fail.

#932360#30
Date:
2024-07-27 08:10:31 UTC
From:
To:
Vincent Lefevre:

Ok. There is not much we can do on the debhelper side of this. The
systemd maintainers and the apt or/and aptitude maintainers maybe with
the dpkg maintainers having a combined huddle here might be more productive.

Once they have figured out the solution, this might trigger a change to
debhelper.

Best regards,
Niels