network-manager updates /etc/hosts, breaks hostname -f

Bug #645648 reported by LaMont Jones
28
This bug affects 7 people
Affects Status Importance Assigned to Milestone
network-manager (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: network-manager

Since upgrading to maverick, network-manager adds a line at the top of /etc/hosts when a connection comes up, and that line lacks anything other than the first component of the FQDN, which breaks hostname -f.

How can I get network-manager to quit messing with this file?

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Seems like this was already reported as bug 632896.

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Ok so it looks like this isn't quite the same thing.

FWIW, I can make sure the domain name and hostname appear properly in hostname / hostname -f by setting /etc/domainname as well as /etc/hostname, and in that case NM properly add a line for both in /etc/hosts:

10.10.10.16 demeter.cyphermox.net demeter # Added by NetworkManager

However, this doesn't fix the issue that /etc/hosts gets changed, and bug 632896 still applies.

There is a possible workaround in adding:
[keyfile]
hostname = <hostname>

in /etc/NetworkManager/nm-system-settings.conf, but I wasn't able to have that work to stop /etc/hosts from being modified.

Changed in network-manager (Ubuntu):
status: New → Confirmed
Revision history for this message
Malte Helmert (helmert) wrote :

I have the same issue. As discussed in bug 663597, setting /etc/domainname doesn't work for me; hostname -f still reports the wrong result.

I now worked around this by putting the FQDN into /etc/hostname (rather than just the plain hostname), and so far I've had no problem with this. However, according to "man hostname", setting /etc/hostname to the FQDN is wrong:

     /etc/hostname This file should only contain the hostname and not the
       full FQDN.

but it's the only way I could get hostname -f to work.

(BTW, If someone could have a look at bug 663597 and change its status from "opinion" to something else or at least give a reason why that status makes sense, that would be appreciated.)

Revision history for this message
Vadim Gutnik (gutnik) wrote :

I have the same issue. Putting fqdn into /etc/hostname isn't really an option because this is a laptop and the local
network changes.

Revision history for this message
Thomas Hood (jdthood) wrote :

Fixed in Precise.

Changed in network-manager (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.