lxc-clone makes unbootable clone when using lvm backing store

Bug #1183354 reported by Sergey Volkov
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxc (Ubuntu)
Fix Released
High
Serge Hallyn
Raring
Fix Released
High
Unassigned
Saucy
Fix Released
High
Serge Hallyn

Bug Description

*******************************
1. Impact: lxc-clone for lvm-backed containers is broken
2. Development fix: saucy fixed the use of wrong pathnames in the
 lxc-clone script.
3. Stable fix: same as development fix
4. Test case:
 * Create an lvm backed container, clone it, and try to start the
 clones. (note this requires a LVM vg called 'lxc')
 sudo lxc-create -t ubuntu -B lvm -n c1
 sudo lxc-clone -s -o c1 -n c2
 sudo lxc-clone -o c1 -n c3
 sudo lxc-start -n c2
 sudo lxc-start -n c3
5. Regression potential: none, only the lxc-clone script is updated.
*******************************

Container clones made by lxc-clone is not bootable.
New container config misses lxc.rootfs.
lxc.network.hwaddr is the same as in original container.

# lsb_release -rd
Description: Ubuntu 13.04
Release: 13.04

# apt-cache policy lxc
lxc:
  Installed: 0.9.0-0ubuntu3
  Candidate: 0.9.0-0ubuntu3
  Version table:
 *** 0.9.0-0ubuntu3 0
        500 http://ru.archive.ubuntu.com/ubuntu/ raring/universe amd64 Packages
        100 /var/lib/dpkg/status

Steps to reproduce:
root@lxc-host:~# lxc-create -n ubuntu -t ubuntu -B lvm --fssize 5gb

lxc-create: No config file specified, using the default config /etc/lxc/default.conf
  Logical volume "ubuntu" created
mke2fs 1.42.5 (29-Jul-2012)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
327680 inodes, 1310720 blocks
65536 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1342177280
40 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
 32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

Checking cache download in /var/cache/lxc/raring/rootfs-amd64 ...
Copy /var/cache/lxc/raring/rootfs-amd64 to /var/lib/lxc/ubuntu/rootfs ...
Copying rootfs to /var/lib/lxc/ubuntu/rootfs ...
Generating locales...
  en_US.UTF-8... up-to-date
Generation complete.

##
# The default user is 'ubuntu' with password 'ubuntu'!
# Use the 'sudo' command to run tasks as root in the container.
##

'ubuntu' template installed
Unmounting LVM
'ubuntu' created
root@lxc-host:~#
root@lxc-host:~# lxc-clone -o ubuntu -n ubuntu_clone
Tweaking configuration
Copying rootfs...
  Logical volume "ubuntu_clone_snapshot" created
mkdir: cannot create directory ‘/dev/lxc/ubuntu_clone_snapshot’: File exists

root@lxc-host:~# diff /var/lib/lxc/ubuntu/config /var/lib/lxc/ubuntu_clone/config
9d8
< lxc.mount = /var/lib/lxc/ubuntu/fstab
16d14
< lxc.utsname = ubuntu
52c50,51
< lxc.rootfs = /dev/lxc/ubuntu
---
> lxc.utsname = ubuntu_clone
> lxc.mount = /var/lib/lxc/ubuntu_clone/fstab

If I manually add lxc.rootfs=/dev/lxc/ubuntu_clone_snapshot to /var/lib/lxc/ubuntu_clone/config, container starts normally.

tags: added: lvm
description: updated
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Thanks for submitting this bug. Note that snapshots do seem to work (sudo lxc-clone -s -o r1 -n r2), but non-snapshot ones do indeed hang.

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

The patch introduced to fix this in saucy should be cleanly applicable to raring.

Changed in lxc (Ubuntu Raring):
importance: Undecided → High
Changed in lxc (Ubuntu Saucy):
importance: Medium → High
Changed in lxc (Ubuntu Raring):
status: New → Triaged
Changed in lxc (Ubuntu Saucy):
status: Confirmed → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lxc - 0.9.0-0ubuntu9

---------------
lxc (0.9.0-0ubuntu9) saucy; urgency=low

  * 0006-lxc-clone-fix-lvm-blockdev-usage: fix use of wrong pathnames for both
    block devices and mount targets in the LVM case. (LP: #1183354)
 -- Serge Hallyn <email address hidden> Thu, 23 May 2013 14:22:38 -0500

Changed in lxc (Ubuntu Saucy):
status: In Progress → Fix Released
Revision history for this message
Sergey Volkov (serg-volkov) wrote :

Thank you, Serge.

Rebuild lxc 0.9.0-0ubuntu9 for raring, works as expected now!

description: updated
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Sergey, or anyone else affected,

Accepted lxc into raring-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/lxc/0.9.0-0ubuntu3.3 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 Raring):
status: Triaged → Fix Committed
tags: added: verification-needed
Revision history for this message
Sergey Volkov (serg-volkov) wrote :

Hello Brian

Just tested 0.9.0-0ubuntu3.3

The bug is fixed.

# apt-cache policy lxc
lxc:
  Installed: 0.9.0-0ubuntu3.3
  Candidate: 0.9.0-0ubuntu3.3
  Version table:
 *** 0.9.0-0ubuntu3.3 0
        500 http://archive.ubuntu.com/ubuntu/ raring-proposed/universe amd64 Packages
        100 /var/lib/dpkg/status
     0.9.0-0ubuntu3.2 0
        500 http://ru.archive.ubuntu.com/ubuntu/ raring-updates/universe amd64 Packages
     0.9.0-0ubuntu3 0
        500 http://ru.archive.ubuntu.com/ubuntu/ raring/universe amd64 Packages

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.9.0-0ubuntu3.3

---------------
lxc (0.9.0-0ubuntu3.3) raring-proposed; urgency=low

  * 0006-lxc-clone-fix-lvm-blockdev-usage: fix use of wrong pathnames for both
    block devices and mount targets in the LVM case. (LP: #1183354)
 -- Serge Hallyn <email address hidden> Thu, 30 May 2013 23:47:33 +0200

Changed in lxc (Ubuntu Raring):
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.