btrfs via symlink not working

Bug #1046117 reported by Scott Moser
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxc (Ubuntu)

Bug Description

# fresh quantal instance (2012-09-04)
sudo apt-get update
sudo apt-get install lxc btrfs-tools -y </dev/null

# put a btrfs fs on /mnt
sudo umount /mnt
dev=$(awk '$2 == "/mnt" { print $1; }' /etc/fstab)
echo "making fs on $dev"
sudo mkfs -t btrfs $dev -L ephemeral0 $dev
sudo mount /mnt

sudo mkdir /var/lib/lxc /var/cache/lxc # in case they dont already exist

sudo rsync -a /var/lib/lxc/ /mnt/var-lib-lxc
sudo rm -Rf /var/lib/lxc
sudo ln -sf /mnt/var-lib-lxc /var/lib/lxc

sudo rsync -a /var/cache/lxc/ /mnt/var-cache-lxc
sudo rm -Rf /var/cache/lxc
sudo ln -sf /mnt/var-cache-lxc /var/cache/lxc

sudo lxc-create -t ubuntu-cloud -n source-precise-amd64 -- --release precise --arch amd64 --stream daily
sudo lxc-clone -o source-precise-amd64 -n precise-amd64
sudo lxc-start -n precise-amd64 -d
sleep 10
sudo lxc-stop -n precice-amd64
sleep 10

## Then ##

$ sudo lxc-destroy -n precise-amd64
rm: cannot remove `//var/lib/lxc/precise-amd64/rootfs': Directory not empty
rm: skipping `/var/lib/lxc/precise-amd64/rootfs', since it's on a different device

I would have expected this to work.

$ sudo lxc-ls
precise-amd64 source-precise-amd64

I'm not sure what creates this scenario, but some more debug:

$ df /var/lib/lxc/precise-amd64
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vdb 20971520 727396 18217108 4% /mnt

$ df /var/lib/lxc/precise-amd64/rootfs
Filesystem 1K-blocks Used Available Use% Mounted on
- 20971520 727396 18217108 4% /mnt/var-lib-lxc/precise-amd64/rootfs

ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: lxc 0.8.0~rc1-4ubuntu32
ProcVersionSignature: User Name 3.5.0-13.14-generic 3.5.3
Uname: Linux 3.5.0-13-generic x86_64
ApportVersion: 2.5.1-0ubuntu4
Architecture: amd64
Date: Wed Sep 5 00:48:33 2012
Ec2AMI: ami-00000146
Ec2AMIManifest: FIXME
Ec2AvailabilityZone: nova
Ec2InstanceType: m1.small
Ec2Kernel: unavailable
Ec2Ramdisk: unavailable
 PATH=(custom, no user)
SourcePackage: lxc
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

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

Thanks for submitting this bug. Indeed if lxc.rootfs is a symbolic link, it is assumed to be a lvm rootfs.

I tink it should be ssafe to rm -rf --one-filesystem $rootfs if it is a symbolic link but is not a blockdev.

Changed in lxc (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

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

  [ Serge Hallyn ]
  * 0206-lxc-wait-initialize-timeout: initialize timeout to -1 so lxc-wait
    will, by default, wait for the container to enter the requested state.
  * debian/patches/compilecleanups/* - fix compile time warnings.
  * lxc.lxc-net.upstart: tell iptables not to masquerate packets between
    containers. (LP: #1045947)
  * 0208-fix-getitem-utsname-segv: fix seg fault when doing get_item(utsname)
    on newly created container.
  * 0209-reload-conf-after-create: add ability to free a lxc_conf. Use that
    after calling Container->Create() to completely reload the newly created
  * 0211-add-hooks-to-manpage: document lxc.hook in the lxc.conf manpage.
  * 0212-lxc-destroy-rm-symlink: If rootfs is a symbolic link to a directory,
    remove it. (LP: #1046117)
  * 0213-add-premount-hook.patch: add a premount hook to support encrypted
    filesystems. (LP: #1043052)

  [ Scott Moser ]
  * 0207-ubuntu-cloud-fixes.patch: cleanups to
    fix for quantal images that do not have user 'ubuntu' present
    (LP: #1045955)

  [ Rex Tsai ]
  * 0210-fix-debian-templates: Fix lxc-shutdown/lxc-restart in Debian
    containers and fix lxc.utsname for lenny containers.
    (LP: #1046684, LP: #1046696)

  [ Stéphane Graber ]
  * lxc.lxc-net.upstart: Make the iptables call more consistent (LP: #1045947)
 -- Serge Hallyn <email address hidden> Thu, 30 Aug 2012 11:32:06 -0500

Changed in lxc (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
David Schoen (neerolyte) wrote :

I'm still seeing this bug in 0.8.0~rc1-4ubuntu39.12.10.1 on top of btrfs ... are you sure it's fixed?

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

Just tested in raring, it is definately fixed there.

Please file a new bug with full details about your system and how we can reproduce, thanks.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers