[lxc-devel] [PATCH 2/3] execute: bind init.lxc.static into container

Serge Hallyn serge.hallyn at ubuntu.com
Tue May 20 18:33:19 UTC 2014


Quoting Serge Hallyn (serge.hallyn at ubuntu.com):
> Quoting Stéphane Graber (stgraber at ubuntu.com):
> > On Mon, May 19, 2014 at 03:51:28PM +0000, Serge Hallyn wrote:
> > > Quoting Stéphane Graber (stgraber at ubuntu.com):
> > > > On Mon, May 12, 2014 at 06:04:00PM +0000, Serge Hallyn wrote:
> > > > > Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
> > > > 
> > > > So one concern here is that SBINDIR may be pretty much anything and may
> > > > look pretty awkward in the container, can we have the bind-mount be done
> > > > with say /lxc.init.static instead and only be done in the last resort
> > > > case where an existing init couldn't be found?
> > > 
> > > Sure, that sounds good.
> > 
> > Your new patch does put it in /lxc.init.static but still appears to do
> > it in all cases (even if it ends up unused). I'd really prefer we only
> > do the bind-mount if we can't detect a suitable init in the rootfs and
> > also remove the bind-mounted file from the rootfs on exit (at least in
> > the non-error path).
> > 
> > I'd really like us to make sure that when you use lxc, either for a full
> > fledged container or just for an application container that the rootfs
> > is restored to the way it was when the container exits. That means
> > removing the bind-mount target in this case, restoring the original
> > tty/console nodes, ...
> 
> Ok - that should be a pretty simple matter of splitting most of
> choose_init() into a separate detect_init() which is re-used before
> we create the lxc.init.static bind mount.  I won't get to that today
> so if anyone wants to feel free.

Ok I lied.  Here is a patch doing that.

However, during testing I found that I guess I'd been test-building without
cgmanager before.  When compiling with libcgmanager, configure is
putting -lcgmanager into the global LIBS, and trying to statically link
init.lxc.static against cgmanager.  But currently libcgmanager-dev
does not ship libcgmanager.a.  We could call this a reason for
libcgmanager-dev to do so, but lxc.init.static really shouldn't need
to be linked against cgmanager, so I'd far prefer to sort out the
Makefile.am magic needed to not include -lcgmanager in the
init.lxc.static build.


More information about the lxc-devel mailing list