d/rules, d/libvirt-daemon-system.{postinst,prerm}: never stop LIBVIRT_SYSTEM_SERVICES
Hi, my testing of libvirt 8.0 has revealed a rather critical issue due to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=994204
On upgrades guests are shut down (libvirt-guests.service) or even crash (virtlogd.service) because those services are restarted.
Until that bug is resolved in debhelper we need to take over the handling of those services ourselves.
References:
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=994204
- https://bugs.launchpad.net/ubuntu/+source/debhelper/+bug/1959054
- utopia-team/dbus@4c5195a1
Simple test that will restart those services
$ apt install --reinstall libvirt-daemon-system
In the postinst we can see the difference:
# Automatically added by dh_installsystemd/12.10ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
deb-systemd-invoke start 'libvirt-guests.service' 'virtlockd.service' 'virtlogd.service' >/dev/null || true
fi
fi
New:
# Automatically added by dh_installsystemd/13.5.2ubuntu1
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 restart 'libvirt-guests.service' 'virtlockd.service' 'virtlogd.service' >/dev/null || true
fi
fi
In a local extracted source you can replay the bad steps via
$ mkdir -p debian/libvirt-daemon-system/lib/systemd/system/
$ cp /lib/systemd/system/virtlogd.service debian/libvirt-daemon-system/lib/systemd/system
$ rm debian/.debhelper/generated/libvirt-daemon-system/postinst.service
$ dh_installsystemd -v -p libvirt-daemon-system --no-also --no-stop-on-upgrade virtlogd.service
$ echo "RESULT"
$ grep virtlogd.service debian/.debhelper/generated/libvirt-daemon-system/postinst.service
Until debhelper is fixed we need to ensure to not kill/shutdown guests on upgrades/reinstalls and for that I have proposed this change following the same path that dbus uses.
Affected Debhelper
- Focal (backports) 12.10ubuntu1 good
- Impish 13.3.4ubuntu2 good
- Jammy 13.5.2ubuntu1 bad
- Debian testing 13.6 bad
- Debian stable 13.3.4 good
This is a bit WIP still! Right now I have found the issue and the bug, have created this change and rebuilds are running right now. Once the tests with the new version are completed (to be sure about the fix) I'll ping here AND on the debhelper bug. But I wanted to present the PR before the tests complete so you do not have to re-debug and re-find everything.