lxc-create failure creating a lucid container in a precise host with old cache

Bug #942862 reported by Matias Bordese
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
lxc (Ubuntu)
Fix Released
Low
Serge Hallyn
Precise
Fix Released
Medium
Stéphane Graber

Bug Description

== Rationale ==
On apt failure, LXC simply fails without telling the user that they may have an old cache and should just rebuild it.
This confuses some users who had some pretty old lucid cache on their system with out of date apt lists.

The fix includes a better error message on failure and calls apt-get update before trying to install anything.

== Test case ==
1) Use a machine with a very old lucid cache (or manually break the apt lists)
2) lxc-create -t ubuntu -n p1 -- --release lucid
3) Check that it a) works or b) shows an error message telling you to wipe the cache

== Regression potential ==
It's just an extra apt-get update and a better error message so I don't expect any regression here. Worst case scenario, the user will just get the error message and have to wipe the cache.

When running
  lxc-create -t ubuntu -n u1-server -f /etc/lxc/local.conf -- -r lucid -a i386 -b matiasb

It downloads lucid packages, extracts packages, and then fails while installing:

...
I: Installing core packages...
W: Failure trying to run: chroot /var/cache/lxc/lucid/partial-i386 dpkg --force-depends --install /var/cache/apt/archives/libc6_2.11.1-0ubuntu7_i386.deb
failed to execute template 'ubuntu'
aborted

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: lxc 0.7.5-3ubuntu30
ProcVersionSignature: Ubuntu 3.2.0-17.27-generic 3.2.6
Uname: Linux 3.2.0-17-generic i686
ApportVersion: 1.93-0ubuntu2
Architecture: i386
Date: Tue Feb 28 16:51:54 2012
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Alpha i386 (20111129.1)
ProcEnviron:
 TERM=xterm
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: lxc
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Revision history for this message
Matias Bordese (matiasb) wrote :
Revision history for this message
Matias Bordese (matiasb) wrote :

From what I can see, it looks like the error is during this step:

debootstrap --verbose --components=main,universe --arch=i386 --include=dialog,apt,apt-utils,resolvconf,iproute,inetutils-ping,vim,dhcp3-client,ssh,lsb-release,gnupg lucid /var/cache/lxc/lucid/partial-i386

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Thanks for reporting this bug.

I'm setting up a 32-bit host to test on. In the meantime, could you show me the output of

df -h
ls -l /var/cache/lxc/lucid
getent passwd matiasb

Changed in lxc (Ubuntu):
importance: Undecided → Medium
status: New → Incomplete
Revision history for this message
Matias Bordese (matiasb) wrote :

Here is the output I have.

df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 50G 5.8G 42G 13% /
udev 742M 4.0K 742M 1% /dev
tmpfs 300M 832K 299M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 750M 152K 749M 1% /run/shm
cgroup 750M 0 750M 0% /sys/fs/cgroup
/dev/sda3 60G 36G 22G 63% /home

ls -l /var/cache/lxc/lucid
total 4
drwxr-xr-x 21 root root 4096 Nov 9 2009 partial-i386

getent passwd matiasb
matiasb:x:1000:1000:Matias Bordese,,,:/home/matiasb:/bin/bash

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Thanks. could you try adding -F to the end of that command, i.e.

lxc-create -t ubuntu -n u1-server -f /etc/lxc/local.conf -- -r lucid -a i386 -b matiasb -F

Revision history for this message
Matias Bordese (matiasb) wrote :

Just tried, still getting errors:

...
I: Unpacking xkb-data...
I: Unpacking dialog...
I: Unpacking resolvconf...
W: Failure while installing base packages. This will be re-attempted up to five times.
I: Unpacking apt...
...

Let me know what else I can try, or if there is any other detail that could help.

Revision history for this message
Serge Hallyn (serge-hallyn) wrote : Re: [Bug 942862] Re: lxc-create failure creating a lucid container in a precise host

Quoting Matias Bordese (<email address hidden>):
> Just tried, still getting errors:
>
> ...
> I: Unpacking xkb-data...
> I: Unpacking dialog...
> I: Unpacking resolvconf...
> W: Failure while installing base packages. This will be re-attempted up to five times.

This message is normal (if i recall correctly, due to resolvconf being
installed). Does the container creation fail after this?

> I: Unpacking apt...
> ...
>
> Let me know what else I can try, or if there is any other detail that
> could help.

Revision history for this message
Matias Bordese (matiasb) wrote : Re: lxc-create failure creating a lucid container in a precise host

You are right, just checked again and it finished ok (lxc was created and it is working).
Flushing the cache do the trick?
Thanks!

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Thanks. Yes, if the cache is old enough (yours seemed to be from 2009!) updates can fail in a container. After precise we're hoping to handle this better.

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

I'm going to retitle this bug and mark it confirmed.

The gist is, IMO it should not fail to take an old lucid box and update it.

summary: - lxc-create failure creating a lucid container in a precise host
+ lxc-create failure creating a lucid container in a precise host with old
+ cache
Changed in lxc (Ubuntu):
status: Incomplete → Confirmed
importance: Medium → Low
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Marking low priority as there is a workaround.

Changed in lxc (Ubuntu):
assignee: nobody → Serge Hallyn (serge-hallyn)
status: Confirmed → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lxc - 0.8.0~rc1-4ubuntu35

---------------
lxc (0.8.0~rc1-4ubuntu35) quantal; urgency=low

  * 0220-getitem-per-hook-type: support clear_item for specific hooks.
    (LP: #1050719)
  * 0221-make-nonflush-upgrades-robust: be more robust about out of date
    container caches. (LP: #942862)
 -- Serge Hallyn <email address hidden> Fri, 14 Sep 2012 11:45:46 -0500

Changed in lxc (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Per the duplicate bug, 0221-make-nonflush-upgrades-robust should be SRUd to precise.

Changed in lxc (Ubuntu Precise):
importance: Undecided → Medium
description: updated
Changed in lxc (Ubuntu Precise):
assignee: nobody → Stéphane Graber (stgraber)
status: New → In Progress
Revision history for this message
Clint Byrum (clint-fewbar) wrote : Please test proposed package

Hello Matias, or anyone else affected,

Accepted lxc into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/lxc/0.7.5-3ubuntu67 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in lxc (Ubuntu Precise):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Stéphane Graber (stgraber) wrote :

Tested, all good.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Colin Watson (cjwatson) wrote : Update Released

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

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

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

  * Don't directly write/remove /etc/dnsmasq.d/lxc as that's causing problems
    when removing and reinstalling lxc.
    Instead have dnsmasq ship /etc/dnsmasq.d-available/lxc and create/remove
    a symlink in /etc/dnsmasq.d/. (LP: #1113821)
  * Bump debhelper dependency and add Pre-Depends on newer dpkg for above fix.
  * Allow the container to mount efivars on /sys/firmware/efi/efivars.
    efivars is automatically mounted by mountall on UEFI systems, failure to
    do so leads to a complete boot failure. (LP: #1117589)
  * 0221-make-nonflush-upgrades-robust: be more robust about out of date
    container caches. (LP: #942862)
  * 0207-ubuntu-cloud-fixes.patch: cleanups to lxc-ubuntu-cloud.in
    fix for quantal images that do not have user 'ubuntu' present
    (LP: #1045955)
  * 0301-debian-copy-config: Pass all the arguments to copy_configuration.
    (LP: #1111613)
 -- Stephane Graber <email address hidden> Thu, 07 Feb 2013 13:08:07 -0500

Changed in lxc (Ubuntu Precise):
status: Fix Committed → 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.