Comment 50 for bug 8980

Revision history for this message
Daniel Richard G. (skunk) wrote :

Here is my view of the problem: On an up-to-date Maverick install, if /etc/hosts looks like the following on bootup...

--------
127.0.0.1 localhost
127.0.1.1 hostname.intra.example.com hostname

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
--------

...NetworkManager changes it (syslog: "<info> Updating /etc/hosts with new system hostname") to this:

--------
127.0.0.1 hostname localhost.localdomain localhost
::1 hostname localhost6.localdomain6 localhost6
127.0.1.1 hostname.intra.example.com hostname

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
--------

With that, "hostname -f" incorrectly returns just the unqualified hostname.

I think part of the problem is the layout convention being used for /etc/hosts. The first example above was the result of the Ubuntu alternate installer. On a different system installed with Ubiquity, however, I have this (note that this system does not have a domain part, so I can't tell if "hostname -f" is broken or not):

--------
192.168.1.XX hostname # Added by NetworkManager
127.0.0.1 localhost.localdomain localhost
::1 hostname localhost6.localdomain6 localhost6
127.0.1.1 hostname

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
--------

I think N-M's logic for modifying /etc/hosts may not be robust enough to generate a correct file given some of these inputs.