FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 03-20-2011, 06:08 PM
Chris
 
Default How to stop Network Manager (I asssume) overwriting /etc/hosts in 10.10?

On Sun, 2011-03-20 at 19:04 +0000, Chris G wrote:
> I have just upgraded from xubuntu 10.04 to xubuntu 10.10 but I think my
> problem is also in ubuntu 10.10.
>
> Network Manager (I assume) is overwriting my /etc/hosts file every time
> I reboot my system. My /etc/hosts file is:-
>
> 127.0.0.1 localhost
>
> # The following lines are desirable for IPv6 capable hosts
> ::1 localhost ip6-localhost ip6-loopback
> fe00::0 ip6-localnet
> ff00::0 ip6-mcastprefix
> ff02::1 ip6-allnodes
> ff02::2 ip6-allrouters
>
>
> ... but Network Manager (or someone) insists on changing it to:-
>
> 127.0.0.1 chris localhost.localdomain localhost
> ::1 chris localhost6.localdomain6 localhost6
>
> # The following lines are desirable for IPv6 capable hosts
> ::1 localhost ip6-localhost ip6-loopback
> fe00::0 ip6-localnet
> ff00::0 ip6-mcastprefix
> ff02::1 ip6-allnodes
> ff02::2 ip6-allrouters
>
> Even if I make /etc/hosts read only by setting the permissions it
> *still* gets changed!
>
> This is totally broken for me because I have a proper domain for my
> machine and another machine on my LAN provides DHCP and DNS services
> including the domain name. With the above Network Manager changes I no
> longer have a valid domain and both apache2 and leafnode (among others)
> complain about my system not having a valid domain until I remove the
> above changes and restore my (simpler and more correct) /etc/hosts.
>
> I believe this bug has been reported but I need a workaround to prevent
> getting screwed up every time I restart my system.
>
> --
> Chris Green
>


Simply edit /etc/dhcp3/dhclient.conf and add the following line:

# Use Google DNS Servers (add your own here)
supersede domain-name-servers 8.8.8.8, 8.8.4.4;

