ubuntu template should fail on error

Bug #922645 reported by Serge Hallyn
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxc (Ubuntu)
Fix Released
High
Serge Hallyn
Oneiric
Fix Released
High
Unassigned

Bug Description

lxc-create should fail if parts of the ubuntu container setup failed.

TEST CASE:

1. make sure /var/cache/lxc is empty
2. lxc-create -n test -t ubuntu -- oneiric
3. edit /var/cache/lxc/oneiric/etc/resolv.conf , set DNS server to unroutable IP (192.168.200.99)
4. lxc-create -n test2 -t ubuntu -- oneiric
5. verify exit code is 0 (echo $?)
6. chroot /var/lib/lxc/test2/rootfs dpkg -l lxcguest # verify that no lxcguest is installed
7. lxc-destroy -n test2
7. Install updated lxc
8. Repeat step 4
9. verify exit code is not 0

Related branches

Changed in lxc (Ubuntu):
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Serge Hallyn (serge-hallyn)
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

lxc-create does a good job now of cleaning up after failures. So just adding 'set -e' to the top of lxc-ubuntu seems to be working for me.

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

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

---------------
lxc (0.7.5-3ubuntu14) precise; urgency=low

  * debian/control: add btrfs-tools to lxc Suggests (LP: #942241)
  * 0030-ubuntu-template-fail.patch: make lxc-ubuntu template fail on
    error (LP: #922645)
  * 0031-ubuntu-template-resolvconf.patch: handle /etc/resolv.conf being
    a symlink as is now done by resolvconf by default. (LP: #922706)
  * debian/lxcguest.lxcmount.upstart: emit mounted MOUNTPOINT=/run
    to make resolvconf start. (LP: #922706)
 -- Serge Hallyn <email address hidden> Fri, 27 Jan 2012 11:13:26 -0600

Changed in lxc (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Simple change, I think its worth backporting to oneiric.

Changed in lxc (Ubuntu Oneiric):
status: New → Triaged
importance: Undecided → High
Revision history for this message
Serge Hallyn (serge-hallyn) wrote : Re: [Bug 922645] Re: ubuntu template should fail on error

Quoting Clint Byrum (<email address hidden>):
> Simple change, I think its worth backporting to oneiric.

I'm happy to SRU it, but note that precise has already had some
changes to lxc-create and lxc-destroy which allowed this to be
a two-line change. So for oneiric it'll be a bit (but not too
much) bigger.

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

Actually the extra changes weren't as crucial as I'd thought, but the one part was badly behaving when config was not yet written (as it might not if lxc-ubuntu exits early), so it's nice to have.

The new version (correctly) exits with 1 and cleans up when i mess up networking for the container so that it can't install lxcguest. Pushed to oneiric-proposed.

Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Hello Serge, or anyone else affected,

Accepted lxc into oneiric-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!

Changed in lxc (Ubuntu Oneiric):
status: Triaged → Fix Committed
tags: added: verification-needed
description: updated
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Verified using test case on oneiric.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lxc - 0.7.5-0ubuntu8.4

---------------
lxc (0.7.5-0ubuntu8.4) oneiric-proposed; urgency=low

  * 0022-fix-lxc-destroy-bugs.patch:
    - don't delete a running container
    - handle case where rootfs is not specififed in config (or config is
      corrupt or has been deleted)
    - fix broken detection of lvm backing store
  * 0030-ubuntu-template-fail.patch: make lxc-ubuntu template fail on
    error (LP: #922645)
 -- Serge Hallyn <email address hidden> Sat, 28 Jan 2012 12:25:39 -0600

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.