Comment 9 for bug 1533839

Revision history for this message
Martin Pitt (pitti) wrote :

The original dh_systemd_start code is correct:

  if ($dh{R_FLAG} || $dh{RESTART_AFTER_UPGRADE}) {

in this case it installs "prerm-systemd-restart" which *only* stops the service in the prerm if $1 == "remove". The problem is a bit more subtle: As you can see in the prerm, there are *two* stanzas for "stop libvirt-guests.service". The first one is wrong, the second one is correct (if $1 == "remove") and comes from the explicit

   dh_systemd_start -p libvirt-bin --no-restart-on-upgrade libvirt-guests.service

call in debian/rules. However, the first one gets synthesized by cdbs' debhelper.mk, and unfortunately cdbs does not have a way to override the options per-service:

   $(if $(wildcard /usr/bin/dh_systemd_start),dh_systemd_start -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_DH_SYSTEMD_START_ARGS))

this can also be seen in the build log:

dh_installinit -p libvirt-bin --name=libvirt-guests --no-restart-on-upgrade -- defaults 29 71
dh_systemd_enable
dh_systemd_start -p libvirt-bin --restart-after-upgrade libvirt-bin.service
dh_systemd_start -p libvirt-bin --no-restart-on-upgrade libvirt-guests.service
[... the above is from the explicit debian/rules code ...]
dh_install -plibvirt-bin⎵⎵
dh_systemd_enable -plibvirt-bin⎵
dh_systemd_start -plibvirt-bin⎵
[... the above is from the implicit cdbs debhelper rules ...]

As debian/rules already has explicit calls for libvirt-bin's dh_systemd_start, I think the easiest fix is to completely disable the implicicly generated rules:

# we have explicit calls with different options per .service, disable
# autogenerated calls
DEB_DH_SYSTEMD_START_ARGS_libvirt-bin = --no-act