LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-01-2009, 12:38 PM   #1
noalternative
LQ Newbie
 
Registered: Mar 2006
Distribution: ElementaryOS, Debian
Posts: 19

Rep: Reputation: 0
Unhappy resolv.conf gets rewritten on reboot even if I chmod 444


my rounter causes puppy to write an improper dns entry in resolv.conf. Consequently I have to manually write it, then I have to place a command on it to make sure it doesn't get rewritten on boot, or after a couple of hours use. I had this problem with xubuntu as well. This kind of describes the problem.

https://answers.launchpad.net/ubuntu/+question/3674

I solved this problem in ubuntu by using the chattr command.

http://ubuntuforums.org/archive/index.php/t-187042.html

Puppy won't let me do this. When I use the chattr +i /etc/resolv.conf, it gives me this error.

chattr: Inappropriate ioctl for device while reading flags on /etc/resolv.conf
#
I tried chmod 444 but it had no effect on reboot. resolv.conf was rewritten again.

How can I make sure this file does not get rewritten. Why won't chattr work?

Last edited by noalternative; 12-01-2009 at 02:39 PM.
 
Old 12-01-2009, 01:34 PM   #2
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Quote:
Originally Posted by noalternative View Post
...
I tried cmod 444 but it had no effect on reboot. resolv.conf was rewritten again.
Do please right after reboot: ls -la /etc/resolv.conf
 
Old 12-01-2009, 02:38 PM   #3
noalternative
LQ Newbie
 
Registered: Mar 2006
Distribution: ElementaryOS, Debian
Posts: 19

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by nimnull22 View Post
Do please right after reboot: ls -la /etc/resolv.conf
This was the output and yes it was still rewritten!


# ls -la /etc/resolv.conf
-r--r--r-- 1 root root 110 2009-12-01 14:30 /etc/resolv.conf
 
Old 12-01-2009, 03:08 PM   #4
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
I think that resolv.conf can be overwritten only by DHCP daemon, witch I think starts at the boot time.
Check it.
 
Old 12-01-2009, 03:13 PM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Root can still change the file. You can run "chattr +i /etc/resolv.conf" to prevent it. It would be better to change your configuration so that the dhcp client daemon doesn't modify resolv.conf.
 
Old 12-01-2009, 07:19 PM   #6
noalternative
LQ Newbie
 
Registered: Mar 2006
Distribution: ElementaryOS, Debian
Posts: 19

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jschiwal View Post
Root can still change the file. You can run "chattr +i /etc/resolv.conf" to prevent it. It would be better to change your configuration so that the dhcp client daemon doesn't modify resolv.conf.
How do I modify the dhcp client?
 
Old 12-01-2009, 07:27 PM   #7
MQMan
Member
 
Registered: Jan 2004
Location: Los Angeles
Distribution: Slack64 14.1
Posts: 581

Rep: Reputation: 38
It depends on which client you use. On mine, it's -R

The man pages would be a good place to start.

Cheers.
 
Old 12-01-2009, 07:34 PM   #8
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Quote:
Originally Posted by jschiwal View Post
You can run "chattr +i /etc/resolv.conf" to prevent it. It would be better to change your configuration so that the dhcp client daemon doesn't modify resolv.conf.
Have you try "chattr +i /etc/resolv.conf", did it helps?

To modify DHCP client you need to find out which dhcp client is it.
Then you need to find script which starts dhcp client.
Then you can read in manual page additional option, for example for dhcpcd it will be "dhcpcd -R". Then you just add that option to the startup script.

Or you can find *.cfg file for your dhgp client.
For example in OpenSuse I have in /etc/sysconfig/network/dhcp, where I can add option
"-R".

Last edited by nimnull22; 12-01-2009 at 07:50 PM.
 
Old 12-02-2009, 02:53 PM   #9
noalternative
LQ Newbie
 
Registered: Mar 2006
Distribution: ElementaryOS, Debian
Posts: 19

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by nimnull22 View Post
Have you try "chattr +i /etc/resolv.conf", did it helps?

Yes, as I stated in the original post, I get an error message when I try chattr.

To modify DHCP client you need to find out which dhcp client is it.
Then you need to find script which starts dhcp client.
Then you can read in manual page additional option, for example for dhcpcd it will be "dhcpcd -R". Then you just add that option to the startup script.

Or you can find *.cfg file for your dhgp client.
For example in OpenSuse I have in /etc/sysconfig/network/dhcp, where I can add option
"-R".
I have puppy. Anyone know where dhcp would be on puppy.
 
Old 12-02-2009, 03:37 PM   #10
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
from root console: "find / -name dhcp" without ""
 
Old 12-02-2009, 11:40 PM   #11
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I don't know which of 3 DHCPC clients that puppy uses. And even for a certain distro, settings and configurations change with the version. I used to have a dhcpcd.conf file which I don't any more. If your system uses netconf, then look in it's config file for the setting "NETCONFIG_DNS_STATIC_SERVERS=". Also grep the config files in /etc/ for "resolv.conf".

Someone with puppy linux would be better able to point you to the right configuration file and setting.
 
Old 12-03-2009, 02:09 AM   #12
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You probably use either the dhcpcd or dhclient programs. According to this site: http://puppylinux.org/wikka/dhcpcd it uses dhcpcd, and it is preinstalled.

Try the Menu -> Setup -> Network wizard first. It may have the option you are looking for. Otherwise, look through your startup scripts and config files in /etc/. Many config files have their own manpages as well, and may be modified to better suit puppy linux. Look in /etc/sysconfig/network/dhcpd if it exists. There may be a line like DHCPCD_USER_OPTIONS="" where you can add the --nodns option already mentioned. You will need to explore your system here if a google search doesn't turn up an option. Setting the -i attribute of /etc/resolv.conf could be a temporary fix until you find the proper solution.
 
  


Reply

Tags
actiontec, resolvconf



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
resolv.conf keeps getting rewritten herpules Linux - Software 5 05-11-2009 08:36 AM
resolv.conf keeps getting rewritten!! jcbparry Mandriva 7 05-28-2007 08:34 AM
i am writing to a chmod(444) file. am i missing something? nkoplm Linux - Security 2 11-14-2006 08:06 PM
/etc/resolv.conf being rewritten at startup jawaking00 Linux - Networking 2 07-01-2004 08:17 AM
resolv.conf is rewritten on startup smurf Linux - Networking 1 03-23-2004 03:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration