Description of problem: lxc execute ignores the chroot I have specified - it runs the specified command in the "real" root. Version-Release number of selected component (if applicable): lxc-0.6.4-1.fc13.i686 How reproducible: Always Steps to Reproduce: 1. mkdir /cgroup 2. mount -t cgroup cgroup /cgroup 3. mkdir /var/lib/lxc 4. create a lxc.conf file like the following: lxc.rootfs=/var/lib/mach/roots/fedora-development-i386-core lxc.mount.entry=/dev /var/lib/mach/roots/fedora-development-i386-core/dev none rw,bind 0 0 lxc.mount.entry=/dev/pts /var/lib/mach/roots/fedora-development-i386-core/dev/pts none rw,bind 0 0 5. populate the chroot 6. lxc-create -n bug -f lxc.conf 7. lxc-execute -n bug /bin/bash 8. ls / Actual results: contents of "real" root displayed Expected results: contents of my chroot displayed Additional info: I tried to step through lxc-execute in gdb to debug it, but my attempts to set breakpoints in the cloned process didn't work.
# mkdir -p /tmp/test # cd /tmp/test # cat << EOF > config lxc.utsname = lxc.pts = 1024 lxc.rootfs = /tmp/test/rootfs lxc.mount.entry=/dev /tmp/test/rootfs/dev none ro,bind 0 0 lxc.mount.entry=/lib /tmp/test/rootfs/lib none ro,bind 0 0 lxc.mount.entry=/bin /tmp/test/rootfs/bin none ro,bind 0 0 lxc.mount.entry=/usr //tmp/test/rootfs/usr none ro,bind 0 0 lxc.mount.entry=/sbin /tmp/test/rootfs/sbin none ro,bind 0 0 lxc.mount.entry=tmpfs /tmp/test/rootfs/var/run tmpfs defaults 0 0 lxc.mount.entry=/lib64 /tmp/test/rootfs/lib64 none ro,bind 0 0 EOF # mkdir -p /tmp/test/rootfs/dev # mkdir -p /tmp/test/rootfs/proc # mkdir -p /tmp/test/rootfs/lib # mkdir -p /tmp/test/rootfs/bin # mkdir -p /tmp/test/rootfs/usr # mkdir -p /tmp/test/rootfs/sbin # mkdir -p /tmp/test/rootfs/var/run # mkdir -p /tmp/test/rootfs/lib64 # mkdir -p /tmp/test/rootfs/tmp # lxc-execute -f config -n bug /bin/touch /tmp/123 # ls -d /tmp/123 ls: cannot access /tmp/123: No such file or directory # ls -d /tmp/test/rootfs/tmp/123 /tmp/test/rootfs/tmp/123
I tried to use lxc-0.6.5 from koji, but I got an error: lxc-execute: No such file or directory - failed to exec /usr/libexec/lxc-init Downgrading back to lxc-0.6.4, I still see this bug with *my* test case. Please try my test case.
I just tried your test case, with lxc-0.6.4, and I got lxc-execute: No such file or directory - failed to exec /usr/libexec/lxc-init which is strange. This is the error message I got from lxc-0.6.5 for *my* test case, but my test case didn't produce that error message on lxc-0.6.4.
I got that message even after removing /lib64 from the config file of your test case, which shouldn't have been there because this is on i686, where /lib64 doesn't exist.
It sounds like you should hit up the lxc mailing list and make sure you really understand how the configuration stuff works. My test case shows that chroot works in 0.6.5 so I'm closing this with a solution of upgrade to 0.6.5 (aka NEXTRELEASE).
lxc-0.6.5-1.fc13 has been submitted as an update for Fedora 13. http://admin.fedoraproject.org/updates/lxc-0.6.5-1.fc13
lxc-0.6.5-1.fc13 has been pushed to the Fedora 13 stable repository. If problems still persist, please make note of it in this bug report.