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

Chris G cl at isbd.net
Sun Mar 20 19:04:11 UTC 2011


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




More information about the ubuntu-users mailing list