0

Using Ubuntu 18.04 - My DNS suddenly stopped working. Just had installed Docker and minikube etc - not sure if this caused it - no idea.

I can ping an IP (like Google) but cannot ping google.com.

$ ping google.com ping: google.com: Temporary failure in name resolution

$ nslookup google.com ;; connection timed out; no servers could be reached

Tried a couple of things

$ sudo rm /etc/resolv.conf
$ sudo ln -s /run/resolvconf/resolv.conf /etc/resolv.conf
$ sudo systemctl restart resolvconf

  Failed to restart resolvconf.service: Unit resolvconf.service not found.

$ sudo systemctl stop networking`
Failed to stop networking.service: Unit networking.service not loaded

Tried (re)install resolve.conf - did not work

sudo apt install resolvconf 
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?


sudo apt install resolvconf --fix-missing
E: Internal Error, ordering was unable to handle the media swap

Thanks

3
  • the service is systemctl restart systemd-resolved.service
    – WU-TANG
    Sep 19, 2020 at 2:34
  • resolvectl status gives info
    – WU-TANG
    Sep 19, 2020 at 2:39
  • systemctl restart systemd-resolved.service - no output. resolvectl status resolvectl: command not found. My apt is not working so cant install anything. But problem remains
    – Sam-T
    Sep 19, 2020 at 4:01

1 Answer 1

1

DNS in Ubuntu (and probably others) has gotten.. complicated.

First off, to get yourself back online in the short term, do the following:

sudo rm /etc/resolv.conf
echo 'nameserver 8.8.8.8' | sudo tee -a /etc/resolv.conf

This will point you directly at Google's DNS servers and bypass whatever is happening on your system.

Under normal circumstances (at least on 18.04 server edition) netplan.io, resolvconf, systemd-networkd, and systemd-resolved all have to be happy with each other for DNS to work. The first step would be to see if systemd-resolved is working. Does sudo systemd-resolve --status return the correct info? How about sudo systemctl status systemd-resolved? If systemd-resolved is running correctly, edit /etc/resolv.conf and point the nameserver at "127.0.0.53". Are things still working? Then resolvconf might be the culprit.

4
  • echo 'nameserver 8.8.8.8' | sudo tee -a /etc/resolv.conf - this gets me up. sudo systemd-resolve --status - returns. So how do I set/edit the resolv.conf - do I install (apt), or just edit the resolv.conf. Do I I let both nameserver 8.8.8.8 and nameserver 127.0.0.53, or just 127.0.0.53?
    – Sam-T
    Sep 19, 2020 at 14:12
  • I just added these 3: nameserver 8.8.8.8 nameserver 8.8.4.4 nameserver 127.0.0.53 - seems to be working
    – Sam-T
    Sep 19, 2020 at 14:38
  • /etc/resolv.conf used to be just a plain file that was easy to maintain. The downside was that DHCP had a hard time configuring it so resolvconf became a thing. Then systemd decided to create a local caching server (systemd-resolved). You only need /etc/resolv.conf but the rest of that chain is useful. If you pare back to only "127.0.0.53" as your sole nameserver, does it still work? Sep 19, 2020 at 15:08
  • Pared back to only 127.0.0.53 - it works. So I will leave that one only for now. Still wondering what caused all this - had installed some software - nothing to do with networing/DNS etc
    – Sam-T
    Sep 19, 2020 at 15:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .