[Lxc-users] systemd inside LXC

Serge Hallyn serge.hallyn at canonical.com
Fri Oct 19 15:51:01 UTC 2012


Quoting John (lxc at jelmail.com):
> 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

Add:

lxc.network.type = empty

If you don't have any lxc.network.type sections, then the container
shares network with the host, and so the container talks to the host's
systemd.  (same with upstart)

> 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
> 
> 
> 
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
> _______________________________________________
> Lxc-users mailing list
> Lxc-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-users




More information about the lxc-users mailing list