Red Hat Bugzilla – Bug 455825
NetworkManager messes up /etc/resolv.conf even when disabled
Last modified: 2013-07-02 23:19:08 EDT
Description of problem:
NetworkManager overwrites /etc/resolv.conf with a nonfunctional configuration at boot,
even though it's supposedly turned off.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. sudo /sbin/chkconfig NetworkManager off
2. correctly configure /etc/resolv.conf
4. notice /etc/resolv.conf has been trashed.
# generated by NetworkManager, do not edit!
# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
# SEARCH=lab.foo.com bar.foo.com
I'd like my configuration left alone, thank you very much.
Or at least set to what I have specified in the ifcfg-xxx files.
The mod timestamp on the overwritten file seems impossibly early, like before any of userland has started.
Don't tell me the kernel is invoking NetworkManager before anything else?
NM will never overwrite resolv.conf if NM isn't not active. And NM will respect
whatever you have in your ifcfg files, as long as you've told NM to manage that
device. Since at some point you ran NetworkManager, and apparently
NetworkManager was not connected to anything when you shut down, your
resolv.conf is no longer valid.
The problem here is that resolv.conf is not static. When you connect to a VPN,
you want that VPN's nameservers merged into your resolv.conf, otherwise it would
be pointless to connect to the VPN. But you don't want those VPN nameservers
present when you're not connected to the VPN, otherwise you won't be able to
resolve anything. _Something_ needs to modify resolv.conf and update it with
the correct DNS information. If the system-config-network scripts kept a
canonical copy of the resolv.conf file somewhere, we could make NetworkManager
restore that copy when it shuts down. But as long as /etc/resolv.conf is the
only canonical source for DNS information, there's not much you can do when you
have to update it with new info.
So in short, NM isn't messing up resolv.conf when it's not running. It's
because you turned NM off that your resolv.conf isn't getting updated any more.
When you change your network configuration (such as turning NM off) you'll also
need to make sure your resolv.conf is correct.
I did *not* run NM, at least not intentionally, and I can't find any part of the system startup scripts that
invoked it either. If you can tell me where to deactivate it so it stays deactivated, I'd be happy.