NetworkManager updates /etc/hosts in a way that breaks "hostname --fqdn"
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
network-manager (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: network-manager
Since the upgrade to maverick, my machine doesn't know it's FQDN any more:
$ hostname --fqdn
alfons
$ hostname --all-fqdns
alfons
$ python -c "import socket; print socket.getfqdn()"
localhost6.
In all three cases, I'd be expecting the answer "alfons.
I looked around a bit and found out that a change to /etc/hosts by NetworkManager is causing this.
My /etc/hosts looks like this:
132.230.166.41 alfons # Added by NetworkManager
127.0.0.1 localhost.
::1 alfons localhost6.
# 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
It was modified to look like this by NetworkManager. I tried manually changing it to the following:
127.0.0.1 localhost
# 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
after which I get the expected results:
$ hostname --fqdn
alfons.
$ hostname --all-fqdn
alfons.
$ python -c "import socket; print socket.getfqdn()"
alfons.
But unfortunately after the next reboot (or reconnect to the network), /etc/hosts is changed again and the problem returns.
Questions:
1) Is there any way to keep NetworkManager from doing this?
2) Failing that, is there any way to find out my machine's FQDN despite NetworkManager's behaviour?
ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: network-manager 0.8.1+git.
ProcVersionSign
Uname: Linux 2.6.35-
Architecture: i386
CRDA: Error: [Errno 2] No such file or directory
Date: Wed Oct 20 01:12:24 2010
Gconf:
IfupdownConfig:
auto lo
iface lo inet loopback
IpRoute:
132.230.166.0/24 dev eth0 proto kernel scope link src 132.230.166.41 metric 1
169.254.0.0/16 dev eth0 scope link metric 1000
default via 132.230.166.254 dev eth0 proto static
IwConfig:
lo no wireless extensions.
eth0 no wireless extensions.
Keyfiles: Error: [Errno 2] No such file or directory
ProcEnviron:
LC_TIME=
PATH=(custom, user)
LANG=en_US.utf8
SHELL=/bin/bash
LC_PAPER=
RfKill:
SourcePackage: network-manager
WpaSupplicantLog:
Changed in network-manager (Ubuntu): | |
status: | New → Opinion |
Looks like bug 645648 is about the same thing.
Setting /etc/domainname, as suggested there, doesn't make any difference for me.