[systemd-devel] [PATCH] man: Add a note about what environment variables are available by default.

Kay Sievers kay at vrfy.org
Fri Jul 26 10:00:59 PDT 2013

On Fri, Jul 26, 2013 at 12:42 PM, Kay Sievers <kay at vrfy.org> wrote:

>> cat /proc/$(pidof systemd-logind)/environ
>> SYSFONT=latarcyrheb-sun16PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/binbiosdevname=0LANG=de_DE.UTF-8divider=20KEYTABLE=de-latin1-nodeadkeysBOOT_IMAGE=/vmlinuz-3.9.10-100.fc17.x86_64
> What's currently done for environment variables and the rules how they
> are passed-on is not obvious and quite a mess that needs fixing. I'll
> look into it now ...

This made a couple of things less magic:

For --system we export the following to the forked children:
 - do not pass _any_ of the original env
 - always statically set: PATH= to the usual suspects
 - add the stuff from DefaultEnvironment=
 - add the stuff from the kernel cmdline systemd.setenv=

For --user we inherit _everything_ from the parent and pass everything
to the children.

In both cases:
 - if we have a user UID, we add LOGNAME=, USER=, HOME=
 - if we have a terminal connected we add TERM=


More information about the systemd-devel mailing list