Comment 34 for bug 2000186

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I'm seeing the following when I upgrade from jammy to jammy-proposed: the multipathd service is not restarted.

The upgrade path calls:
 old-prerm upgrade 0.8.8-1ubuntu1.22.04.2
 old-postrm upgrade 0.8.8-1ubuntu1.22.04.2
 new-postinst configure 0.8.8-1ubuntu1.22.04.2

The old-prerm is this:
if [ -z "${DPKG_ROOT:-}" ] && [ "$1" = remove ] && [ -x "/etc/init.d/multipath-tools" ] ; then
    invoke-rc.d multipath-tools stop || exit 1
fi
if [ -z "${DPKG_ROOT:-}" ] && [ -d /run/systemd/system ]; then
    deb-systemd-invoke stop 'multipathd.socket' >/dev/null || true
fi

Notice how invoke-rc.d stops "multipath-tools", but deb-systemd-invoke only stops the socket. And only deb-systemd-invoke will be called, because invoke-rc.d is gated in $1=remove.

Old postrm has all actions gated in $1 being remove or purge, so nothing is done essentially.

Then new postinst, ignoring the various enable/update-state calls, we have a start:
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 'multipathd.service' 'multipathd.socket' >/dev/null || true
    fi
fi

So why isn't this upgrade restarting (stop+start) multipathd?

I think it's because the old-prerm is only stopping the multipathd socket, not the service. THe journal log shows this during that upgrade:
Aug 31 14:31:29 j-mp-tools systemd[1]: Started Device-Mapper Multipath Device Controller.
Aug 31 14:31:48 j-mp-tools systemd[1]: multipathd.socket: Deactivated successfully.
Aug 31 14:31:48 j-mp-tools systemd[1]: Closed multipathd control socket.
Aug 31 14:31:48 j-mp-tools systemd[1]: Reloading.
Aug 31 14:31:48 j-mp-tools systemd[1]: multipathd.socket: Socket service multipathd.service already active, refusing.
Aug 31 14:31:48 j-mp-tools systemd[1]: Failed to listen on multipathd control socket.

I added a set -x to old-prerm:
Preparing to unpack .../multipath-tools_0.8.8-1ubuntu1.22.04.2_amd64.deb ...
+ FIXED=0.4.8-1
+ [ upgrade = failed-upgrade ]
+ [ -z ]
+ [ upgrade = remove ]
+ [ -z ]
+ [ -d /run/systemd/system ]
+ deb-systemd-invoke stop multipathd.socket
Unpacking multipath-tools (0.8.8-1ubuntu1.22.04.2) over (0.8.8-1ubuntu1.22.04.1) ...
Setting up multipath-tools (0.8.8-1ubuntu1.22.04.2) ...
Could not execute systemctl: at /usr/bin/deb-systemd-invoke line 142.
Removing obsolete conffile /etc/init.d/multipath-tools ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...

Notice the "Could not execute systemctl" message.

It failed to stop multipathd *service*, because it tried to stop the socket while the service was still active. But I can't reproduce this manually, systemctl commands are happy to stop the socket while the service is still running.

I'll troubleshoot a bit more later, but would be interested in your input. Your test case only shows that multipathd was still running after an upgrade, but I believe it was still the old process.