Am 21.01.2018 um 16:28 schrieb Michael Biebl: > Package: debhelper > Version: 11.1.3 > Severity: important > > dh_installsystemd masks services on "remove". The background here is, that > SysV init scripts are conffiles which are only removed on "purge". > > Upon re-installation, this mask is removed again. > With dh_systemd_enable, this was done before dh_installinit, so the mask > was gone when invoke-rc.d tried to start the service. > > With compat 11 and dh_installsystemd, the dh_installsystemd helper is > called after dh_installinit. As a result, invoke-rc.d will try to start > a service which is still masked.
See the generated postinst script. The more I think about these ordering issues, the more I'm convinced that for services which ship both a native service file and a systemd service file, we should leave the start/stop/restart of the service to dh_installsystemd/deb-systemd-invoke and only use the invoke-rc.d call on sysvinit systems. I.e. we inverse the current logic: If dh_installinit detects, that for a given /etc/init.d/network-manager there exists a /lib/systemd/system/network-manager.service (either as symlink or real file), it will wrap the invoke-rc.d call > if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = > "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then > if [ -x "/etc/init.d/network-manager" ]; then > update-rc.d network-manager defaults >/dev/null > if [ -n "$2" ]; then > _dh_action=restart > else > _dh_action=start > fi > if ! [ -d /run/systemd/system ]; then > invoke-rc.d network-manager $_dh_action || exit 1 > fi > fi > fi This would be a change of behaviour, so I'm not sure if this should be in compat 11 or deferred to compat 12. But afaics, the current dh_installsystemd in compat 11 is not actually working due to these ordering issues which are a result of no longer having two separate helpers which ran befor and after dh_installinit. -- Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?
#!/bin/sh
set -e
# This script can be called in the following ways:
#
# After the package was installed:
# <postinst> configure <old-version>
#
#
# If prerm fails during upgrade or fails on failed upgrade:
# <old-postinst> abort-upgrade <new-version>
#
# If prerm fails during deconfiguration of a package:
# <postinst> abort-deconfigure in-favour <new-package> <version>
# removing <old-package> <version>
#
# If prerm fails during replacement due to conflict:
# <postinst> abort-remove in-favour <new-package> <version>
case "$1" in
configure)
# Create netdev group. Members of group netdev get access to the
PolicyKit action
# org.freedesktop.NetworkManager.settings.modify.system without prior
authentication
addgroup --quiet --system netdev
NIF=/etc/network/interfaces
if [ -z "$2" ] && [ -f $NIF ]; then
ifaces=`grep -v '^#' $NIF | awk '/iface/ {print $2}' | sort -u |
sed -e 's/lo//' -e '/^$/d' -e 's/^/- /'`
if [ -n "$ifaces" ]; then
echo "" 1>&2
echo "The following network interfaces were found in $NIF" 1>&2
echo "which means they are currently configured by ifupdown:"
1>&2
echo "$ifaces" 1>&2
echo "If you want to manage those interfaces with
NetworkManager instead" 1>&2
echo "remove their configuration from $NIF." 1>&2
echo "" 1>&2
fi
fi
# Fix up existing /etc/resolv.conf symlinks after the migration to /run
if dpkg --compare-versions "$2" lt-nl "1.8.0-4"; then
if [ "$(readlink /etc/resolv.conf)" =
/var/run/NetworkManager/resolv.conf ] ; then
ln -sf /run/NetworkManager/resolv.conf /etc/resolv.conf
fi
fi
;;
abort-upgrade|abort-deconfigure|abort-remove)
;;
*)
echo "$0 called with unknown argument \`$1'" 1>&2
exit 1
;;
esac
# Automatically added by dh_installdeb/11.1.3
dpkg-maintscript-helper rm_conffile /etc/dbus-1/system.d/nm-avahi-autoipd.conf
1.1.90-2\~ -- "$@"
dpkg-maintscript-helper mv_conffile /etc/NetworkManager/dispatcher.d/01ifupdown
/etc/NetworkManager/dispatcher.d/01-ifupdown 1.8.0-5\~ -- "$@"
# End automatically added section
# Automatically added by dh_installinit/11.1.3
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" =
"abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -x "/etc/init.d/network-manager" ]; then
update-rc.d network-manager defaults >/dev/null
if [ -n "$2" ]; then
_dh_action=restart
else
_dh_action=start
fi
invoke-rc.d network-manager $_dh_action || exit 1
fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/11.1.3
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" =
"abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask 'NetworkManager.service' >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled 'NetworkManager.service'; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable 'NetworkManager.service' >/dev/null
|| true
else
# Update the statefile to add new symlinks (if any), which need
to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state 'NetworkManager.service'
>/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/11.1.3
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" =
"abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask 'NetworkManager-dispatcher.service'
>/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled
'NetworkManager-dispatcher.service'; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable 'NetworkManager-dispatcher.service'
>/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need
to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state
'NetworkManager-dispatcher.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/11.1.3
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" =
"abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask 'NetworkManager-wait-online.service'
>/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled
'NetworkManager-wait-online.service'; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable 'NetworkManager-wait-online.service'
>/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need
to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state
'NetworkManager-wait-online.service' >/dev/null || true
fi
fi
# End automatically added section
signature.asc
Description: OpenPGP digital signature

