[Lxc-users] lxc-start-ephemeral fails unless run as root?
Dan Kegel
dank at kegel.com
Thu Oct 11 21:13:01 UTC 2012
Not sure what's up with this, but on my ubuntu 12.04.1 system,
lxc-start-ephemeral seems to trip over its shoelaces:
$ lxc-start-ephemeral -o precise5-ubu10
Setting up ephemeral container...
mkdir: cannot create directory
`/var/lib/lxc/precise5-ubu10-temp-ZXnntF1/rootfs': Permission denied
mount: mount point /var/lib/lxc/precise5-ubu10-temp-ZXnntF1/rootfs
does not exist
cp: cannot stat `/var/lib/lxc/precise5-ubu10-temp-ZXnntF1/config':
Permission denied
cp: cannot stat `/var/lib/lxc/precise5-ubu10-temp-ZXnntF1/fstab':
Permission denied
cp: cannot stat
`/var/lib/lxc/precise5-ubu10-temp-ZXnntF1/rootfs.hold': Permission
denied
sed: can't read /var/lib/lxc/precise5-ubu10-temp-ZXnntF1/fstab: No
such file or directory
sed: can't read /var/lib/lxc/precise5-ubu10-temp-ZXnntF1/config: No
such file or directory
sed: can't read
/var/lib/lxc/precise5-ubu10-temp-ZXnntF1/rootfs/etc/hostname: No such
file or directory
sed: can't read
/var/lib/lxc/precise5-ubu10-temp-ZXnntF1/rootfs/etc/hosts: No such
file or directory
cp: cannot stat `/var/lib/lxc/precise5-ubu10-temp-ZXnntF1/fstab': No
such file or directory
/usr/bin/lxc-start-ephemeral: line 160:
/var/lib/lxc/precise5-ubu10-temp-ZXnntF1/fstab.old: Permission denied
mv: cannot stat `/var/lib/lxc/precise5-ubu10-temp-ZXnntF1/config': No
such file or directory
/usr/bin/lxc-start-ephemeral: line 160:
/var/lib/lxc/precise5-ubu10-temp-ZXnntF1/config.old: Permission denied
Starting up the container...
And then it hangs.
Adding a sudo to that mkdir gets rid of a couple errors, but then I still see
$ lxc-start-ephemeral -o precise5-ubu10
Setting up ephemeral container...
cp: cannot stat `/var/lib/lxc/precise5-ubu10-temp-G5kNWUW/config':
Permission denied
cp: cannot stat `/var/lib/lxc/precise5-ubu10-temp-G5kNWUW/fstab':
Permission denied
cp: cannot stat
`/var/lib/lxc/precise5-ubu10-temp-G5kNWUW/rootfs.hold': Permission
denied
sed: can't read /var/lib/lxc/precise5-ubu10-temp-G5kNWUW/fstab: No
such file or directory
sed: can't read /var/lib/lxc/precise5-ubu10-temp-G5kNWUW/config: No
such file or directory
cp: cannot stat `/var/lib/lxc/precise5-ubu10-temp-G5kNWUW/fstab': No
such file or directory
/usr/bin/lxc-start-ephemeral: line 160:
/var/lib/lxc/precise5-ubu10-temp-G5kNWUW/fstab.old: Permission denied
mv: cannot stat `/var/lib/lxc/precise5-ubu10-temp-G5kNWUW/config': No
such file or directory
/usr/bin/lxc-start-ephemeral: line 160:
/var/lib/lxc/precise5-ubu10-temp-G5kNWUW/config.old: Permission denied
Starting up the container...
and it still hangs.
Running with bash -x shows:
...
+ sudo cp /var/lib/lxc/precise5-ubu10-temp-UZ8wtxV/fstab
/var/lib/lxc/precise5-ubu10-temp-UZ8wtxV/fstab.old
+ sudo tee /var/lib/lxc/precise5-ubu10-temp-UZ8wtxV/fstab
/usr/bin/lxc-start-ephemeral: line 160:
/var/lib/lxc/precise5-ubu10-temp-UZ8wtxV/fstab.old: Permission denied
+ '[' -n '' ']'
+ c=/var/lib/lxc/precise5-ubu10-temp-UZ8wtxV/config
+ sudo mv /var/lib/lxc/precise5-ubu10-temp-UZ8wtxV/config
/var/lib/lxc/precise5-ubu10-temp-UZ8wtxV/config.old
+ sudo tee /var/lib/lxc/precise5-ubu10-temp-UZ8wtxV/config
/usr/bin/lxc-start-ephemeral: line 160:
/var/lib/lxc/precise5-ubu10-temp-UZ8wtxV/config.old: Permission denied
+ sudo rm -f /var/lib/lxc/precise5-ubu10-temp-UZ8wtxV/config.old
+ start_container
...
Mysterious. Whereas just running the whole script as root works.
Maybe it's time to purge all the sudo's out of it.
Or maybe the great initctl explosion of '12 has messed with my machine...
- Dan
More information about the lxc-users
mailing list