[Lxc-users] systemd inside LXC

John lxc at jelmail.com
Fri Oct 19 13:29:55 UTC 2012


Hello, I'm in the middle of a migration from init to systemd. I've 
completed the transition of my host environment and my 6 existing 
containers continue to work as expected (they all use sysvinit 
internally). I've started work on a systemd container and am getting 
some odd effects.

First off, if I use systemd-nspawn to start the container, it starts 
fine. I can log in and halt it and all goes as expected. If, however I 
use lxc-start, it clobbers my desktop, which is running in another 
container.

So I have 2 problems: (a) the container does not boot and (b) it manages 
to effect changes in another container.

I've been searching the 'net for most of this morning looking for 
information on using systemd inside a container.

I'm using Arch Linux (3.6.2-1-ARCH) with LXC 0.8.0-rc2. Arch now uses 
systemd by default.

To try to test this, I created a basic container and this exhibits the 
same problems:

$ mkarchroot test base

Starting with systemd-nspawn works fine:
$  systemd-nspawn -D test/ /sbin/init

Starting with LXC does not:
$ lxc-create -n test -f test.conf
$ lxc-start -n test

The file test.conf contains these two lines:

lxc.utsname = test2
lxc.rootfs = /srv/lxc/test

When I start the container in LXC, all that happens is that my X session 
dies (this is running in another container). The X session re-starts but 
the keyboard does not work. I have to connect using another machine to 
kill the test container and re-start my desktop container. I can't see 
anything starting inside the test container.

I'd be grateful for any help and/or pointers in the right direction so I 
can complete this transition to systemd.

Many thanks,
John






More information about the lxc-users mailing list