[lxc-users] lxc-destroy failure while deleting rootfs for container

Shivraj Ghatkar shivraj2084 at gmail.com
Thu Nov 6 09:17:09 UTC 2014


Hi All

I have 2 lxc-containers (cap_a and cap_b) which are backed by 2 separate
logical volumes (lv_a and lv_b)

The logical volumes are mounted at /capsule_mnt/cap_a and
/capsule_mnt/cap_b for containers cap_a and cap_b respectively.

For sharing from the host side, I have bind mounted
/shared/<container_name> for each of the above containers. For each of the
containers, I am attempting to access mount points  which are mounted from
the host side and can be accessed from the shared mounted directory of each
container.

I was following the instructions mentioned in the following discussion to
ensure that the startup of the second container does not blow up the mount
points of the first container.
https://lists.linuxcontainers.org/pipermail/lxc-users/2012-February/003187.html

Everything works fine as per the instructions mentioned in the above
thread. However, when I try to delete the first container (while the second
container is still up), I get the following error:

root at dev2:~# lxc-stop -n cap_a

root at dev2:~# mount | grep cap
/dev/mapper/vg_1-lv_a on /capsule_mnt/cap_a type ext4 (rw)
/dev/mapper/vg_1-lv_b on /capsule_mnt/cap_b type ext4 (rw)

root at dev2:~# umount /capsule_mnt/cap_a
root at dev2:~# umount /capsule_mnt/cap_a
/dev/mapper/vg_1-lv_b on /capsule_mnt/cap_b type ext4 (rw)

root at dev2:~# lxc-destroy -n cap_a
lxc_container: _recursive_rmdir_onedev: failed to delete /capsule_mnt/cap_a/
lxc_container: Error destroying rootfs for cap_a
Destroying cap_a failed

root at dev2:~# lvremove /dev/vg_1/lv_a
  Logical volume vg_1/lv_a contains a filesystem in use.

Does anyone have an idea as to why this might be happening? It probably has
something to do with mounting the /shared directory as "rslave" before
starting each of the container.

I also observed that the container (cap_a) destroy and deletion of the
logical volume lv_a works fine once the second container (cap_b) is either
stopped or destroyed.

Any suggestion as to how I can get past this issue would be very useful.

Thanks,

-Shivraj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20141106/951d0f7d/attachment.html>


More information about the lxc-users mailing list