/etc/hosts in container is missing the usual aliases

Bug #1004108 reported by Stéphane Graber on 2012-05-24
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
lxc (Ubuntu)
Precise
Undecided
Stéphane Graber
Quantal
Undecided
Stéphane Graber

Bug Description

The /etc/hosts file created by the lxc-ubuntu template is missing some of the usual entries.

A standard /etc/hosts should look like this:
127.0.0.1 localhost
127.0.1.1 castiana castiana.lan.sherb.stgraber.net

# 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

But a standard /etc/hosts generated by LXC looks like:
127.0.0.1 localhost quantal

----

[impact]
Non standard /etc/hosts makes services using the ip6- aliases fail to work entirely, the non-standard 127.0.0.1/127.0.1.1 setup was actually causing behaviour changes for the hostname command among others.

[test case]
Testcase:
1) sudo rm -Rf /var/cache/lxc/precise
2) sudo lxc-create -n p1 -t ubuntu
3) cat /var/lib/lxc/p1/rootfs/etc/hosts

Here, 3) should list a standard /etc/hosts with both a 127.0.0.1 and 127.0.1.1 entry and the usual ip6- aliases

[regression potential]
The SRU just adds the missing text to /etc/hosts, only potential regression is if something was specifically depending on the broken format and that'd be bug.

Changed in lxc (Ubuntu):
status: New → Fix Released
Changed in lxc (Ubuntu Precise):
status: New → In Progress
assignee: nobody → Stéphane Graber (stgraber)
description: updated
summary: - /etc/hosts in conainer is missing the usual aliases
+ /etc/hosts in container is missing the usual aliases
Changed in lxc (Ubuntu Precise):
status: In Progress → Fix Committed
no longer affects: lxc (Ubuntu)
Changed in lxc (Ubuntu Quantal):
assignee: nobody → Stéphane Graber (stgraber)

Thanks for uploading the fix for this bug report to -proposed. However, when reviewing the package in -proposed and the details of this bug report I noticed that the bug description is missing information required for the SRU process. You can find full details at http://wiki.ubuntu.com/StableReleaseUpdates#Procedure but essentially this bug is missing some of the following: a statement of impact, a test case and details regarding the regression potential. Thanks in advance!

description: updated
description: updated

Hello Stéphane, or anyone else affected,

Accepted lxc into precise-proposed. The package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

tags: added: verification-needed
Stéphane Graber (stgraber) wrote :

fix confirmed

tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lxc - 0.7.5-3ubuntu58

---------------
lxc (0.7.5-3ubuntu58) precise-proposed; urgency=low

  * Fix broken logic in lxc-ubuntu template where lxc.devttydir would be
    set to 'lxc' only for releases that don't support it. (LP: #1007493)

lxc (0.7.5-3ubuntu57) precise-proposed; urgency=low

  [ Serge Hallyn ]
  * 0083-always-close-all-fds.patch: Have lxc-start always run with
    --close-all-fds. There is no advantage to having lxc-start fail with
    inherited fds. (LP: #1003583)
  * debian/lxc-net.upstart: don't put '()' after call to cleanup.
    (LP: #1000174)

  [ Stéphane Graber ]
  * Sync lxc-ubuntu with the one in Quantal:
    - Bugfixes:
      + Update list of extra packages for debootstrap to only include vim
        and ssh. The others were only relevant when we were still using the
        minbase variant. (LP: #996839)
      + Update default /etc/hosts to match that of a regular Ubuntu system.
        (adds missing ipv6 aliases) (LP: #1004108)
      + Make sure /etc/resolv.conf is valid before running any apt command.
        Fixes a potential race condition (no report of it at this time).

    - Improvements we get by pulling the whole patch from Quantal.
      These don't contain any user behaviour change but will make
      cherry-picking any further change much easier.
      + Drop any hardcoded Ubuntu version check and replace by feature
        checks instead. This removes the need for SRUs whenever we release
        a new Ubuntu.
      + Format lxc-ubuntu to consistently use 4-spaces indent instead
        of mixed spaces/tabs.
      + Update default /etc/network/interfaces to include the header.
      + Drop support for never supported releases (gutsy on sparc).
      + Update template help message for release and arch parameters.
        Old string was only listing i386 and amd64, which is no longer
        accurate (as of 12.04).
        (This string isn't translated)
      + Switch default Ubuntu version from lucid to precise for systems
        that don't have lsb_release (won't affect Ubuntu)

  * Sync lxc-start-ephemeral with the one in Quantal:
    - Switch lxc-start-ephemeral from unreliable parsing of DHCP lease files
      to using "ip netns" to retrieve the IP from the container's network
      namespace. (LP: #994752)
    - Fix a race in lxc-start-ephemeral where the container isn't yet
      running when trying to get its IPs.
    - Update a few calls so that lxc-start-ephemeral can be called as a
      user (ensure consistent usage of sudo across the script). (LP: #1004069)
 -- Stephane Graber <email address hidden> Fri, 01 Jun 2012 11:46:50 -0400

Changed in lxc (Ubuntu Precise):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers