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

Serge Hallyn serge.hallyn at canonical.com
Fri Oct 26 06:38:22 PDT 2012


Quoting Lennart Poettering (lennart at poettering.net):
> On Thu, 25.10.12 14:02, Serge Hallyn (serge.hallyn at canonical.com) wrote:
> 
> > > > Ok...  I've done some cursory search and turned up nothing but some
> > > > comments about "pre mount hooks".  Where is the documentation about this
> > > > feature and how I might use / implement it?  Some examples would
> > > > probably suffice.  Is there a require release version of lxc-utils?
> > > 
> > > I think I found what I needed in the changelog here:
> > > 
> > > http://www.mail-archive.com/lxc-devel@lists.sourceforge.net/msg01490.html
> > > 
> > > I'll play with it and report back.
> > 
> > Also the "Lifecycle management hooks" section in
> > https://help.ubuntu.com/12.10/serverguide/lxc.html
> > 
> > Note that I'm thinking that having lxc-start guess how to fill in /dev
> > is wrong, because different distros and even different releases of the
> > same distros have different expectations.  For instance ubuntu lucid
> > wants /dev/shm to be a directory, while precise+ wants a symlink.  So
> > somehow the template should get involved, be it by adding a hook, or
> > simply specifying a configuration file which lxc uses internally to
> > decide how to create /dev.
> 
> /dev/shm can be created/mounted/symlinked by the OS in the
> container. This is nothing LXC should care about.
> 
> My recommendation for LXC would be to unconditionally pre-mount /dev as
> tmpfs, and add exactly the device nodes /dev/null, /dev/zero, /dev/full,
> /dev/urandom, /dev/random, /dev/tty, /dev/ptmx to it. That is the
> minimal set you need to boot a machine. All further
> submounts/symlinks/dirs can be created by the OS boot logic in the
> container.

I'm thinking we'll do that, optionally.  Templates (including fedora
and ubuntu) can simply always set the option to mount and fill /dev.
Others (like busybox and mini-sshd) won't.

> That's what libvirt-lxc and nspawn do, and is what we defined in:
> 
> http://www.freedesktop.org/wiki/Software/systemd/ContainerInterface
> 
> It would be good if LXC would do the same in order to minimize the
> manual user configuration necessary.
> 
> Lennart

Agreed it simplifies things for full system containers with modern distros.

thanks,
-serge


More information about the systemd-devel mailing list