Bug 455825 - NetworkManager messes up /etc/resolv.conf even when disabled
Summary: NetworkManager messes up /etc/resolv.conf even when disabled
Alias: None
Product: Fedora
Classification: Fedora
Component: NetworkManager
Version: 9
Hardware: x86_64
OS: Linux
Target Milestone: ---
Assignee: Dan Williams
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2008-07-18 02:39 UTC by Tom Lane
Modified: 2013-07-03 03:19 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2008-07-18 17:33:46 UTC
Type: ---

Attachments (Terms of Use)

Description Tom Lane 2008-07-18 02:39:28 UTC
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):

How reproducible:

Steps to Reproduce:
1.  sudo /sbin/chkconfig NetworkManager off
2.  correctly configure /etc/resolv.conf
3.  reboot
4.  notice /etc/resolv.conf has been trashed.
Actual results:
# generated by NetworkManager, do not edit!

# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# SEARCH=lab.foo.com bar.foo.com

Expected results:
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.

Additional info:
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?

Comment 1 Dan Williams 2008-07-18 17:33:46 UTC
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.

Comment 2 Tom Lane 2008-07-18 20:02:25 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.