NetworkManager not populating resolv.conf

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.


Solution 1:

Use following command and answer YES to enable dynamic updates:

sudo dpkg-reconfigure resolvconf

Worked for me on Ubuntu 12.04.

Solution 2:

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.

Solution 3:

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

Solution 4:

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!