How to stop Network Manager (I asssume) overwriting /etc/hosts in 10.10?

Chris G cl at isbd.net
Mon Mar 21 09:56:56 UTC 2011


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 at 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




More information about the ubuntu-users mailing list