Howto prevent service restarts on Debian package upgrades

Posted . Visible to the public. Repeats.

Prevent the restart of daemons from Debian package upgrades.

Proper written postinstall scripts for Debian packages utilize deb-systemd-invoke to restart systemd units after installation and upgrade of packages.

deb-systemd-invoke in turn uses policy-rc-d to determine if a service can be restarted or not.

To manipulate the default behaviour, the package policy-rcd-declarative-allow-all or policy-rcd-declarative-deny-all can be installed.

Setup

apt install policy-rcd-declarative policy-rcd-declarative-deny-all
apt purge policy-rcd-declarative-allow-all

Reference

Profile picture of Moritz Kraus
Moritz Kraus
Last edit
Marc Dierig
Keywords
apt, dpkg, debian, ubuntu, update, upgrade, restart, reload
License
Source code in this card is licensed under the MIT License.