[Pkg-utopia-maintainers] Bug#1051442: libnss-mdns can not access /run/avahi-daemon after reinstalling avahi-daemon due to its postrm script
Max Nikulin
manikulin at gmail.com
Fri Sep 8 06:06:46 BST 2023
Package: avahi-daemon
Version: 0.8-10
Severity: normal
I was experimenting with multicast name resolution performed by
libnss-mdns and libnss-resolve when I got the following failure.
apt purge avahi-daemon
# some experiments with systemd-resolved
apt install avahi daemon
getent hosts somehost.local
Nothing returned despite at this moment mdns4_minimal was present in
/etc/nsswitch.conf. Using strace I have find the reason of failure:
connect(3, {sa_family=AF_UNIX, sun_path="/run/avahi-daemon/socket"},
110) = -1 EACCES (Permission denied)
ls -ld /run/avahi-daemon
drwx------ 2 avahi avahi 80 Sep 8 10:43 /run/avahi-daemon
However it should be
drwxr-xr-x 2 avahi avahi 80 Sep 8 11:07 /run/avahi-daemon
I believe that the reason is
/var/lib/dpkg/info/avahi-daemon.postrm
# Cleanup /run/avahi-daemon, see #448539
f=/run/avahi-daemon
if [ -d "$f" ]; then
rmdir "$f" || { chown root:root "$f" && chmod 00700 "$f"; }
fi
This code snippet is not ready to current behavior of avahi-daemon
process that does not remove its PID file (#876342) and the socket
(#849454) on exit.
Purging configuration files for avahi-daemon (0.8-10) ...
rmdir: failed to remove '/run/avahi-daemon': Directory not empty
Behavior of mDNS may be surprising due to "SOA local" heuristics in
libnss-mdns and unicast settings of ISP provider. It is unfortunate that
the package script contributes to this mess as well. I admit that purge
and install again without reboot in between scenario is not frequent.
Perhaps the /run/avahi-daemon directory should be removed by rm -r or by
another not so shy method. Anyway files in /run do not survive reboot.
Workaround:
systemctl stop avahi-daemon.service
rm -r /run/avahi-daemon/
More information about the Pkg-utopia-maintainers
mailing list