#1143044 debhelper: dh_installsystemd doesn't daemon-reload in the postinst if --no-start

Package:
debhelper
Source:
debhelper
Submitter:
Christoph Anton Mitterer
Date:
2026-08-09 19:39:02 UTC
Severity:
normal
#1143044#5
Date:
2026-07-30 01:57:00 UTC
From:
To:
Hey.

This might be a duplicate of #995006... but I got a bit confused on what that's
actually about... so just merge if it's the same.


I have packages where I use something like:
```
#!/usr/bin/make -f

%:
	dh $@ --with python3 --buildsystem=pybuild


override_dh_installsystemd:
	dh_installsystemd --no-enable --no-start --no-stop-on-upgrade
```
in debian/rules.

Turns out, that whenever --no-start is used, dh omits a section like this:
```
# Automatically added by dh_installsystemd/14.3
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -z "$DPKG_ROOT" ] && [ -d /run/systemd/system ]; then
		systemctl --system daemon-reload >/dev/null || true
		deb-systemd-invoke start 'foo.service' >/dev/null || true
	fi
fi
# End automatically added section
```
from postinst.


IMO, it should only omit the:
```
                deb-systemd-invoke start 'foo.service' >/dev/null || true
```
but keep the daemon-reload.

`--no-start`, as per documentation, simply means not to start the unit, but
that may have changed nevertheless, and people get warnings (and possibly
unexpected behaviour) if they later do any actions on it.


Thanks,
Chris.

#1143044#10
Date:
2026-08-09 15:40:30 UTC
From:
To:
shouldnt this always be done via triggers to avoid multiple reloads?
#1143044#15
Date:
2026-08-09 19:21:28 UTC
From:
To:
I'd guess that this might be even better.

Care needs perhaps be taken if this could ever touch something like
PreDepends.

I mean if something that PreDepends on a package would also already
depend on any newer version of the unit files of the latter to be
loaded.
But I have no idea whether the policy would even mandate that to be the
case.

Cheers,
Chris.