[lxc-devel] Strange problem (stray mounts) with lxc-create...

Serge Hallyn serge.hallyn at ubuntu.com
Wed Oct 9 14:50:57 UTC 2013


> lxc-create -n Ubuntu-test -t ubuntu
> 
> Bingo...
> 
> /dev/mapper/fedora-root on /usr/lib64/lxc/rootfs type ext4 (rw,relatime,seclabel,data=ordered)
> 
> Why is lxc-create even creating that mount?  I don't see any reason for

Check lxccontainer.c:785 and line 805.  We call bdev_mount() in case its
a blockdev.  In the case of a dir-backed container we still end up doing
a bind mount of the rootfs.

> it.  We're never running the container in lxc-create.  Running
> "umount /usr/lib64/lxc/rootfs" clears it and we're off to the races
> again.
> 
> If I were to venture a WAG (Wild Ass Guess) some initialization code is
> creating that bind mount that is not needed and that the cleanup code in
> lxc-create is unaware of.  But I haven't gone to the trouble of trying
> to track the code down yet.

Now is your / still MS_SHARED?  The bdev create and templates
run in a private namespace, but if MS_SHARED then the mounts get
bounced back to host.  Maybe we need to manually set MS_PRIVATE every
time after doing an unshare() in lxc code.




More information about the lxc-devel mailing list