[Lxc-users] lxc-start leaks environment variables

Stéphane Graber stgraber at ubuntu.com
Fri Mar 8 15:07:20 UTC 2013


On 03/08/2013 04:34 AM, Ivan Vilata i Balaguer wrote:
> Hi all,
> 
> I'm running lxc 0.9.0~alpha3-1 on a Debian sid box and I created a
> container using lxc-debconf which doesn't set any default locale.  When
> starting the container using lxc-start, I expected it to have no LANG
> variable defined, but I noticed that it had inherited that from my root
> session in the host.  Of course this causes several warnings in
> different programs, but I'm more concerned about the leaking of
> environment variables itself.  Is this a known or expected behaviour, or
> rather a bug?  Maybe other variables are leaking too.
> 
> Thanks,

That seems pretty unlikely considering we explicitly clearenv() before
starting the container now.

What you're describing can be true for LXC before the 0.9 series, but
with 0.9, the container starts with an empty environment, so any
environment variable that's set is as a result of the boot process.

Speaking of the locale environment variables specifically, it might be
worth noting that ssh sets those when you connect to a system over ssh.

To make sure, you may want to look at:
cat /proc/1/environ | tr '\0' '\n'

Which will show you the environment of PID 1 in the container.

Typically, it's made of a single variable:
root at raring-dev:~# cat /proc/1/environ | tr '\0' '\n'
container=lxc


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20130308/15dd62bc/attachment.pgp>


More information about the lxc-users mailing list