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

John lxc at jelmail.com
Fri Dec 7 10:05:48 UTC 2012


On 07/12/12 00:48, Serge Hallyn wrote:
> Quoting John (lxc at jelmail.com):
>> On 06/12/12 20:06, Dan Kegel wrote:
>>> On Thu, Dec 6, 2012 at 12:00 PM, John <lxc at jelmail.com> wrote:
>>>> While on the subject, any reason for lxc-destroy now being destructive?
>>> Wait, isn't that the point?  It's in the name and all.
>>>
>>> When was it ever nondestructive?
>>>
>> It only destroyed the configuration in /var/lib and never deleted the
>> root filesystem until very recently (0.8.0, I guess).
> Was your rootfs a symbolic link by chance?  I'm guessing commit
> 55116c42e767ce795f796fc51cd2ef7d76cf18af is what you're seeing.  Before
> that it did remove the rootfs, but if your rootfs was a symlink it
> happened to not do it.  That wasn't by intent.
>
> Perhaps lxc-destroy should take a flag to not delete the rootfs?  Not
> sure...
>

Ah, I can now see what is wrong. It isn't down to symlinks but beacuase 
my rootfs isn't under /var/lib/lxc.

Looking at that commit, I can see that the remove (on line 126) deletes 
"$lxc_path/$lxc_name" but does not explictly remove "$rootdev". The new 
code added at line 122 does indeed remove $rootdev.

In my case I have my container rootfs in a directory called 
"/srv/test.i686" (i.e not underneath $lxc_path - /var/lib/lxc). I guess 
the design assumes that a template is used to create a container and 
that it would put the rootfs beneath /var/lib/test.

So the commit fixes an anomaly but leaves me unsure of a couple of things:

1. what is the correct way to update a container config without removing 
the rootfs. I have always used destroy/create to do this but that, 
clearly, won't work if the destroy phase removes the rootfs. I like 
being able to separately manage the rootfs from its configuration.

2. is it wrong to have the rootfs outside of the /var/lib/lxc ? I have a 
small /var but use a large dedicated partition for my root filesystem 
directories. I suspect I need to look at using per-container lvm 
volumes, something that makes sense but I haven't delved into yet.

I would value having options to preserve the rootfs when doing 
lxc-destroy and for lxc-create to use an existing rootfs (i.e. instead 
of a template).

Thanks very much for the help.






More information about the lxc-users mailing list