]> git.proxmox.com Git - mirror_lxc.git/commit - src/lxc/conf.c
fix pivot_root temporary directory
authorDaniel Lezcano <daniel.lezcano@free.fr>
Mon, 10 May 2010 09:50:09 +0000 (11:50 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Mon, 10 May 2010 09:50:09 +0000 (11:50 +0200)
commit1b09f2c057205db6f31caa76c3605eb0dc7eec86
treedbd762d71d13b12bba1c9feeda8ef1b7a9e6b30b
parent5c2940600e301a62dbf8fac3ed00f466003bdadb
fix pivot_root temporary directory

First of all, when trying to start a container in a read-only root
lxc-start complains:
  lxc-start: Read-only file system - can't make temporary mountpoint

This is in conf.c:setup_rootfs_pivot_root() function.  That function
uses optional parameter "lxc.pivotdir", or creates (and later removes)
a temporary directory for pivot_root.  Obviously there's no way to
create a directory in a read-only filesystem.

But lxc.pivotdir does not work either. In the function mentioned above
it is used with leading dot (eg. if I specify "lxc.pivotdir=pivot" in
the config file the pivot_root() syscall will be made to ".pivot" with
leading dot, not to "pivot"), but later on it is used without that dot,
and fails:

  lxc-start: No such file or directory - failed to open /pivot/proc/mounts
  lxc-start: No such file or directory - failed to read or parse mount list '/pivot/proc/mounts'
  lxc-start: failed to pivot_root to '/stage/t'

(that's with "lxc.pivotdir = pivot" in the config file).  After symlinking
pivot to .pivot it still fails:

  lxc-start: Device or resource busy - could not unmount old rootfs
  lxc-start: failed to pivot_root to '/stage/t'

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Reported-by: Michael Tokarev <mjt@tls.msk.ru>
src/lxc/conf.c
src/lxc/utils.c
src/lxc/utils.h