[Lxc-users] Container remounts ro an host's mount

Trent W. Buck twb at cybersource.com.au
Mon Nov 29 06:29:55 UTC 2010


Alessandro Guido <ag at alessandroguido.name>
writes:

> Whenever I shutdown a container /var/lib/lxc get remounted ro.

This is because the reboot/halt jobs in /etc/rc[06].d/ try to mount the
root filesystem read-only before halting, and you do not disallow this
in your /etc/lxc/<container name>.conf:

    lxc.cap.drop = sys_admin

Note that this will prevent *all* mount/umount/swapon/swapoff/... within
the container, so anything you use in the container's /etc/fstab or
/lib/init/fstab will need to be moved to lxc.mount.entry lines in your
lxc.conf -- in particular, upstart needs /proc to work at all, and wants
/var/run (tmpfs) for networking.  lxc 0.7.2's lxc-ubuntu contains a
workaround for the latter that in places in the container's
/etc/init/lxc.conf.

Oh, and you may with to dpkg-divert --rename mount, umount, swapon and
swapoff and replace them with symlinks to /bin/true (or /bin/false), so
you get less noise on the container's /dev/console during boot/halt.





More information about the lxc-users mailing list