[systemd-devel] systemd-nspawn --setenv=SOMETHING=other: What is that for?

Lennart Poettering lennart at poettering.net
Mon Oct 26 05:58:29 PDT 2015


On Mon, 26.10.15 12:42, Tobias Hunger (tobias.hunger at gmail.com) wrote:

> Hi Lennart,
> 
> the ContainerInterface says: "The container manager should set
> $container_uuid= as environment variable for the container's PID 1 to
> the container UUID it wants to set."
> 
> I had expected that to be implemented by not resetting this
> environment variable when starting whichever service file is running
> systemd-machine-id-setup.

It's PID1 itself that initializes /etc/machine-id actually, since we
want to give the guarantee that the ID is available all the time
during runtime. The env var is only passed to PID 1 and PID 1 then
strips it away from child processes, since the right way to get the
machine ID is to query /etc/machine-id, not the env var...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list