[Lxc-users] lxc-start leaks environment variables
Ivan Vilata i Balaguer
ivan at selidor.net
Fri Mar 8 15:30:06 UTC 2013
Stéphane Graber (2013-03-08 16:07:20 +0100) wrote:
> On 03/08/2013 04:34 AM, Ivan Vilata i Balaguer wrote:
>>
>> 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.
>
> 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
I checked that and it shows exactly that. I'm accessing the container
on its lxc-start console, so I'm not using SSH. Nevertheless, I
recreated the container and it's no longer happening, so most probably I
messed things up while struggling with locale autoconfiguration via
preseeding and I was simply too tired to notice. :)
Sorry for the noise, and thanks for the hints!
--
Ivan Vilata i Balaguer -- https://elvil.net/
More information about the lxc-users
mailing list