LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   /etc/resolv.conf getting automatically written over....HELP PLEASE! (https://www.linuxquestions.org/questions/linux-newbie-8/etc-resolv-conf-getting-automatically-written-over-help-please-589977/)

cbradlea 10-06-2007 11:25 PM

/etc/resolv.conf getting automatically written over....HELP PLEASE!
 
Hi all;

I just recently upgraded my system from mandriva 2007 to cooker 2008.
The problem is that my /etc/resolve.conf which was working fine seems to have been updated with a bunch of new entries. I go in and manually edit it but every time I boot or run dhclient it rewrites the file and re enters all the entries I have edited out. How do I stop the system from regenerating this file automatically. I tried changing the permission to read only but that didn't help, it still got over written. I would appreciate any help you could give thanks.

Chris

jonwatson 10-06-2007 11:28 PM

I'm sure there is a more elegant way, but as a lazy hack you could make it immutable

chattr +i /etc/resolv.conf

cbradlea 10-07-2007 12:08 AM

Hi thanks

I tried that and it did work but it gave me a new error message during start up saying?

FAILED to write to resolv.conf, I can't find the exact error as I'm not sure what log shows the started [ok] or [failed] start up entries.


I looked in the the messages log and found these entries. These seem to be the file over writing my edits.

Oct 6 12:31:38 HELL NET[4339]: /etc/sysconfig/network-scripts/ifup-post : updated /etc/resolv.conf

Oct 6 12:21:58 HELL NET[6137]: /sbin/dhclient-script : updated /etc/resolv.conf

Are there any other ideas? Thanks.

jonwatson 10-08-2007 07:36 AM

Well, yeah. Once you make it immutable noboody (including root) can write to it. You would have to remove the immutable bit with chattr -i /etc/resolv.conf

So this is an expected error and I thought it was what you wanted. If it's causing other problems then remove the immutable bit.

Your resolv.conf file just holds the names of your nameservers. What are you putting in there and what is it being overwritten with?

cbradlea 10-08-2007 11:26 AM

Thanks Jon;


This is what I want in there?

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
search gv.shawcable.net
nameserver 64.59.160.15
nameserver 64.59.160.13

But this is what is showing up. I have tried emptying the file completely, everything, permission. but can't fix it. The problem is with it like this having 6 item it's SUPER slow to connect to the internet like a minute before a page comes up.


nameserver 64.59.160.13
nameserver 64.59.160.15
search gv.shawcable.net
search gv.shawcable.net
nameserver 64.59.160.15
nameserver 64.59.160.13

Thanks again for any help you can give.
Chris

linux obsessed 10-08-2007 12:04 PM

you must use static ip not dhcp
do it from your network setting in you r distro
regards

cbradlea 10-08-2007 08:46 PM

In my distro Mandriva 2008 I do have it as a manual not DHCP. Which is weird, Too me this file should not getting updated.

jonwatson 10-09-2007 08:02 PM

Quote:

Originally Posted by cbradlea (Post 2917856)
In my distro Mandriva 2008 I do have it as a manual not DHCP. Which is weird, Too me this file should not getting updated.

When your computer DHCPs it not only gets an IP address, but it also gets the nameservers.

If you have access to the DHCP server, you can put your Shaw nameservers in there, but if you don't then you'll have to go static as others have pointed out.


All times are GMT -5. The time now is 09:54 AM.