where <dns1-ip> & <dns2-ip> are primary dns ip and secondary dns
ip (don't forget trailing semicolon).

This command tells dhclient to overwrite the option domain-name-servers
value obtained from dhcp server with the values you write, thus updating
resolv.conf with the values you write in that line.


--
Keep well,

Chris


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-20-2011, 06:12 PM
Chris
 
Default How to stop Network Manager (I asssume) overwriting /etc/hosts in 10.10?

On Sun, 2011-03-20 at 14:08 -0500, Chris wrote:
> On Sun, 2011-03-20 at 19:04 +0000, Chris G wrote:
> > I have just upgraded from xubuntu 10.04 to xubuntu 10.10 but I think my
> > problem is also in ubuntu 10.10.
> >
> > Network Manager (I assume) is overwriting my /etc/hosts file every time
> > I reboot my system. My /etc/hosts file is:-
> >
> > 127.0.0.1 localhost
> >
> > # The following lines are desirable for IPv6 capable hosts
> > ::1 localhost ip6-localhost ip6-loopback
> > fe00::0 ip6-localnet
> > ff00::0 ip6-mcastprefix
> > ff02::1 ip6-allnodes
> > ff02::2 ip6-allrouters
> >
> >
> > ... but Network Manager (or someone) insists on changing it to:-
> >
> > 127.0.0.1 chris localhost.localdomain localhost
> > ::1 chris localhost6.localdomain6 localhost6
> >
> > # The following lines are desirable for IPv6 capable hosts
> > ::1 localhost ip6-localhost ip6-loopback
> > fe00::0 ip6-localnet
> > ff00::0 ip6-mcastprefix
> > ff02::1 ip6-allnodes
> > ff02::2 ip6-allrouters
> >
> > Even if I make /etc/hosts read only by setting the permissions it
> > *still* gets changed!
> >
> > This is totally broken for me because I have a proper domain for my
> > machine and another machine on my LAN provides DHCP and DNS services
> > including the domain name. With the above Network Manager changes I no
> > longer have a valid domain and both apache2 and leafnode (among others)
> > complain about my system not having a valid domain until I remove the
> > above changes and restore my (simpler and more correct) /etc/hosts.
> >
> > I believe this bug has been reported but I need a workaround to prevent
> > getting screwed up every time I restart my system.
> >
> > --
> > Chris Green
> >
>
>
> Simply edit /etc/dhcp3/dhclient.conf and add the following line:
>
> # Use Google DNS Servers (add your own here)
> supersede domain-name-servers 8.8.8.8, 8.8.4.4;
>
> where <dns1-ip> & <dns2-ip> are primary dns ip and secondary dns
> ip (don't forget trailing semicolon).
>
> This command tells dhclient to overwrite the option domain-name-servers
> value obtained from dhcp server with the values you write, thus updating
> resolv.conf with the values you write in that line.
>
>
> --
> Keep well,
>
> Chris
>
>

Meh - My fault. I jumped the gun. You said hosts file not resolv.conf
Disregard.

--
Keep well,

Chris


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-21-2011, 08:56 AM
Chris G
 
Default How to stop Network Manager (I asssume) overwriting /etc/hosts in 10.10?

On Sun, Mar 20, 2011 at 03:49:55PM -0400, Tom H wrote:
> On Sun, Mar 20, 2011 at 3:04 PM, Chris G <cl@isbd.net> wrote:
> >
> > I have just upgraded from xubuntu 10.04 to xubuntu 10.10 but I think my
> > problem is also in ubuntu 10.10.
> >
> > Network Manager (I assume) is overwriting my /etc/hosts file every time
> > I reboot my system. *My /etc/hosts file is:-
> >
> > * *127.0.0.1 * * * localhost
> >
> > ... but Network Manager (or someone) insists on changing it to:-
> >
> > * *127.0.0.1 * * * chris * localhost.localdomain * localhost
> >
> > Even if I make /etc/hosts read only by setting the permissions it
> > *still* gets changed!
> >
> > This is totally broken for me because I have a proper domain for my
> > machine and another machine on my LAN provides DHCP and DNS services
> > including the domain name. With the above Network Manager changes I no
> > longer have a valid domain and both apache2 and leafnode (among others)
> > complain about my system not having a valid domain until I remove the
> > above changes and restore my (simpler and more correct) /etc/hosts.
>
> I find it surprising that "chris" is added to the "127.0.0.1" line.
> The debian developers has many "discussions" in this respect and
> decided to have a "127.0.1.1" line for the hostname of a dhclient box.
>
> I have a 10.10 install where NM prepends a line within "/etc/hosts"
>
> <begin>
> dhcp_ip_address hostname # Added by NM
> 127.0.0.1 localhost.localdomain
> 127.0.1.1 hostname
> </end>
>
> Change "/etc/hosts" to
>
> <begin>
> 127.0.0.1 localhost
> 127.0.1.1 chris.yourdomain chris
> </end>
>
> to check whether it's mis-edited.
>
> What's "cat /etc/hostname"?
>
> Is it "chris"? Does changing it to "chris.yourdomain" resolve your problem?
>
It's the fact that Network Manager insists on adding "127.0.0.1
localhost.localdomain" that causes me a problem. Both apache2 and
leafnode complain when finding that the domain name is localdomain.

I have solved the problem for the moment simply be uninstalling Network
Manager and installing wicd instead, that leaves everything as I want it
but gives me a GUI interface to look at things still.

--
Chris Green

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-22-2011, 06:36 PM
Ray Leventhal
 
Default How to stop Network Manager (I asssume) overwriting /etc/hosts in 10.10?

<huge snip>

Is it "chris"? Does changing it to "chris.yourdomain" resolve your problem?


It's the fact that Network Manager insists on adding "127.0.0.1
localhost.localdomain" that causes me a problem. Both apache2 and
leafnode complain when finding that the domain name is localdomain.

I have solved the problem for the moment simply be uninstalling Network
Manager and installing wicd instead, that leaves everything as I want it
but gives me a GUI interface to look at things still.



Perhaps issuing the command:

sudo chattr +i /etc/hosts

after making your specific edits will keep it from being re/over-written.

Not tested, just a thought.

HTH,
-Ray

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-22-2011, 07:34 PM
Chris G
 
Default How to stop Network Manager (I asssume) overwriting /etc/hosts in 10.10?

On Tue, Mar 22, 2011 at 03:36:18PM -0400, Ray Leventhal wrote:
> <huge snip>
> >>Is it "chris"? Does changing it to "chris.yourdomain" resolve your problem?
> >>
> >It's the fact that Network Manager insists on adding "127.0.0.1
> >localhost.localdomain" that causes me a problem. Both apache2 and
> >leafnode complain when finding that the domain name is localdomain.
> >
> >I have solved the problem for the moment simply be uninstalling Network
> >Manager and installing wicd instead, that leaves everything as I want it
> >but gives me a GUI interface to look at things still.
> >
>
> Perhaps issuing the command:
>
> sudo chattr +i /etc/hosts
>
> after making your specific edits will keep it from being re/over-written.
>
> Not tested, just a thought.
>
I had tried setting /etc/hosts read-only (chmod 0444) and that didn't
work, I'm not sure if the above would work better.

--
Chris Green

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-22-2011, 07:37 PM
NoOp
 
Default How to stop Network Manager (I asssume) overwriting /etc/hosts in 10.10?

On 03/21/2011 02:56 AM, Chris G wrote:
> On Sun, Mar 20, 2011 at 03:49:55PM -0400, Tom H wrote:
...
>> I have a 10.10 install where NM prepends a line within "/etc/hosts"
>>
>> <begin>
>> dhcp_ip_address hostname # Added by NM
>> 127.0.0.1 localhost.localdomain
>> 127.0.1.1 hostname
>> </end>
>>
>> Change "/etc/hosts" to
>>
>> <begin>
>> 127.0.0.1 localhost
>> 127.0.1.1 chris.yourdomain chris
>> </end>
>>
>> to check whether it's mis-edited.
>>
>> What's "cat /etc/hostname"?
>>
>> Is it "chris"? Does changing it to "chris.yourdomain" resolve your problem?
>>
> It's the fact that Network Manager insists on adding "127.0.0.1
> localhost.localdomain" that causes me a problem. Both apache2 and
> leafnode complain when finding that the domain name is localdomain.
>
> I have solved the problem for the moment simply be uninstalling Network
> Manager and installing wicd instead, that leaves everything as I want it
> but gives me a GUI interface to look at things still.
>

https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/659872
[Aliases in /etc/hosts overwritten]
upstream:
https://bugzilla.gnome.org/show_bug.cgi?id=632157
And I see that you've added a comment on 659872 - the proposed:

$ apt-cache policy network-manager
network-manager:
Installed: 0.8.1+git.20100810t184654.ab580f4-0ubuntu2.1
Candidate: 0.8.1+git.20100810t184654.ab580f4-0ubuntu2.1
Version table:
*** 0.8.1+git.20100810t184654.ab580f4-0ubuntu2.1 0
500 http://us.archive.ubuntu.com/ubuntu/ maverick-proposed/main
i386 Packages
100 /var/lib/dpkg/status
0.8.1+git.20100810t184654.ab580f4-0ubuntu2 0
500 http://us.archive.ubuntu.com/ubuntu/ maverick/main i386 Packages

https://launchpad.net/ubuntu/+source/network-manager
<https://launchpad.net/ubuntu/+source/network-manager/0.8.1+git.20100810t184654.ab580f4-0ubuntu2.1>

doesn't seem to work. I modified my /etc/hosts, disconnected via Network
Manger, and it still overwrites 127.0.0.1.


Might also be worth a look:
https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/659817
[NetworkManage does not set domain in /etc/hosts on DHCP connections ]

More related issues:
<https://bugs.launchpad.net/ubuntu/+source/network-manager?field.searchtext=hosts&orderby=-importance&search=Search&field.status%3Alist=NEW&f ield.status%3Alist=INCOMPLETE_WITH_RESPONSE&field. status%3Alist=INCOMPLETE_WITHOUT_RESPONSE&field.st atus%3Alist=CONFIRMED&field.status%3Alist=TRIAGED& field.status%3Alist=INPROGRESS&field.status%3Alist =FIXCOMMITTED&field.assignee=&field.bug_reporter=& field.omit_dupes=on&field.has_patch=&field.has_no_ package=>







--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-23-2011, 12:58 PM
Ray Leventhal
 
Default How to stop Network Manager (I asssume) overwriting /etc/hosts in 10.10?

On 03/22/2011 04:34 PM, Chris G wrote:


<snip>
> On Tue, Mar 22, 2011 at 03:36:18PM -0400, Ray Leventhal wrote:




Perhaps issuing the command:

sudo chattr +i /etc/hosts

after making your specific edits will keep it from being re/over-written.

Not tested, just a thought.


I had tried setting /etc/hosts read-only (chmod 0444) and that didn't
work, I'm not sure if the above would work better.



Hi Chris,

I did test the immutable flag (+i) and it seems to keep anything from
writing to the file on which it is set. This may well fix your problem.


HTH,
-Ray

--
!//
(o o)
--oOOo-(_)-oOOo--

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-23-2011, 01:09 PM
Chris G
 
Default How to stop Network Manager (I asssume) overwriting /etc/hosts in 10.10?

On Wed, Mar 23, 2011 at 09:58:33AM -0400, Ray Leventhal wrote:
> On 03/22/2011 04:34 PM, Chris G wrote:
>
>
> <snip>
> > On Tue, Mar 22, 2011 at 03:36:18PM -0400, Ray Leventhal wrote:
> >>>
> >>
> >>Perhaps issuing the command:
> >>
> >>sudo chattr +i /etc/hosts
> >>
> >>after making your specific edits will keep it from being re/over-written.
> >>
> >>Not tested, just a thought.
> >>
> >I had tried setting /etc/hosts read-only (chmod 0444) and that didn't
> >work, I'm not sure if the above would work better.
> >
>
> Hi Chris,
>
> I did test the immutable flag (+i) and it seems to keep anything
> from writing to the file on which it is set. This may well fix your
> problem.
>
Thanks. For the present using wicd instead of NM is doing what I need
but I can use that chattr command as a backstop! :-)

I hadn't come across the file attributes thing before, being a
died-in-the-wool Unix descendent as older real Unix systems don't have
these extra file attributes.

--
Chris Green

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 11:28 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org