Bugzilla – Bug 1131075
dnsmasq: directory /etc/resolv.conf for resolv-file is missing, cannot poll
Last modified: 2020-09-17 13:14:02 UTC
Hello, I am running dnsmasq-2.78-lp151.4.1.armv7hl on Leap 15.1 and see the following when dnsmasq.service tries to start during boot: Mar 31 19:11:39 localhost dnsmasq[993]: dnsmasq: syntax check OK. Mar 31 19:11:39 localhost dnsmasq[998]: directory /etc/resolv.conf for resolv-file is missing, cannot poll Mar 31 19:11:39 localhost dnsmasq[998]: dnsmasq: directory /etc/resolv.conf for resolv-file is missing, cannot poll Mar 31 19:11:39 localhost dnsmasq[998]: FAILED to start up localhost:~ # ls -l /etc/resolv.conf lrwxrwxrwx 1 root root 30 Mar 31 17:31 /etc/resolv.conf -> /var/run/netconfig/resolv.conf localhost:~ # cat /etc/resolv.conf ### /etc/resolv.conf is a symlink to /var/run/netconfig/resolv.conf ### autogenerated by netconfig! # # Before you change this file manually, consider to define the # static DNS configuration using the following variables in the # /etc/sysconfig/network/config file: # NETCONFIG_DNS_STATIC_SEARCHLIST # NETCONFIG_DNS_STATIC_SERVERS # NETCONFIG_DNS_FORWARDER # or disable DNS configuration updates via netconfig by setting: # NETCONFIG_DNS_POLICY='' # # See also the netconfig(8) manual page and other documentation. # ### Call "netconfig update -f" to force adjusting of /etc/resolv.conf.
Fallout from the move of resolv.conf to /run. Marius, how about creating bot the symlink in /etc as well as the file in run via tmpfiles mechanism? That is done very early by systemd so that way we should be able to create a resolv.conf with only the stub header.
Actually needinfo Marius..
AFAICS there is nothing wrong with dnsmasq here, reassigning.
Whoops, did everything except for the actual reassignment.
Hmm - maybe it could also be fixed via service file dependencies. I see that dnsmasq.service orders itself after network.target and before nss-lookup.target. Is there anything else it could hook to that makes sure it doesn't get started until /etc/resolve.conf is actually there?
yes, there is network-online.target (mind bug 1130355). If dnsmasq monitors resolv.conf and can update itself when resolv.conf changes there should be no need to use that crutch though. We just need to make sure resolv.conf is there even when empty.
I checked this again, and dnsmasq only needs the directory containing the resolv file for a successful startup, so that it can put an inotify on it. The resolv file itself does not need to exist and will be picked up by dnsmasq through inotify as soon as it appears. So, either /etc or /var/run/netconfig must be missing at the point in time when dnsmasq fails to start. Unfortunately these two cases cannot be distinguished from the error message and I cannot imagine for either of the two to not exist at that point in time, given that dnsmasq orders itself After=network.target .
/var/run is symlink to /run which is mounted as tmpfs. # ls -l /var/run lrwxrwxrwx 1 root root 4 Mar 31 07:49 /var/run -> /run
Now I use resolv-file=/var/run/netconfig/resolv.conf in dnsmasq config to overcome symlink resolution. dnsmasq still fails at the startup. Apr 01 19:09:41 localhost dnsmasq[999]: dnsmasq: syntax check OK. Apr 01 19:09:41 localhost dnsmasq[1005]: dnsmasq: directory /var/run/netconfig/resolv.conf for resolv-file is missing, cannot poll Apr 01 19:09:41 localhost dnsmasq[1005]: directory /var/run/netconfig/resolv.conf for resolv-file is missing, cannot poll Apr 01 19:09:41 localhost dnsmasq[1005]: FAILED to start up
Does it work if you use this? resolv-file=/run/netconfig/resolv.conf
try # echo "d /run/netconfig 0755 root root -" > /etc/tmpfiles.d/netconfig.conf
(In reply to Reinhard Max from comment #10) > Does it work if you use this? > > resolv-file=/run/netconfig/resolv.conf It still fails: Apr 01 19:18:39 localhost dnsmasq[975]: dnsmasq: syntax check OK. Apr 01 19:18:39 localhost dnsmasq[980]: dnsmasq: directory /run/netconfig/resolv.conf for resolv-file is missing, cannot poll Apr 01 19:18:39 localhost dnsmasq[980]: directory /run/netconfig/resolv.conf for resolv-file is missing, cannot poll Apr 01 19:18:39 localhost dnsmasq[980]: FAILED to start up
In this case, Ludwig's suggestion from comment 11 should help and work even without a resolv-file line in the dnsmasq config.
(In reply to Ludwig Nussel from comment #11) > try > > # echo "d /run/netconfig 0755 root root -" > /etc/tmpfiles.d/netconfig.conf This makes dnsmasq successfully running both with resolv-file=/run/netconfig/resolv.conf and resolv-file=/etc/resolv.conf
Duplicate of boo#1123699 where we've added it: localhost:~ # cat /usr/1123699lib/tmpfiles.d/netconfig.conf d /run/netconfig 0755 root root - f /run/netconfig/resolv.conf 0644 root root - f /run/netconfig/yp.conf 0644 root root - L /etc/resolv.conf - - - - /run/netconfig/resolv.conf L /etc/yp.conf - - - - /run/netconfig/yp.conf *** This bug has been marked as a duplicate of bug 1123699 ***