changes to /etc/hosts lost on reboot
I have a recurring problem where I edit and save /etc/hosts, modify one entry, add a second. The entries work fine during that session. After a shutdown/restart, those modifications are gone.
I've added entries on this machine in the past, and never saw anything like this.
What's going on?
Re: changes to /etc/hosts lost on reboot
That is strange. I don't have a diagnosis, but a brute-force solution is to change the permissions on /etc/hosts to 0444. That grants only read privileges, even to the root user. You'll need to make the file writable again if you need to edit it, of course.
Re: changes to /etc/hosts lost on reboot
Network Manager rebuilds /etc/hosts
When I Googled it, I saw several conflicting approaches. The most promising involved this file: /etc/NetworkManager/nm-system-settings.conf
Your best bet might be to Edit the connection in Network Manager, rather than editing the text file.
Re: changes to /etc/hosts lost on reboot
I've seen a similar problem with my /etc/resolv.conf DNS server modifications mysteriously disappearing sometime this past week. Of course resolv.conf is another of those "# Generated by NetworkManager" deals.
From my experience, Wicd is much more stable and much more configurable than [GNOME] NetworkManager (network-manager package). I was recently reminded that Kubuntu uses/used knetworkmanager or knm-runtime, network-manager-kde, and plasma-widget-networkmanagement packages, depending upon the KDE version (a bit to my belated chagrin).
http://kde-apps.org/content/show.php?content=46395
If you try Wicd, I think you will like it much better than NetworkManager (and its Windows- and virus-like behavior with the accompanying UNREQUESTED and UNAUTHORIZED changes to your OS settings). Most people are of the opinion that you need to remove ALL traces (or use the --purge command) of NetworkManager if you are running Wicd, although I ran either one 'side by side' under Ubuntu 9.04 as I recall. Lucid 10.04 did NOT like having both installed though.
I haven't reinstalled and reconfigured Wicd yet on my Ubuntu system to fix my 'disappearing' DNS server modifications to /etc/resolv.conf because I recently reinstalled a slightly different version and have been busy fixing some other issues that I need an active Internet connection for.
I would advise everyone to thoroughly read up on the 2 (or 3 for KDE/Kubuntu users) wireless interfaces BEFORE making any changes though:
https://help.ubuntu.com/community/WICD
http://wicd.sourceforge.net/
I would also recommend getting all the .DEB packages needed for BOTH wireless systems (Wicd AND NetworkManager) downloaded for OFFLINE installation BEFORE making any changes if you don't know where they are located on the LiveCD/DVD, just in case you have trouble getting reconnected wirelessly. (A RELIABLE cabled ethernet connection takes a lot of the 'pain' out of this hazard however).
Re: changes to /etc/hosts lost on reboot
Quote:
Originally Posted by
northd_tech
I've seen a similar problem with my /etc/resolv.conf DNS server modifications mysteriously disappearing sometime this past week. Of course resolv.conf is another of those "# Generated by NetworkManager" deals.
If you obtain your IP configuration via DHCP, resolv.conf will be rewritten each time with the information provided by the DHCP server. You can tell the DHCP client in Ubuntu to ignore some of the information provided by the server by modifying the file /etc/dhcp3/dhclient.conf. Take a look at the example using the prepend directive for one method; you can also remove items from the "request" directive like "domain-name-servers" to make the client ignore any such information from the DHCP server.
I've never heard of the DHCP client modifying /etc/hosts, though. That would seem to thwart the purpose of that file since it's designed to override information otherwise provider by DNS.