[lxc-devel] [PATCH] Remove MAKEDEV call, add autodev hooks, add environment variables for hook scripts.

Serge Hallyn serge.hallyn at ubuntu.com
Tue Mar 12 20:55:52 UTC 2013


Quoting Ward, David - 0663 - MITLL (david.ward at ll.mit.edu):
> Michael, Serge,
> 
> On 01/09/2013 03:38 PM, Michael H. Warfield wrote:
> >4) clearenv and putenv( "container=lxc" ) calls were moved to just after
> >the "start" hook in the container just prior to actually firing up the
> >container so we could use environment variables prior to that and have
> >them flushed them before firing up init.  Nice side effect is that you
> >can define environment variables and then call lxc-start and have them
> >show up in those hooks scripts.
> 
> Since the call to clearenv() was moved to do_start(), it also gets
> called when running lxc-execute.  If I set up a very simple
> container with only utsname/network namespaces, and do:
> 
>    lxc-execute -n $CONTAINER -- bash
> 
> then the PATH and HOME environment variables are no longer
> propagated into new shell, for example.  (In Fedora at least, these
> environment variables are set in /etc/profile, which does not get
> sourced by /etc/bashrc or ~/.bashrc by default.)
> 
> Is this the desired behavior for lxc-execute now, or was it an
> unintended side-effect?  Also keep in mind that if I do:
> 
>    lxc-attach -n $CONTAINER -- bash
> 
> the environment variables are not cleared there before opening the
> shell (regardless of whether the container was started with
> lxc-start or lxc-execute)...this may need to be adjusted.

Hi,

good question.  I mean yes that was what we were thinking, but that
doesn't mean it's the right thing.  lxc-execute means "set up this
container with a dummy init and run this task in it."  I personally
think that should mean a clear environment as set up by a shell in
the container, but I don't use lxc-execute and my opinion shouldn't
mean much.

Others?

-serge




More information about the lxc-devel mailing list