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

Colin Guthrie colin at mageia.org
Fri Jul 26 03:35:39 PDT 2013


'Twas brillig, and Kay Sievers at 26/07/13 11:03 did gyre and gimble:
> On Fri, Jul 26, 2013 at 11:57 AM, Kay Sievers <kay at vrfy.org> wrote:
>> On Fri, Jul 26, 2013 at 11:21 AM, Colin Guthrie <colin at mageia.org> wrote:
>>> This question was asked by a user trying to debug a problem with Java services
>>> which required JAVA_HOME to be set.
>>> ---
>>>  man/systemd.exec.xml | 7 +++++++
>>>  1 file changed, 7 insertions(+)
>>>
>>> diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml
>>> index c0e1d86..b78f255 100644
>>> --- a/man/systemd.exec.xml
>>> +++ b/man/systemd.exec.xml
>>> @@ -77,6 +77,13 @@
>>>                  configuration options are configured in the [Service],
>>>                  [Socket], [Mount], or [Swap] sections, depending on the unit
>>>                  type.</para>
>>> +
>>> +                <para>All processes are executed in a clean environment in
>>> +                which only the TERM, PATH, USER, and HOME variables are set
>>> +                by default.
>>
>> They are just preserved, passed-along, not exported or set by default, isn't it?
> 
> Seems for the system services, only PATH= and the locale are usually set:
> 
> $ sudo cat /proc/$(pidof systemd-logind)/environ
> PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/binLANG=en_US.UTF-8LC_TIME=de_DE.UTF-8LC_PAPER=de_DE.UTF-8LC_MEASUREMENT=de_DE.UTF-8

Hmm, I was naively looking at the launch() code in
src/activate/activate.c but seems my grepping skills lack the fu required :)

So I guess it's exec_spawn() which sets up the final env which combines
a calling env + stuff from the unit (Environment= etc) + pam + files.

I can't quite grok which ones are there by default... I guess maybe just
the PATH and local stuff as you suggest?

Any further input on this or should I respin with this info?

Col


-- 

Colin Guthrie
colin(at)mageia.org
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/


More information about the systemd-devel mailing list