On September 13, 2021 7:39 pm, Arnaud Rebillout wrote:
> Package: debhelper
> Version: 13.5.1
> Severity: normal
> X-Debbugs-Cc: ni...@thykier.net
> 
> Dear Maintainer,
> 
> First let me give a bit of context:
> 
> I was putting some work on the docker.io package. Right now docker.io
> depends on needrestart, so it's not affected by this bug. However I
> was working on removing the needrestart dependency, hence making it a
> "normal package", with regard to restarting the docker daemon when the
> package is upgraded.
> 
> So I removed needrestart from the docker.io Depends, I rebuilt the
> package, and installed it again and again, to check whether the daemon
> was restarted during the package re-installation.
> 
> And I was surprised to see that yes, dockerd was restarted all the time.
> However the debian/rules for docker.io explicitly states that it should
> not:
> 
>   override_dh_installsystemd:
>     dh_installsystemd -v --name=docker --no-stop-on-upgrade 
> --no-restart-after-upgrade
> 
> The man page of dh_installsystemd says:
> 
>   --no-stop-on-upgrade
>     Do not stop service on upgrade. This has the side-effect of not
>     restarting the service as a part of the upgrade.
> 
> So if I understand properly, this is a bug.
> 
> We can see which postinst snippets are installed during the build of the
> package in eg. [1], I'll reproduce it here for convenience:
> 
>     dh_installsystemd -v --name=docker --no-stop-on-upgrade 
> --no-restart-after-upgrade
>       install -d debian/docker.io/lib/systemd/system
>       install -p -m0644 debian/docker.io.docker.service 
> debian/docker.io/lib/systemd/system/docker.service
>       install -p -m0644 debian/docker.io.docker.socket 
> debian/docker.io/lib/systemd/system/docker.socket
>       [META] Append autosnippet "postinst-systemd-enable" to postinst 
> [debian/.debhelper/generated/docker.io/postinst.service]
>       [META] Append autosnippet "postinst-systemd-enable" to postinst 
> [debian/.debhelper/generated/docker.io/postinst.service]
>       [META] Prepend autosnippet "postrm-systemd" to postrm 
> [debian/docker.io.postrm.debhelper.new]
>       mv debian/docker.io.postrm.debhelper.new 
> debian/docker.io.postrm.debhelper
>       [META] Append autosnippet "postinst-systemd-start" to postinst 
> [debian/.debhelper/generated/docker.io/postinst.service]
>       [META] Prepend autosnippet "prerm-systemd-restart" to prerm 
> [debian/.debhelper/generated/docker.io/prerm.service.new]
>       mv debian/.debhelper/generated/docker.io/prerm.service.new 
> debian/.debhelper/generated/docker.io/prerm.service
>       [META] Prepend autosnippet "postrm-systemd-reload-only" to postrm 
> [debian/docker.io.postrm.debhelper.new]
>       mv debian/docker.io.postrm.debhelper.new 
> debian/docker.io.postrm.debhelper
> 
> Looking at the snippet postinst-systemd-start, we can see that what it
> does is actually "deb-systemd-invoke restart". I believe this is the
> problem, it should be "start" instead.
> 
> And indeed, it used to be start, and was changed to restart very
> recently (Jul 11th), in this commit:
> https://salsa.debian.org/debian/debhelper/-/commit/6067bc2
> 
> I don't really know what's the proper fix here, since this commit was
> not trivial, and just changing it back to "start" might (or might not)
> break something else.

also started to run into this, this breaks two not that uncommon 
use-cases rather badly:

- services that support hot-reloading (via ExecReload) without service 
  interruption, as opposed to restarting which does
- services that don't support hot-reloading, but where restarting has 
  dangerous side-effects and should be done manually (e.g., hypervisor 
  services where restarting means stopping all running guests, services 
  that have long-running tasks that would get interrupted and start over 
  or get lost when restarted, ...)

the former usually have some sort of extra handling to do the 
'try-reload-on-upgrade' (I did try to push that into debhelper and co
pre-buster but didn't make the cut, I'd like to pick it up for 
bookworm), the latter just want the start/stop on install/removal logic, 
nothing else.

in both cases, the services
- want to be started when initially installed
- want to be stopped when uninstalled
- don't want to be restarted in any way when upgraded

this previously worked fine, but now there is no option to get this 
behaviour with debhelper.

Reply via email to