A weird question on DNS and booting Mandrake

Edgar Allen era at sky.net
Sat Apr 14 08:56:49 CDT 2001


>
>Every time I boot my Mandrake 7.2 machine, it overwrites /etc/resolv.conf so 
>that it contains only one entry, 127.0.0.1, which frankly doesn't do me a lot 
>of good.  I have made myself a short script called fix.dns that copies the 
>correct version of resolv.conf in its place, and I've taken to running that 
>as root before doing anything net-related such as reading mail.
>
>There's got to be a better way.  Who can tell me where to look to stop the 
>automatic overwriting of /etc/resolv.conf?
>
>This started one day after I'd been looking around in the various screens of 
>linuxconf.  I thought I wasn't actually changing anything, just looking 
>around, but maybe linuxconf thought differently.
>

You can brute force it into not altering the file you put there...

>From the man page for chattr:

    A file with the `i' attribute cannot be modified: it cannot be
    deleted or renamed, no link can  be  created to this file and no
    data can be written to the file. Only the superuser can set or
    clear this attribute.

So just:

    chattr +i /etc/resolv.conf

and it will stop changing but to locate the source of the problem
first try:

    find /etc -name 'resolv.conf,v'

because I suspect that they use CVS to keep track of the changes.

If that finds nothing try:

    find /etc/*/. -name 'resolv.conf*'

If you find it you can remove it, even as root it may resist, but
I think 'rm -f' should work.

If it has its 'immutable' flag set just:

    chattr -i <path to resolv.conf,v>

and then remove it.




More information about the Kclug mailing list