FS#17742 - [networkmanager] modifies /etc/hosts and hostname

Attached to Project: Arch Linux
Opened by Cody Maloney (maloney) - Friday, 08 January 2010, 05:22 GMT
Last edited by Jan de Groot (JGC) - Saturday, 30 January 2010, 18:52 GMT
Task Type Bug Report
Category Packages: Testing
Status Closed
Assigned To Jan de Groot (JGC)
Ionut Biru (wonder)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

After the upgrade to 0.7.998-1 Network Manager adds a line to /etc/hosts

This wouldn't be a problem (although would be annoying), but it gets rid of the custom hostname for the machine, forcing it to be localhost.localdomain which then causes SLiM login manager to fail to display text when starting as well as changing the host name that shows up on the command line.

I verified this was network manager and not the other packages by disabling the networkmanager daemon, which caused the line to stop being added to my /etc/hosts

Here's the line that's added:
127.0.0.1 localhost.localdomain localhost

Steps to reproduce:
Upgrade to networkmanager 0.7.998-1
Have Networkmanager in your daemons array
Have Slim started as an rc.conf daemon (may not be required, but it's how mine is setup)
This task depends upon

Closed by  Jan de Groot (JGC)
Saturday, 30 January 2010, 18:52 GMT
Reason for closing:  Fixed
Additional comments about closing:  0.7.999-2 should fix this issue. This version has been patched to do hostname setting only in case it's configured from the keyfile settings plugin, all automatic lookups are disabled.
Comment by Cody Maloney (maloney) - Friday, 08 January 2010, 05:25 GMT
Just noticed in my message above, it doesn't change the custom hostname or delete it, just writes "127.0.0.1 localhost.localdomain localhost" before it which causes the custom hostname to not be used
Comment by Lex Rivera (x-demon) - Friday, 08 January 2010, 06:55 GMT
for me, it also resets hostname to localhost.localdomain
Comment by Ionut Biru (wonder) - Friday, 08 January 2010, 08:44 GMT
as a workaround add in /etc/NetworkManager/nm-system-settings.conf

[main]
plugins=keyfile
[keyfile]
hostname = <insert_hostname>
Comment by Cody Maloney (maloney) - Friday, 08 January 2010, 09:06 GMT
That fixes the hostname issue. And it's no longer overwriting /etc/hosts which is nice

SLiM didn't start working immediately after that. It would display and let me log in (and succeed at doing so) but kept failing to start an X server for my session (gave an error about a fbcon module). Adding myself to the video group fixed that (not sure if that is related at all, but figured I might as well note possible side effects)
Comment by Ionut Biru (wonder) - Friday, 08 January 2010, 13:31 GMT
here is a first patch that disable the behavior. please test it or if you can do it better than me please make a new patch.

don't forget to stop networkmanager first before doing modification to /etc/hosts to be like it was and also use the original nm-system-settings.conf
Comment by Lex Rivera (x-demon) - Friday, 08 January 2010, 14:48 GMT
it's okay now. But this is dirty patch, since we disable checks...
Comment by Ionut Biru (wonder) - Friday, 08 January 2010, 16:00 GMT
a proper fix will be to write our our plugin rather than using keyfile. i don't like my patch anymore.
Comment by Frederic Bezies (fredbezies) - Monday, 11 January 2010, 11:25 GMT
I'm still seeing it. I had to switch to wicd in order to have a working gnome :(
Comment by Ionut Biru (wonder) - Monday, 11 January 2010, 11:28 GMT
Frederic using -2 ?
Comment by Jan de Groot (JGC) - Monday, 11 January 2010, 11:31 GMT
The patch only removes the localhost.localdomain fallback, when the DHCP server provides a hostname, networkmanager sets it anyways.
Comment by Frederic Bezies (fredbezies) - Monday, 11 January 2010, 12:20 GMT
Ionut : yes.

fred ~ $ yaourt -Si networkmanager
Dépôt : testing
Nom : networkmanager
Version : 0.7.998-2
Comment by lorenzo (neuromante) - Wednesday, 20 January 2010, 17:30 GMT
Same problem here. Gnome locks up and every single program cannot start since it says: cannot connect to display etc etc. And it adds that line to /etc/hosts. So what's the best workaround? The one suggested by Ionut? Thanks
Comment by Istvan Demeter (qw3r) - Thursday, 21 January 2010, 07:53 GMT
The method mentioned by "Ionut Biru (wonder)" (nm-system-settings.conf) does not work for me :(

My solution does not fix the problem, but restore hostname just after the connection came up!

place attached file in /etc/NetworkManager/dispatcher.d/ then set executable flag (chmod)


:)
Comment by Frederic Bezies (fredbezies) - Friday, 22 January 2010, 20:17 GMT
Seems the bug could not be seen anymore in NM 0.7.999.

fred ~ $ sudo pacman -Si networkmanager
Dépôt : testing
Nom : networkmanager
Version : 0.7.999-1
URL : http://www.gnome.org/projects/NetworkManager/
Licences : GPL
Groupes : --
Fournit : libnetworkmanager=0.7.999

I rebooted after setting networkmanager by default in my /etc/rc.conf file. I hope this bug is "dead"
Comment by Frederic Bezies (fredbezies) - Saturday, 23 January 2010, 06:09 GMT
I have spoken too fast. Still busting gnome settings because of /etc/hosts modification :(

Loading...