[Lxc-users] Ubuntu 12.04 container non-root logins fail

Thaddeus Hogan thaddeus at thogan.com
Fri Mar 9 03:34:49 UTC 2012


I created a new container with the following command:

lxc-create -n test2 -t ubuntu -- -r precise

When I start this container everything is working fine. However I don't 
want my containers in /var/lib/lxc (ext4 fs) so I copy the rootfs to a 
btrfs volume mounted to "/vm", into a subvolume that shares its name 
with the container, "test2".

I copy the config and fstab files from /var/lib/lxc/test2 to /vm/conf 
and make the appropriate edits to reference the new lxc.mount file 
location and the new rootfs location.

I then run "lxc-destroy -n test2" to remove the container and run 
"lxc-create -n test2 -f /vm/conf/test2.conf" to re-create the container 
with the new rootfs location.

I can start the container and it comes up fine, but logging into the 
container as any non-root user fails. Also, logging in as root and 
attempting to "su - tjh" fails (tjh is a user account I created).

I ran strace on the su process and you can see that it proceeds fine all 
the way though to the setuid() call, but then cannot chdir() to 
"/home/tjh", or even to "/"!

setuid(1000)                            = 0
chdir("/home/tjh")                      = -1 EACCES (Permission denied)
chdir("/")                              = -1 EACCES (Permission denied)
write(2, "Unable to cd to '/home/tjh'\n", 28Unable to cd to '/home/tjh') 
= 28

Any thoughts? I was banking on using a btrfs volume for my containers. 
Thanks in advance!

-- Thaddeus






More information about the lxc-users mailing list