[Lxc-users] [systemd-devel] Unable to run systemd in an LXC / cgroup container.

John lxc at jelmail.com
Wed Dec 5 21:43:59 UTC 2012


On 05/12/12 14:55, Michael H. Warfield wrote:
[...]
>> Ah yes, the "pivot root" problem. I have worked around this for the time
>> being by doing a "mount --make-rprivate /". I created a systemd service
>> on the host as an "after" dependency on "systemd-remount-fs.service" to
>> do this. I believe this is ok in the short term (it appears to work ok
>> for me).
> Hmmm...  I was thinking someone ran into some problems doing that and
> causing problems with the /dev/pts mounts or some such.  Good to note if
> that worked for you.  I'm about to start playing with Fedora 18 Beta
> where I expect problems.  I'll try that out.
>
>> If I rebuild lxc from git, should I then expect my existing systemd
>> container to work or is there anything else that I need to do ?
> Yeah, one other thing (in addition to following Serge's advice regarding
> git and #stage)...
>
> You have to add an option to the config file for your systemd
> containers.
>
> lxc.autodev = 1

Ok got that. I used git://github.com/lxc/lxc.git #staging. Built and 
installed ok. Existing containers running. When I try to create a new 
one, with or without the autodev like you suggest, I get the below:

# lxc-create -n test2 -f test2.conf
lxc-create: unknown template ''
lxc-create: aborted

I checked and the above create does work with 0.8.0. I realise it's 
probably a glitch caused by something unrelated and which will probably 
be fixed quite quickly. I may try a re-build in the morning.


Next, I manually edited /var/lib/lxc/test/config to add lxc.autodev to 
it but attempting to start the container gave me this:

# lxc-start -n test2
lxc-start: No such file or directory - failed to mount 'devshm' on 
'/usr/lib/lxc/rootfs//dev/shm'

I had an instruction in the config to mount devshm so I removed that and 
could then start the container up successfully. I got a login prompt and 
can log in. Lovely!

I now need to run some more tests here but I can confirm that the 
staging build will allow a container to start on my Arch system.

FYI (Arch - specific): I used a modified copy of the lxc-git PKGBUILD 
(https://aur.archlinux.org/packages/lx/lxc-git/PKGBUILD) to build 
lxc#staging. I only changed the git root to be 
"git://github.com/lxc/lxc.git".

ps. I Just did an lxc-destroy while testing and it appears to now be 
destructive. That took me by surprise.

Regards,
John





More information about the lxc-users mailing list