NetworkManager not populating resolv.conf

95,351

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!

Share:
95,351

Related videos on Youtube

Cerin
Author by

Cerin

Updated on September 18, 2022

Comments

  • Cerin
    Cerin over 1 year

    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.

  • Cerin
    Cerin almost 12 years
    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.
  • Mark D
    Mark D over 11 years
    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.
  • jdthood
    jdthood over 11 years
    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.
  • geekQ
    geekQ about 11 years
    This helps. But easier and more reliable (typos) way for doing that is sudo dpkg-reconfigure resolvconf and answer YES.
  • Chris Pfohl
    Chris Pfohl over 10 years
    I wish there was a 'tip' or 'buy-me-a-beer' button on stack-exchange for thanking people.
  • ErsatzRyan
    ErsatzRyan about 10 years
    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.
  • Ethan Leroy
    Ethan Leroy about 10 years
    Thanks for this information! I also had to restart the network manager: sudo /etc/init.d/network-manager restart.
  • Reg Mem
    Reg Mem over 7 years
    I needed to do this even on Ubuntu 16.04 / Elementary OS 0.4 Loki
  • ASalazar
    ASalazar over 7 years
    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.