Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 345617 - net-misc/networkmanager changes hostname when /etc/hosts is non-writable
Summary: net-misc/networkmanager changes hostname when /etc/hosts is non-writable
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-15 14:12 UTC by Robert Coffree
Modified: 2013-06-16 11:54 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Won't fallback when failed to update etc hosts (0001-Won-t-fallback-when-failed-to-update-etc-hosts.patch,1.11 KB, patch)
2010-11-18 13:05 UTC, Mu Qiao (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Coffree 2010-11-15 14:12:38 UTC
/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?
Comment 1 Robert Coffree 2010-11-15 14:13:54 UTC
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).
Comment 2 Mu Qiao (RETIRED) gentoo-dev 2010-11-18 13:05:34 UTC
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.
Comment 3 Nirbheek Chauhan (RETIRED) gentoo-dev 2010-12-01 00:43:08 UTC
Why not make it so that NM doesn't fallback to localhost.localdomain *if* /etc/hosts already has the proper hostname entry?
Comment 4 Robert Coffree 2010-12-01 06:19:24 UTC
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?
> 

Comment 5 Mu Qiao (RETIRED) gentoo-dev 2010-12-01 07:21:56 UTC
(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.
Comment 6 Pavel Šimerda 2012-11-23 09:37:00 UTC
Is this still valid with the current release?
Comment 7 Pacho Ramos gentoo-dev 2013-06-16 11:54:08 UTC
(In reply to Pavel Šimerda from comment #6)
> Is this still valid with the current release?