View previous topic :: View next topic |
Author |
Message |
magister n00b
Joined: 07 Nov 2003 Posts: 13
|
Posted: Mon Sep 18, 2006 7:11 am Post subject: resolv.conf gets clobbered on boot [SOLVED] |
|
|
I just finished a fresh install on a new hard drive, and everything seems fine except I can't seem to keep any DNS server addresses in my resolv.conf. I can replace /etc/resolv.conf with a copy of the one generated by the livecd during install (which has three nameservers listed) and everything will work fine for a while, but it gets replaced every time I reboot with one that looks like this:
Code: | # Generated by net-scripts for interface lo
domain lan
|
I thought I followed the install guide pretty meticulously, but I wound up with this problem anyway. Any thoughts?
Last edited by magister on Tue Sep 19, 2006 8:45 pm; edited 1 time in total |
|
Back to top |
|
|
Kosmas Apprentice
Joined: 14 Sep 2006 Posts: 280 Location: Greece
|
Posted: Mon Sep 18, 2006 9:08 am Post subject: |
|
|
The resolv.conf file is generated at boot time overwriting anything in there. You have to add your dns servers to the /etc/conf.d/net config file
somewhere like Code: | dns_servers_eth0="xxx.xxx.xxx.xxx yyy.yyy.yyy.yyy" |
where xxx.xxx.xxx.xxx and yyy.yyy.yyy.yyy are the addresses of the dns servers you want to use. |
|
Back to top |
|
|
magister n00b
Joined: 07 Nov 2003 Posts: 13
|
Posted: Tue Sep 19, 2006 1:27 am Post subject: |
|
|
Thanks, that seems to have fixed it. Looks like that's been left out of the installation guide. |
|
Back to top |
|
|
Kosmas Apprentice
Joined: 14 Sep 2006 Posts: 280 Location: Greece
|
Posted: Tue Sep 19, 2006 1:47 pm Post subject: |
|
|
No problem. Just if you please edit your post and add [SOLVED] to the subject. |
|
Back to top |
|
|
cayenne l33t
Joined: 17 Oct 2002 Posts: 945 Location: New Orleans
|
Posted: Wed Jun 11, 2008 1:59 pm Post subject: Thank you |
|
|
magister wrote: | Thanks, that seems to have fixed it. Looks like that's been left out of the installation guide. |
Thank you, this helped me too..was having several problem with new boxes....losing their resolv.conf on every boot...
This really does need to be added to the install manuals!!
C _________________ Light travels faster than sound. This is why some people appear bright until you hear them speak......... |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
|
Stefano Crocco Apprentice
Joined: 28 Sep 2006 Posts: 157
|
Posted: Thu Jun 12, 2008 2:55 pm Post subject: /etc/resolv.conf overwritten at boot |
|
|
Hello to everyone.
Since today, I'm having some problems with the /etc/resolv.conf file. I used to keep there the dns provided by my isp and everything worked correctly. Today, after an emerge --sync followed by emerge --update world and a reboot, I found out that that file had been replaced by one with the following content:
Code: |
# Generated by net-scripts for interface lo
domain casa
|
Following the Gentoo Installation Guide, I tried to add the "nodns" option to the dchp_eth0 entry in /etc/conf.d/net and /etc/conf.d/net.eth0 (I didn't know which was the correct one, so I tried both). What I found out is that the option was already there (which should have been obvious to me, since I knew I was managing that file by hand, but I had forgot). At any rate, that option doesn't seem to have any effect.
In despair, I also tried to make the /etc/resolv.conf file read only (chmod a-w /etc/resolv.conf), but still, after reboot I found that the file had been overwritten.
Has anybody some idea of who is changing the file and/or how I can stop it from doing it?
Thanks in advance _________________ Stefano |
|
Back to top |
|
|
infernus n00b
Joined: 11 Jan 2008 Posts: 24 Location: US
|
Posted: Thu Jun 12, 2008 3:26 pm Post subject: |
|
|
I'm not exactly sure what is changing it but if you have root access on your machine do this:
1. Edit /etc/resolv.conf and add whatever DNS servers you need
2. Instead of making it read-only, you can make it immutable by running the following command as root (or with sudo)
Code: | # chattr +i /etc/resolv.conf |
Now you can't edit it unless you reverse the command by using "-i" instead of "+i"
Even the system can't overwrite that now. Hope that helps. _________________ --
Sal.
Linux latitude 2.6.25-hardened-r4 #1 SMP Sat Aug 23 15:23:14 EDT 2008 i686 Intel(R) Core(TM)2 Duo CPU T7500 @ 2.20GHz GenuineIntel GNU/Linux |
|
Back to top |
|
|
Spear n00b
Joined: 08 Mar 2004 Posts: 65
|
|
Back to top |
|
|
uaeb n00b
Joined: 28 May 2008 Posts: 27
|
Posted: Fri Jun 13, 2008 4:59 am Post subject: |
|
|
Edit: Woops.. Just skimmed the OP again and noticed I missed this was already tried.. Ignore the rest of this message.
Assuming you're using dhcp, Add or Edit "/etc/conf.d/net", with:
Code: | config_eth0=( "dhcp" )
dhcp_eth0="nodns" |
You might need to alter the above according to your specific setup. Have a look at /etc/conf.d/net.example for more info. |
|
Back to top |
|
|
Stefano Crocco Apprentice
Joined: 28 Sep 2006 Posts: 157
|
Posted: Fri Jun 13, 2008 12:33 pm Post subject: /etc/resolv.conf overwritten at boot [SOLVED] |
|
|
Thanks, it worked _________________ Stefano |
|
Back to top |
|
|
cwall64 Tux's lil' helper
Joined: 28 Nov 2003 Posts: 128 Location: Houston, TX
|
Posted: Tue Jul 01, 2008 10:25 pm Post subject: Re: /etc/resolv.conf overwritten at boot [SOLVED] |
|
|
Stefano Crocco wrote: |
Thanks, it worked |
Glad it worked for you, but it is still driving me crazy!
/etc/conf.d/net:
Code: |
config_eth0=( "dhcp" )
dhcp_eth0="nodns"
dns_servers_eth0=( "192.168.1.2" " 192.168.1.1" )
dns_domain_eht0="chris-wall.lan"
dns_search_eht0="chris-wall.lan"
|
/etc/resolv.conf after reboot:
Code: |
gentoo ~ # cat /etc/resolv.conf
nameserver 192.168.1.1
|
Any thoughts? what am i missing?
Chris |
|
Back to top |
|
|
timeBandit Bodhisattva
Joined: 31 Dec 2004 Posts: 2719 Location: here, there or in transit
|
Posted: Wed Jul 02, 2008 3:41 am Post subject: |
|
|
Merged above six posts here. _________________ Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others. |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
|
|