/etc on one of the gentoo systems is readonly. In fact the whole root filesystem is. For some reason, when network manager use DHCP to obtain an address, it attempts to write the hostname into the hosts file. However, when it fails, due to /etc being non-writeable, it decides that it should change the hostname to localhost.localdomain (even though the hostname is on the same line, it wants to add a new line with the dhcp address on a single line). Thereafter there are the usual Xauth problems. Reproducible: Always Steps to Reproduce: 1. /etc readonly 2. use networkmanager to obtain address via dhcp 3. address works but hostname is changed to localhost.localdomain Actual Results: Address works but hostname is changed to localhost.localdomain Expected Results: Don't chnage the hostname if you cannot update the hosts file. Does network manager think it knows what is best?
In the case where /etc is writable, the hosts file is updated with the line: addres.x.y.x hostname #added by network mangler But, if this fails then the hostname is changed (BAD).
Created attachment 254715 [details, diff] Won't fallback when failed to update etc hosts Here's a patch that could solve your problem, but I'm not sure if this is wanted by all users.
Why not make it so that NM doesn't fallback to localhost.localdomain *if* /etc/hosts already has the proper hostname entry?
I believe the problem is that some distro's want this, but some definitely don't. The hostname is usually only set once, and only by the start up scripts, IHMO. (In reply to comment #3) > Why not make it so that NM doesn't fallback to localhost.localdomain *if* > /etc/hosts already has the proper hostname entry? >
(In reply to comment #3) > Why not make it so that NM doesn't fallback to localhost.localdomain *if* > /etc/hosts already has the proper hostname entry? > I've already asked about it in NM mail list. Let's see whether upstream will make any change.
Is this still valid with the current release?
(In reply to Pavel Šimerda from comment #6) > Is this still valid with the current release?