Package: avahi-daemon Version: 0.6.31-5 Severity: normal Tags: patch avahi-daemon.service produces errors in the journal when used with systemd-networkd and systemd-resolved. The avahi-daemon cannot open the /etc/resolv.conf file because it starts before systemd-resolved. Journal entries are provided below.
Background: According to `man systemd-resolved,` it is advisable to remove /etc/resolv.conf and link /etc/resolv.conf to /run/systemd/resolve/resolv.conf. The reason being that systemd-resolved will read nameservers from systemd.network files and populate /run/systemd/resolve/resolv.conf. When avahi-daemon starts before systemd-resolved, the target of the /etc/resolv.conf link is not present on /run. Therefore, avahi-daemon.service is dependent on systemd-resolve. Solution: Change avahi-daemon's dependency on /etc/resolv.conf and read /run/systemd/resolve/resolv.conf instead and add a "After=systemd-resolved.service" to avahi-daemon.service. This also creates other problems. What about network mounts in /etc/fstab using nfs or samba? I've also had to put mount options for a cifs mount like "x-systemd.requires=systemd-networkd-wait-online.service" in /etc/fstab. When avahi-daemon does not load, name resolution fails, all kinds of network related services fail. Now everything has to have "After=systemd-networkd-wait-online" added to their systemd.unit files. This means the system pauses significantly; i.e. services block. What else needs to read /etc/resolv.conf? At this time there is no libnss-resolve (libnss-resolve.so, shipped with systemd) to add a "resolve" in /etc/nsswitch.conf for systemd-resolved. Everything that depends on /etc/resolv.conf will also need After=systemd-networkd-wait-online.service lines added to their systemd.unit files too. Another bug could be filed with systemd since systemd-resolved is there. Workaround: # Execute as root mkdir -p /etc/systemd/system/avahi-daemon.service.d printf "[Unit]\nAfter = systemd-resolved.service\n" > \ /etc/systemd/system/avahi-daemon.service.d/ad.conf systemctl daemon-reload Journal: Oct 01 18:41:32 incense avahi-daemon[625]: Successfully dropped root privileges. Oct 01 18:41:32 incense avahi-daemon[625]: avahi-daemon 0.6.31 starting up. Oct 01 18:41:49 incense avahi-daemon[625]: Successfully called chroot(). Oct 01 18:41:49 incense avahi-daemon[625]: Successfully dropped remaining capabilities. Oct 01 18:41:49 incense avahi-daemon[734]: chroot.c: open() failed: No such file or directory Oct 01 18:41:49 incense avahi-daemon[625]: Failed to open /etc/resolv.conf: Invalid argument Oct 01 18:41:49 incense avahi-daemon[625]: No service file found in /etc/avahi/services. Oct 01 18:41:49 incense avahi-daemon[625]: Network interface enumeration completed. Oct 01 18:41:49 incense avahi-daemon[625]: Registering HINFO record with values 'I686'/'LINUX'. Oct 01 18:41:49 incense avahi-daemon[625]: Server startup complete. Host name is incense.local. Local service cookie is 128518944. Oct 01 18:41:49 incense avahi-daemon[625]: Joining mDNS multicast group on interface enp3s0.IPv4 with address 192.168.7.61. Oct 01 18:41:49 incense avahi-daemon[625]: New relevant interface enp3s0.IPv4 for mDNS. Oct 01 18:41:49 incense avahi-daemon[625]: Registering new address record for 192.168.7.61 on enp3s0.IPv4. ... -- System Information: Debian Release: stretch/sid APT prefers testing APT policy: (500, 'testing') Architecture: i386 (i686) Kernel: Linux 4.1.0-2-686-pae (SMP w/2 CPU cores) Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages avahi-daemon depends on: ii adduser 3.113+nmu3 ii bind9-host [host] 1:9.9.5.dfsg-12 ii dbus 1.10.0-3 ii init-system-helpers 1.23 ii libavahi-common3 0.6.31-5 ii libavahi-core7 0.6.31-5 ii libc6 2.19-20 ii libcap2 1:2.24-11 ii libdaemon0 0.14-6 ii libdbus-1-3 1.10.0-3 ii libexpat1 2.1.0-7 ii lsb-base 9.20150917 Versions of packages avahi-daemon recommends: ii libnss-mdns 0.10-6 Versions of packages avahi-daemon suggests: pn avahi-autoipd <none> -- Configuration Files: /etc/avahi/avahi-daemon.conf changed: [server] use-ipv4=yes use-ipv6=no ratelimit-interval-usec=1000000 ratelimit-burst=1000 [wide-area] enable-wide-area=yes [publish] [reflector] [rlimits] rlimit-core=0 rlimit-data=4194304 rlimit-fsize=0 rlimit-nofile=768 rlimit-stack=4194304 rlimit-nproc=3 -- no debconf information