Bug#1004333: deb-systemd-helper does not recognize purged package
Marc Haber
mh+debian-packages at zugschlus.de
Mon Jan 24 22:12:54 GMT 2022
Package: init-system-helpers
Version: 1.61
Severity: normal
File: /usr/bin/deb-systemd-helper
Hi,
given the following code in a maintainer script:
postinst
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper mask 'sudo.service' || true
fi
postrm
case "$1" in
purge)
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper unmask 'sudo.service' || true
fi
the masking symlink stays around after purge. When the package is
installed, ther is no sudo.service marker file in /var/lib/systemd/deb-systemd-helper-masked/
dpkg/deb-systemd-helper output from package installation:
root at salida:~# dpkg --list sudo
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
un sudo <none> <none> (no description available)
root at salida:~# dpkg --install /home/mh/packages/sudo/build-area/sudo_1.9.8p2-2~1_amd64.deb
Selecting previously unselected package sudo.
(Reading database ... 42180 files and directories currently installed.)
Preparing to unpack .../sudo_1.9.8p2-2~1_amd64.deb ...
Unpacking sudo (1.9.8p2-2~1) ...
Setting up sudo (1.9.8p2-2~1) ...
(deb-systemd-helper DEBUG) is purge = no
(deb-systemd-helper DEBUG) action = mask, scriptname = sudo.service, service_path = sudo.service
Processing triggers for libc-bin (2.33-3) ...
Processing triggers for man-db (2.9.4-4) ...
root at salida:~# ls -la /var/lib/systemd/deb-systemd-helper-masked/
total 8
drwxr-xr-x 2 root root 4096 Jan 5 21:55 .
drwxr-xr-x 11 root root 4096 Jan 5 21:55 ..
-rw-r--r-- 1 root root 0 Jan 5 21:55 systemd-timesyncd.service
root at salida:~#
dpkg/deb-systemd-helper output from package purge:
root at salida:~# dpkg --purge sudo
(Reading database ... 42313 files and directories currently installed.)
Removing sudo (1.9.8p2-2~1) ...
Purging configuration files for sudo (1.9.8p2-2~1) ...
(deb-systemd-helper DEBUG) is purge = no
(deb-systemd-helper DEBUG) action = unmask, scriptname = sudo.service, service_path = sudo.service
(deb-systemd-helper DEBUG) Not unmasking /etc/systemd/system/sudo.service because the state file /var/lib/systemd/deb-systemd-helper-masked/sudo.service does not exist
(deb-systemd-helper DEBUG) rmdir_if_empty /var/lib/systemd/deb-systemd-helper-masked
(deb-systemd-helper DEBUG) rmdir(/var/lib/systemd/deb-systemd-helper-masked) failed (Directory not empty)
(deb-systemd-helper DEBUG) rmdir_if_empty /var/lib/systemd/deb-systemd-user-helper-masked
(deb-systemd-helper DEBUG) rmdir(/var/lib/systemd/deb-systemd-user-helper-masked) failed (No such file or directory)
dpkg: warning: while removing sudo, directory '/etc/sudoers.d' not empty so not removed
Processing triggers for libc-bin (2.33-3) ...
Processing triggers for man-db (2.9.4-4) ...
root at salida:~# ls -al /etc/systemd/system/sudo.service
lrwxrwxrwx 1 root root 9 Jan 23 23:25 /etc/systemd/system/sudo.service -> /dev/null
root at salida:~#
What is going wrong here?
Greetings
Marc
-- System Information:
Debian Release: bookworm/sid
APT prefers stable-security
APT policy: (500, 'stable-security'), (500, 'unstable'), (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 5.16.1-zgsrv20080 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8), LANGUAGE=en
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages init-system-helpers depends on:
ii perl-base 5.32.1-6
init-system-helpers recommends no packages.
init-system-helpers suggests no packages.
Versions of packages init-system-helpers is related to:
pn insserv <none>
-- no debconf information
More information about the Pkg-systemd-maintainers
mailing list