On Fri, 24 Jul 2026 at 19:02:04 +0200, Hefee wrote:
For me it looks unsafe to just restart any user service while upgrading
without asking the admin (who execute the upgrade).
At least on KDE Plasma uses a lot user services and restarting them may
break the Desktop, as seen here. Restarting gpg or wireplumber service
without consent is also not a good idea, as it breaks a working user.

We've had a similar restart issue in gnome-terminal, where restarting the user service terminates existing terminals (#1144676). The compat level bump from 13 to 14 added this in the postinst:

│ │ │ │ +# Automatically added by dh_installsystemduser/14.3
│ │ │ │ +if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] 
|| [ "$1" = "abort-remove" ] ; then
│ │ │ │ +       if [ -z "$DPKG_ROOT" ] && [ -d /run/systemd/system ]; then
│ │ │ │ +               # Here we reload synchronously, as we really need to 
block in
│ │ │ │ +               # order to ensure the following restart also works. 
Furthermore,
│ │ │ │ +               # if there is no D-Bus user session, the restart won't 
work either,
│ │ │ │ +               # so there's no point if falling back to signals - so 
either both
│ │ │ │ +               # of these operations work, or both fail.
│ │ │ │ +               deb-systemd-invoke --user daemon-reload >/dev/null || 
true
│ │ │ │ +               deb-systemd-invoke --user restart 
'gnome-terminal-server.service' >/dev/null || true
│ │ │ │ +       fi
│ │ │ │ +fi
│ │ │ │ +# End automatically added section

and this in the prerm:

│ │ │ │ +# Automatically added by dh_installsystemduser/14.3
│ │ │ │ +if [ -z "$DPKG_ROOT" ] && [ "$1" = remove ] && [ -d 
/run/systemd/system ] ; then
│ │ │ │ +       deb-systemd-invoke --user stop 'gnome-terminal-server.service' 
>/dev/null || true
│ │ │ │ +fi
│ │ │ │ +# End automatically added section

If dh_installsystemduser had an equivalent of dh_installsystemd --no-stop-on-upgrade --no-restart-after-upgrade (see also #837528) then we could probably use that, but at the moment there's no such option, and the restart is unconditional (in compat level 14). This is suitable for many user-services, but not all user-services: it would be destructive to restart dbus.service, a terminal emulator, or a major desktop environment component like [email protected] or whatever is KDE Plasma's equivalent.

(Perhaps these units should have RefuseManualStop, and perhaps if they did it would prevent the maintainer script from restarting them - but at the moment that configuration is far from ubiquitous, and it isn't obvious to me whether it would have undesired side-effects.)

For now, I'm going to roll gnome-terminal back to compat level 13.

Thanks,
    smcv

Reply via email to