Aliases in /etc/hosts overwritten
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
network-manager (Ubuntu) |
Fix Released
|
Low
|
Unassigned | ||
Maverick |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: network-manager
---
WORKAROUND:
You can use aliases against another loopback address in the 127.x.y.z range, such as 127.1.1.z. Addresses within 127.0.y.z are rewritten by NM.
---
SRU JUSTIFICATION:
In its current state NetworkManager overwrites static entries placed in /etc/hosts, users requiring such aliases for Apache servers or whatnot cannot add them (except using the workaround above). This constitutes a regression from the Lucid release, as well as somewhat of an issue for upgrades.
This has been addressed in natty by cherry-picking a patch from the upstream stable git branch which corrects the issue: looking for entries not matching the known hostname and skipping them.
Regression potential is medium/low: users with the patch, in the event it was to break, would lose alias entries, or possibly the hosts entry for the interface's IP. However, standard loopback/localhost entries remain and are ignored.
TEST CASES:
1) Add a custom entry to /etc/hosts sending to the loopback address. e.g.
127.0.0.1 toto123
2) Click on nm-applet, then the already-establish connection to have it re-negotiated.
In the current version in maverick, network-manager removed the entry. With the patch applied, the entry is left intact.
---
I develop several web sites on my laptop, and each one is a different virtual host through Apache. Until Lucid, I was able to alias these hosts in /etc/hosts, like this
127.0.0.1 localhost localhost.
Starting with Maverick, however, NetworkManager overwrites the 127.0.0.1 line every time it initiates a new network connection, so these aliases are lost. It is fair to argue that aliasing 127.0.0.1 isn't ideal, but as far as I can find, NetworkManager doesn't offer any alternative for aliasing the bound IP address. For example, if I connect to WiFi, it adds a line like
192.168.0.101 snape
There seems to be no way to get it to do
192.168.0.101 snape myhost1.localdomain myhost2.localdomain myhost3.localdomain
NetworkManager should not overwrite the 127.0.0.1 line in /etc/hosts until there is an alternative method available for aliasing on the local machine, without setting up an entire local DNS server.
ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: network-manager 0.8.1+git.
ProcVersionSign
Uname: Linux 2.6.35-22-generic x86_64
NonfreeKernelMo
Architecture: amd64
CRDA: Error: [Errno 2] No such file or directory
Date: Wed Oct 13 08:22:07 2010
Gconf:
IfupdownConfig:
auto lo
iface lo inet loopback
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release Candidate amd64 (20100928)
IpRoute:
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.198 metric 1
169.254.0.0/16 dev eth0 scope link metric 1000
default via 192.168.0.1 dev eth0 proto static
Keyfiles: Error: [Errno 2] No such file or directory
ProcEnviron:
PATH=(custom, user)
LANG=en_CA.utf8
SHELL=/bin/bash
RfKill:
0: hp-wifi: Wireless LAN
Soft blocked: no
Hard blocked: no
SourcePackage: network-manager
Changed in network-manager (Ubuntu): | |
status: | New → Triaged |
importance: | Undecided → Low |
description: | updated |
description: | updated |
tags: | added: testcase |
Actually, there is a workaround, and that would be to use another 127.x.y.z address just for the aliases. Could you try setting up your aliases with say, 127.0.0.5 and letting us know whether it works fine for you (and doesn't get overwritten by NM).
This seems like a very valid use case though, and perhaps NetworkManager should be told to add hostname aliases as specified in a connection's settings. The issue you are reporting is an upstream one and it would be nice if somebody having it could send the bug to the developers of the software by following the instructions at https:/ /wiki.ubuntu. com/Bugs/ Upstream/ GNOME. If you have done so, please tell us the number of the upstream bug (or the link), so we can add a bugwatch that will inform us about its status. Thanks in advance.