On my Ubuntu Eoan laptop, I find that systemd-resolved sporadically inexplicably fails to respond to local DNS requests to even when requests to my router's DNS server still work, so I want to keep things simple and cut off systemd-resolved.

(Specifically, after the WiFi disconnects and then reconnects, the local DNS server at provided by systemd-resolved in /etc/resolv.conf stops responding to requests until I manually 'systemctl restart systemd-resolved'.)

I'm using a Wireless network with DHCP with wicd, normally controlling it with wicd-gtk. How can I configure my system properly so that under a WiFi connection with DHCP, I'll use the DNS server assigned by the DHCP? I've disabled the systemd-resolved service but that seemed insufficient. That just left behind a /etc/resolv.conf symlinked to a non-existent /run/systemd/resolve/stub-resolv.conf. Even if I remove that, a /etc/resolv.conf file gets created by NetworkManager pointing to the useless when I reconnect to the WiFi. Even if I remove that file and stop NetworkManager and then reconnect to the WiFi, I get no /etc/resolv.conf, so DNS lookups have no server to use.

How can I configure wicd or my system's network settings properly to do the normal setting up of the DNS server in addition to the setting up of the local IP address, subnet and gateway under the WiFi DHCP? I normally use wicd-gtk to manually select a WiFi to connect to. Also, there's no problem with the WiFi, as other devices have no problems and previously with systemd-resolved running it sometimes worked and sometimes didn't work. Also, I'm trying to avoid using NetworkManager because I'm using xmonad without a system-tray so I can't easily use the NetworkManager system-tray GUI.

One thing that looks quite very suspicious to me in the system log after I connected to the WiFi is that systemd-resolved did not restart after dhclient got a DHCPACK. systemd-resolved got started just before that when presumably the network was still not ready. So, it seems that /etc/dhcp/dhclient-enter-hooks.d/resolved is not working as intended.

EDIT: It seems that by disabling systemd-resolved, I have run into a known bug: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1745463


The sporadic problem sounds like bugs 1396379 and 1805027 and 1804487. I found the solution to my sporadic 18.04 name resolution failures was to add the package libnss-resolve. This altered the /etc/nsswitch.conf hosts line to be:

hosts:          files mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns myhostname  

No other changes were needed to the default install. Leave the /etc/resolv.conf link to the default stub-resolv.conf.

| improve this answer | |
  • 1
    Installing libnss-resolve didn't help. I still had to manually 'systemctl restart systemd-resolved' after each WiFi reconnection. – Syncopated Nov 30 '19 at 6:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.