3

In Scientific Linux 5.5, /etc/resolv.conf is continually overwritten and so DNS is broken. If I delete or change it, it instantly reverts to its former state. Writing over it with: cp /etc/NEWresolve.conf /etc/resolv.conf && chattr +i /etc/resolv.conf just results in an immutable copy of the original resolv.conf with no changes. I'm running as root (not sudo) and Avahi and NetworkManager are not running.

Any ideas? There's no DHCP anywhere on this machine, and even if there were, I can't imagine it'd overwrite the file so quickly.

Thanks

Some ancillary info: uname -a Linux localhost.localdomain 2.6.18-238.12.1.el5 #1 SMP Tue May 31 13:12:32 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux Intel I340 (82580) NIC

9
  • what is the output of: lsof /etc/resolv.conf ? Commented Jul 10, 2011 at 2:07
  • 1
    If you are at the console, try rebooting into single user mode and editing the file. If you still have the same problem, I suspect there may be a kernel module on your server that is doint this. Commented Jul 10, 2011 at 2:18
  • 1
    Single user mode worked. I made it immutable and the file remains untouched after reboot. Thanks a lot! Just for curiosity is there something specific you had in mind when you suggested that?
    – user837237
    Commented Jul 10, 2011 at 2:51
  • 1
    Are you running resolvconf?
    – Jodie C
    Commented Jul 10, 2011 at 4:31
  • 2
    A kernel module that modifies resolv.conf? Incredibly unlikely.
    – womble
    Commented Jul 10, 2011 at 5:19

2 Answers 2

2

NetworkManager is a likely culprit. NetworkManager will overwrite /etc/resolv.conf, and could explain the behavior you are seeing. However, I think NetworkManager typically adds a warning to the file like # Managed by NetworkManager, do not edit.

From the GUI, you can configure NetworkManager to not overwrite /etc/resolve.conf .

NetworkManager is considered harmful on many systems (Servers, virtualization hosts) because it overwrites your manual settings without warning you, and it doesn't support advanced networking features. You might want to to just shut down the service and prevent it from starting at next reboot.

1
  • 1
    If you really need NM you can mark interfaces as NM_CONTROLLED=no in their respective /etc/sysconfig/network-scripts/ifcfg-* files. You can also set the nameservers there.
    – AndreasM
    Commented Jul 15, 2011 at 20:00
0
find /etc -inum `ls -i /etc/resolv.conf | awk '{print $1}'`

and see how modifies the other files

You must log in to answer this question.