[Lxc-users] lxc-start leaves temporary pivot dir behind

Ferenc Wagner wferi at niif.hu
Wed May 5 13:15:49 UTC 2010


Hi,

While playing with lxc-start, I noticed that /tmp is infested by empty
lxc-r* directories:

# lxc-start --logfile=/tmp/startlog --logpriority=DEBUG -n jail -s lxc.mount.entry="/ /tmp/jail none bind 0 0" -s lxc.rootfs=/tmp/jail -s lxc.pivotdir=/mnt ls /proc
# cat /tmp/startlog
      lxc-start 1273064291.740 DEBUG    lxc_start - sigchild handler set
      lxc-start 1273064291.740 INFO     lxc_start - 'jail' is initialized
      lxc-start 1273064291.745 DEBUG    lxc_cgroup - using cgroup mounted at '/cgroup'
      lxc-start 1273064291.745 DEBUG    lxc_cgroup - '/cgroup/3178' renamed to '/cgroup/jail'
      lxc-start 1273064291.746 DEBUG    lxc_conf - mounted / on /tmp/jail, type none
      lxc-start 1273064291.746 INFO     lxc_conf - mount points have been setup
      lxc-start 1273064291.746 WARN     lxc_conf - rootfs specified but no console found
      lxc-start 1273064291.746 INFO     lxc_conf - 0 tty(s) has been setup
      lxc-start 1273064291.746 DEBUG    lxc_conf - temporary mountpoint for old rootfs is './mnt'
      lxc-start 1273064291.746 DEBUG    lxc_conf - pivot_root syscall to '/mnt' successful
      lxc-start 1273064291.746 DEBUG    lxc_conf - umounted '/mnt/dev/pts'
      lxc-start 1273064291.746 DEBUG    lxc_conf - umounted '/mnt/dev/shm'
      lxc-start 1273064291.746 DEBUG    lxc_conf - umounted '/mnt/sys'
      lxc-start 1273064291.746 DEBUG    lxc_conf - umounted '/mnt/proc'
      lxc-start 1273064291.747 DEBUG    lxc_conf - umounted '/mnt/lib/init/rw'
      lxc-start 1273064291.747 DEBUG    lxc_conf - umounted '/mnt/var/run'
      lxc-start 1273064291.747 DEBUG    lxc_conf - umounted '/mnt/var/lock'
      lxc-start 1273064291.747 DEBUG    lxc_conf - umounted '/mnt/cgroup'
      lxc-start 1273064291.747 DEBUG    lxc_conf - umounted '/mnt/tmp/jail'
      lxc-start 1273064291.747 DEBUG    lxc_conf - umounted '/mnt/dev'
      lxc-start 1273064291.747 DEBUG    lxc_conf - umounted '/mnt/tmp'
      lxc-start 1273064291.747 DEBUG    lxc_conf - umounted '/mnt'
      lxc-start 1273064291.747 INFO     lxc_conf - pivoted to '/tmp/lxc-rX4K9le'
      lxc-start 1273064291.748 DEBUG    lxc_conf - capabilities has been setup
      lxc-start 1273064291.748 NOTICE   lxc_conf - 'jail' is setup.
      lxc-start 1273064291.748 NOTICE   lxc_start - exec'ing 'ls'
      lxc-start 1273064291.753 NOTICE   lxc_start - 'ls' started with pid '3178'
      lxc-start 1273064291.753 INFO     lxc_console - no console specified
      lxc-start 1273064291.753 WARN     lxc_utmp - '/tmp/jail/var/run/utmp' not found
      lxc-start 1273064291.763 DEBUG    lxc_start - child exited
      lxc-start 1273064291.763 DEBUG    lxc_cgroup - using cgroup mounted at '/cgroup'
      lxc-start 1273064291.764 DEBUG    lxc_cgroup - '/cgroup/jail' unlinked

And /tmp/lxc-rX4K9le is left behind...  Ok, this name comes from
lxc-rootfs in conf.c:setup_rootfs.  After setup_rootfs_pivot_root
returns, the original /tmp is not available anymore, so rmdir(tmpname)
at the bottom of setup_rootfs can't achieve much.  Why is this temporary
name needed anyway?  Is pivoting impossible without it?  I can't see why.
-- 
Thanks,
Feri.




More information about the lxc-users mailing list