Public bug reported:

On both Bionic (EOL, yes, but applies to the packages available within
ESM also) and Focal, we found that the unbound package's prerm
maintainer script does not confirm whether the action is "remove" before
it stops the service, causing a service stop and unnecessary unbound
downtime on every upgrade. We were able to confirm the script looks
correct in Jammy.

At the top of the prerm script in both affected distro versions, it
first checks for the old SysV style init while also confirming the
action is "remove":


    # Automatically added by dh_installinit/11.1.6ubuntu1
    if [ -x "/etc/init.d/unbound" ] && [ "$1" = remove ]; then
            invoke-rc.d unbound stop || true
    fi


However, at the end of the script, when it confirms whether the system has 
systemd running, it does not validate the action passed, so it stops the 
service on every action where prerm is called:


    # Automatically added by dh_systemd_start/11.1.6ubuntu1
    if [ -d /run/systemd/system ]; then
            deb-systemd-invoke stop 'unbound.service' >/dev/null || true
    fi


Simply appending ' && [ "$1" = remove ]' to the systemd conditional should 
resolve this issue.

It would then look like the following:


    # Automatically added by dh_systemd_start/11.1.6ubuntu1
    if [ -d /run/systemd/system ] && [ "$1" = remove ]; then
            deb-systemd-invoke stop 'unbound.service' >/dev/null || true
    fi


In the Jammy package, we see the prerm script looks correct, so it doesn't seem 
like any change is needed there:


    # Automatically added by dh_systemd_start/13.6ubuntu1
    if [ -z "${DPKG_ROOT:-}" ] && [ "$1" = remove ] && [ -d /run/systemd/system 
] ; then
            deb-systemd-invoke stop 'unbound.service' >/dev/null || true
    fi

** Affects: unbound (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2072700

Title:
  [Bionic/Focal] Unbound prerm script stops the service on upgrades

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/unbound/+bug/2072700/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to