[Lxc-users] Running archlinux container on a ubuntu 12.04 host

Thiago Padilha tpadilha84 at gmail.com
Tue Mar 19 19:30:56 UTC 2013


Hi

I've began to experiment with lxc by running a ubuntu 12.04 minimal
installation(console-only) inside virtualbox. The default
templates(contained in the lxc distro package) run just fine, but I'm
having trouble getting a simple archlinux container to run. I have
searched the web for a solution and I guess the problem is related to
systemd, but I couldn't find a solution/workaround that works so far.
Here is how I create my archlinux container(these commands can be run
on a fresh ubuntu 12.04 minimal install):

apt-get install lxc
mkdir -p /var/lib/lxc/arch/rootfs
wget http://tokland.googlecode.com/svn/trunk/archlinux/arch-bootstrap.sh
./arch-bootstrap.sh /var/lib/lxc/arch/rootfs
mount -t proc none /var/lib/lxc/arch/rootfs/proc
mount -t sysfs none /var/lib/lxc/arch/rootfs/sys
mount -o bind /dev /var/lib/lxc/arch/rootfs/dev
mount -o bind /dev/pts /var/lib/lxc/arch/rootfs/dev/pts
chroot /var/lib/lxc/arch/rootfs

Inside the chroot:

pacman-key --init # to make this work I keep running commands that
generate entropy in other consoles(cat /usr/bin/* > /dev/null &) until
this completes
pacman-key --populate archlinux
pacman -Syu
pacman -S base base-devel (excluding some uneeded packages such as 'linux')

Now I configure some basics (locale, timezone, vconsole) just like I
would configure a new archlinux system, exit the chroot and unmount
/dev, /dev/pts, /proc and /sys

After the install I create two files in /var/lib/lxc/arch:

config:
----
lxc.rootfs = /var/lib/lxc/arch/rootfs
lxc.fstab = /var/lib/lxc/arch/fstab
----

and fstab:
----
proc proc proc nodev,noexec,nosuid 0 0
sysfs sys sysfs defaults 0 0
----

Then I try to start:

lxc-start -n arch

And then the console hangs with no output(ctrl+c doesn't work, I have
to go to another tty and type 'lxc-stop -n arch')

Does anyone knows a way to make a recent version of archlinux(based on
systemd) run under ubuntu 12.04? I dont care much for security so any
workarounds are appreciated.

Thanks in advance.




More information about the lxc-users mailing list