d/libvirt-daemon-config-{network,nwfilter}.postinst: reload libvirtd before restart

I've seen warnings on upgrades into the split packages:

Setting up libvirt-daemon-config-network (7.0.0-1ubuntu1~ppa1) ...
Warning: The unit file, source configuration file or drop-ins of libvirtd.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Setting up libvirt-daemon-config-nwfilter (7.0.0-1ubuntu1~ppa1) ...
Warning: The unit file, source configuration file or drop-ins of libvirtd.service changed on disk. Run 'systemctl daemon-reload' to reload units.

Repro:

# pick whatever old version you have available
$ v=6.9.0-1ubuntu4; apt install libvirt-daemon-system=$v libvirt-clients=$v libvirt-daemon=$v libvirt0=$v libvirt-daemon-driver-qemu=$v libvirt-daemon-system-systemd=$v
$ apt install libvirt-daemon-system libvirt-daemon-system-systemd

The reload for this does happen so it isn't a real issue except for the message, but it happens later in:

/var/lib/dpkg/info/libvirt-daemon-system.postinst:325:		systemctl --system daemon-reload >/dev/null || true
/var/lib/dpkg/info/libvirt-daemon-system.postinst:491:		systemctl --system daemon-reload >/dev/null || true

Here a longer log:

Unpacking libvirt-login-shell (7.0.0-1ubuntu1~ppa1) ...
Setting up libvirt-daemon-config-network (7.0.0-1ubuntu1~ppa1) ...
Warning: The unit file, source configuration file or drop-ins of libvirtd.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Setting up libvirt-daemon-system-systemd (7.0.0-1ubuntu1~ppa1) ...
Setting up libvirt0:amd64 (7.0.0-1ubuntu1~ppa1) ...
Setting up libvirt-daemon-config-nwfilter (7.0.0-1ubuntu1~ppa1) ...
Warning: The unit file, source configuration file or drop-ins of libvirtd.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Setting up libvirt-clients (7.0.0-1ubuntu1~ppa1) ...
Setting up libvirt-daemon-driver-qemu (7.0.0-1ubuntu1~ppa1) ...
Setting up libvirt-daemon (7.0.0-1ubuntu1~ppa1) ...
Setting up libvirt-daemon-driver-lxc (7.0.0-1ubuntu1~ppa1) ...
Setting up libvirt-login-shell (7.0.0-1ubuntu1~ppa1) ...
Setting up libvirt-daemon-system (7.0.0-1ubuntu1~ppa1) ...

Our deps are like:

  libvirt-daemon-system
    -> libvirt-daemon-system-systemd | libvirt-daemon-system-sysv
    ...
    -> libvirt-daemon-config-network

By default things are configured in reverse of this order.

The code triggering this is

  1. unpack of the new libvirt-daemon-system (libvirtd.service) The file content didn't changed timestamp does:
    stat /lib/systemd/system/libvirtd.service
    ...
    Change: 2021-01-26 14:38:16.950177822 +0000
  1. before libvirt-daemon-system does a reload libvirt-daemon-config-network.postinst does:
    if systemctl is-active -q libvirtd; then
        systemctl restart libvirtd
    fi

adding "systemctl --system daemon-reload >/dev/null || true" there fixes that

Unpacking libvirt-daemon-config-network (7.0.0-1ubuntu1~ppa3) ...
Selecting previously unselected package libvirt-daemon-config-nwfilter.
Preparing to unpack .../2-libvirt-daemon-config-nwfilter_7.0.0-1ubuntu1~ppa3_all.deb ...
Unpacking libvirt-daemon-config-nwfilter (7.0.0-1ubuntu1~ppa3) ...

Silent now :-)

Merge request reports

Loading