#800643 avahi-daemon: Failed to open /etc/resolv.conf: Invalid argument chroot.c: open() failed: No such file or directory #800643
- Package:
- avahi-daemon
- Source:
- avahi
- Description:
- Avahi mDNS/DNS-SD daemon
- Submitter:
- Erik
- Date:
- 2022-06-05 16:36:03 UTC
- Severity:
- normal
- Tags:
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. ...
Been looking through my journal for errors, and noticed this.
I assume I'm seeing the same bug.
A few additional pieces of info for you (that may or may not be helpful):
Jul 2 22:04:41 Love2d avahi-daemon[621]: Successfully dropped
remaining capabilities.
Jul 2 22:04:41 Love2d avahi-daemon[630]: chroot.c: open() failed:
No such file or directory
Jul 2 22:04:41 Love2d avahi-daemon[621]: Failed to open
/etc/resolv.conf: Invalid argument
Jul 2 22:04:41 Love2d avahi-daemon[621]: No service file found in
/etc/avahi/services.
---------------------------------------------------------------------------------
/etc/resolv.conf is linked like this:
resolv.conf -> /var/run/NetworkManager/resolv.conf
cat resolv.conf gives:
# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 8.8.4.4
From man pages:
nameserver Name server IP address
Internet address of a name server that the resolver
should query, either an IPv4 address (in dot notation), or an IPv6
address in colon (and possibly dot) notation as per RFC
2373. Up to MAXNS (currently 3, see <resolv.h>) name servers may be
listed, one per keyword. If there are multiple servers,
the resolver library queries them in the order listed. If no name‐
server entries are present, the default is to use the
name server on the local machine. (The algorithm used is to try a
name server, and if the query times out, try the next,
until out of name servers, then repeat trying all the name servers
until a maximum number of retries are made.)
---------------------------------------------------------------------------------
avahi.org is temporarily unavailavable, a couple of quick links are
available below
* doxygen documentation <http://www.avahi.org/doxygen/>
* avahi 0.6.32
<https://github.com/lathiat/avahi/releases/download/v0.6.32/avahi-0.6.32.tar.gz>
* github: lathiat <http://github.com/lathiat/avahi>
* mailing list <http://lists.freedesktop.org/mailman/listinfo/avahi>
i morkaround this way cat /lib/systemd/system/avahi-daemon.service [Unit] Description=Avahi mDNS/DNS-SD Stack After=network-online.target [Service] Type=dbus BusName=org.freedesktop.Avahi ExecStart=/usr/sbin/avahi-daemon -s ExecReload=/usr/sbin/avahi-daemon -r NotifyAccess=main [Install] WantedBy=multi-user.target Also=avahi-daemon.socket Alias=dbus-org.freedesktop.Avahi.service
Reproduced here with debian-9.1.0-amd64+Gnome Appending this line: After=network-online.target to the [Unit] section of /lib/systemd/system/avahi-daemon.service then at next boot avahi-daemon message disappears.
Reproduced in several computers with Debian 9.2 : $ sudo journalctl -b -p err -- Logs begin at Tue 2017-11-21 22:12:42 CET, end at Thu 2017-11-23 14:22:56 CET. -- nov 23 14:21:31 system avahi-daemon[490]: chroot.c: open() failed: No such file or directory If that workaround is a solution, please fix this for next updates.
Hello, Am Manley Marcus Kobenan, a banker, a France origin but resided here in Cote d'Ivoire for work, I stopped at your profile and will love to know more about you,I have a business that will profit both of us in your country that I want us to discuss about. I will be glad to hear from you soon for more details, take care dear. Manley Marcus Kobenan
This issue has supposedly been fixed in https://github.com/systemd/systemd/commit/3e06055500755053050620a45236ef606507e1bd which is part of systemd v234 and later.