Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
resolv.conf gets clobbered on boot [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
magister
n00b
n00b


Joined: 07 Nov 2003
Posts: 13

PostPosted: Mon Sep 18, 2006 7:11 am    Post subject: resolv.conf gets clobbered on boot [SOLVED] Reply with quote

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
View user's profile Send private message
Kosmas
Apprentice
Apprentice


Joined: 14 Sep 2006
Posts: 280
Location: Greece

PostPosted: Mon Sep 18, 2006 9:08 am    Post subject: Reply with quote

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
View user's profile Send private message
magister
n00b
n00b


Joined: 07 Nov 2003
Posts: 13

PostPosted: Tue Sep 19, 2006 1:27 am    Post subject: Reply with quote

Thanks, that seems to have fixed it. Looks like that's been left out of the installation guide.
Back to top
View user's profile Send private message
Kosmas
Apprentice
Apprentice


Joined: 14 Sep 2006
Posts: 280
Location: Greece

PostPosted: Tue Sep 19, 2006 1:47 pm    Post subject: Reply with quote

No problem. Just if you please edit your post and add [SOLVED] to the subject.
Back to top
View user's profile Send private message
cayenne
l33t
l33t


Joined: 17 Oct 2002
Posts: 945
Location: New Orleans

PostPosted: Wed Jun 11, 2008 1:59 pm    Post subject: Thank you Reply with quote

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
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Wed Jun 11, 2008 3:00 pm    Post subject: Reply with quote

What needs to be in the install manuals is discouraging users to set a dns domain.
99.99% of the time you don't need it.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
Stefano Crocco
Apprentice
Apprentice


Joined: 28 Sep 2006
Posts: 157

PostPosted: Thu Jun 12, 2008 2:55 pm    Post subject: /etc/resolv.conf overwritten at boot Reply with quote

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
View user's profile Send private message
infernus
n00b
n00b


Joined: 11 Jan 2008
Posts: 24
Location: US

PostPosted: Thu Jun 12, 2008 3:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
Spear
n00b
n00b


Joined: 08 Mar 2004
Posts: 65

PostPosted: Fri Jun 13, 2008 4:17 am    Post subject: Reply with quote

This is normal.

https://forums.gentoo.org/viewtopic-t-499334-highlight-resolv+conf.html
Back to top
View user's profile Send private message
uaeb
n00b
n00b


Joined: 28 May 2008
Posts: 27

PostPosted: Fri Jun 13, 2008 4:59 am    Post subject: Reply with quote

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
View user's profile Send private message
Stefano Crocco
Apprentice
Apprentice


Joined: 28 Sep 2006
Posts: 157

PostPosted: Fri Jun 13, 2008 12:33 pm    Post subject: /etc/resolv.conf overwritten at boot [SOLVED] Reply with quote

Spear wrote:
This is normal.

https://forums.gentoo.org/viewtopic-t-499334-highlight-resolv+conf.html


Thanks, it worked
_________________
Stefano
Back to top
View user's profile Send private message
cwall64
Tux's lil' helper
Tux's lil' helper


Joined: 28 Nov 2003
Posts: 128
Location: Houston, TX

PostPosted: Tue Jul 01, 2008 10:25 pm    Post subject: Re: /etc/resolv.conf overwritten at boot [SOLVED] Reply with quote

Stefano Crocco wrote:
Spear wrote:
This is normal.

https://forums.gentoo.org/viewtopic-t-499334-highlight-resolv+conf.html


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
View user's profile Send private message
timeBandit
Bodhisattva
Bodhisattva


Joined: 31 Dec 2004
Posts: 2719
Location: here, there or in transit

PostPosted: Wed Jul 02, 2008 3:41 am    Post subject: Reply with quote

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
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Wed Jul 02, 2008 9:13 am    Post subject: Re: /etc/resolv.conf overwritten at boot [SOLVED] Reply with quote

cwall64 wrote:

/etc/resolv.conf after reboot:
Code:

gentoo ~ # cat /etc/resolv.conf
nameserver 192.168.1.1


Any thoughts? what am i missing?


Nothing I know of did that to resolv.conf.
Most things in Gentoo should stick a comment at the top stating which program made the change.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum