41

I recently upgraded from 11.10 to 12.04, and now NetworkManager isn't populating /etc/resolv.conf when connecting to wireless networks, when it had been working perfectly in 11.10. I'm not seeing any explicit errors in either the NetworkManager, UI or in syslog. How do I diagnose what's wrong?

Edit: If I try to run resolvconf, I get the error

resolvconf: Error: /etc/resolv.conf isn't a symlink, not doing anything.

What should it be, a symlink to and/or how do I get NetworkManager to populate it? This says the symlink should point to /run/resolvconf/resolv.conf, but that file does not exist on my system.

  • I have tried a combination of the below solutions and then edited resolv.conf to include nameserver 127.0.0.1 because I had this problem about a year ago already and back then I think it had something to do with this line. After a restart the file was overwritten, but not with just comments but a different nameserver … line and some other things. Finally, it’s working… – Sebastian Simon Oct 26 '15 at 22:58
70

Use following command and answer YES to enable dynamic updates:

sudo dpkg-reconfigure resolvconf

Worked for me on Ubuntu 12.04.

  • 1
    Worked perfectly. Have an old laptop with 12.04 a dead battery that I unplugged by accident. Could ping my home router but not get web pages. Oddly could access other wifi network. This gave me access through home network again. – Mark D Sep 18 '12 at 4:06
  • The question remains: Why was the symlink missing? This question is being addressed in bug #1000244 (bugs.launchpad.net/ubuntu/+source/resolvconf/+bug/1000244). See comment #66 for my best guesses about the various causes of this problem. – jdthood Oct 28 '12 at 20:47
  • 2
    I wish there was a 'tip' or 'buy-me-a-beer' button on stack-exchange for thanking people. – Crisfole Oct 23 '13 at 13:51
  • 1
    I needed to do this even on Ubuntu 16.04 / Elementary OS 0.4 Loki – Reg Mem Oct 3 '16 at 17:15
  • 1
    This just happened to me on Ubuntu 16.10. The solution still works, although the dialog strongly suggests an immediate reboot. Edit: It happened out of the blue yesterday, more than a month after the upgrade. – ASalazar Nov 26 '16 at 4:15
16

I had the same problem. Seems that Ubuntu is using a local resolver now. The fastest way to remove that is to comment out the following line in /etc/NetworkManager/NetworkManager.conf:

#dns=dnsmasq

For more information, please take a look at this page.

  • 1
    Disabling that line and then restarting NM has no noticeable effect for me. The error still occurs and NM still refuses to populate resolv.conf. – Cerin May 15 '12 at 22:38
  • 1
    Thanks for this information! I also had to restart the network manager: sudo /etc/init.d/network-manager restart. – Ethan Leroy May 5 '14 at 17:14
5

If /etc/resolv.conf is a file then move it to /run/resolvconf/resolv.conf :

sudo mv /etc/resolv.conf /run/resolvconf/resolv.conf

Then create the symlink:

sudo ln -s ../run/resolvconf/resolv.conf /etc/resolv.conf
  • 1
    This helps. But easier and more reliable (typos) way for doing that is sudo dpkg-reconfigure resolvconf and answer YES. – geekQ Mar 28 '13 at 9:17
  • This is a great method if you're going to do dpkg-reconfigure resolvconf --frontend=noninteractive followed up resolvconf -u. If you don't move the file and symlink first, an unattended dpkg-reconfigure will fail because /etc/resolv.conf is not a symlink. – Justin Force Feb 19 '14 at 21:17
1

Had since a loooong time problems with my laptop, had to

sudo dhclient wlan0 

to be able to make the web work. Found that the resolv.conf was not updated by the network manager, and finally the

sudo dpkg-reconfigure resolvconf

solved my problem!

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.