[Lxc-users] help with root mount parameters

Ferenc Wagner wferi at niif.hu
Wed May 26 08:38:04 UTC 2010


atp <Andrew.Phillips at lmax.com> writes:

> [root at islab01 lxc]# lxc-start -n test01.dev.tradefair/
> lxc-start: No such file or directory - failed to access to
> '/usr/lib64/lxc', check it is present

This directory should be created by make install, but it isn't yet.

> I don't have a lxc.rootfs.mount option in my config file,
> so /usr/lib64/lxc seems to be the default (although confusingly
> LXCROOTFSMOUNT is /usr/local/lib/lxc).  

I'd submit a patch for that myself if I could see through the autoconf
maze.

> 	{ "lxc.rootfs.mount",         config_rootfs_mount         },
> 	{ "lxc.rootfs",               config_rootfs               },
> 	{ "lxc.pivotdir",             config_pivotdir             },
>
> This now gives us several ways of specifying a root directory.

No, they are for different purposes.

When setting up a container with a rootfs, lxc does a pivot_root(2)
syscall to remove the original (host) root from the container namespace.
pivot_root(rootfs, pivotdir) makes rootfs the new root, and at the same
time moves the old root onto pivotdir (under the new root), where it can
be umounted from later.  So the above config requires
/var/lib/nfsroot/mnt to exist beforehand.  (If pivotdir is not
specified, a temporary directory is created and used instead, which
generally works, unless rootfs is read only.)

Now the above pivot_root syscall works only if rootfs and pivotdir are
not on the current root filesystem instance, which may or may not be the
case in a given configuration.  So lxc first recursively binds rootfs to
rootfs.mount (in the container namespace) and pivots into that to ensure
that the above requirement is always satisfied.
-- 
HTH,
Feri.




More information about the lxc-users mailing list