upgrade to karmic trashed /etc/hosts

Bug #432892 reported by Nathaniel Smith
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
network-manager (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

I just upgraded today to karmic by running 'update-manager -d'. After the upgrade and reboot finished, my /etc/hosts file was trashed.

Before the upgrade (yay backups) it said:
---------
127.0.0.1 localhost
127.0.1.1 ged.localnet ged

# The following lines are desirable for IPv6 capable hosts
::1 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 the upgrade, it said:
---------
# Do not remove the following line, or various programs# that require network functionality will fail.127.0.0.1 localhost.localdomain localhost
---------

To be clear:
1) This file contains no newlines (even at the end of the file). It is one long mangled comment line.
2) All the usual IPv6 and localnet boilerplate has disappeared. (Maybe that's intentional? I'm not really sure what it's needed for anyway.)

WTF?

Tags: karmic update
Revision history for this message
Nathaniel Smith (njs) wrote :
Revision history for this message
Nathaniel Smith (njs) wrote :
Revision history for this message
Nathaniel Smith (njs) wrote :

Also, note that this was not the only hostname-related weirdness I had created by the karmic upgrade: see also #432888, in case they are related.

Revision history for this message
Nathaniel Smith (njs) wrote :
affects: ubuntu → update-manager (Ubuntu)
tags: added: karmic update
Revision history for this message
Michael Vogt (mvo) wrote :

Could you please run (in a terminal):

$ grep 'Do not remove the following line' /var/lib/dpkg/info/*

update-manager itself does not touch this file, but something in the packages upgraded might.

Changed in update-manager (Ubuntu):
status: New → Incomplete
Revision history for this message
Nathaniel Smith (njs) wrote :

That grep command finds no hits.

OTOH:
  ~$ dpkg -S etc/hosts
  dpkg: *etc/hosts* not found.
So *something*'s creating it, I'm just not sure what.

/usr/lib/ubiquity/netcfg/netcfg seems to have some /etc/hosts-related code, though not the actual line you quoted. This is relevant because of bug 432911 (my upgrade decided to install and run oem-config).

Revision history for this message
Nathaniel Smith (njs) wrote :

Some googling around suggests that the particular phrasing in that comment ("various programs that require network functionality" etc.) is common on Redhat/anaconda-derived systems? Curious.

Revision history for this message
Colin Watson (cjwatson) wrote :

I think this is distinct from bug 432888; the string in Nathaniel's /etc/hosts does not appear anywhere in ubiquity/oem-config's code base.

Revision history for this message
Colin Watson (cjwatson) wrote :

Well, that said, the fact that /etc/hosts was removed on upgrade may have been the fault of oem-config running (bug 432180). However, the fact that malformed text was written to it (the missing newlines, etc.) is definitely a network-manager bug.

affects: update-manager (Ubuntu) → network-manager (Ubuntu)
Changed in network-manager (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Colin Watson (cjwatson) wrote :

./src/NetworkManagerPolicy.c:320: g_string_append (new_contents, "# Do not remove the following line, or various programs");

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

NM no longer touches /etc/hosts.

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.