[systemd-devel] Environment File Question

Boyce, Kevin P [US] (AS) Kevin.Boyce at ngc.com
Mon Dec 18 23:22:39 UTC 2017


Good Day List,

This may be a noob question but I'm trying to understand how systemd works with environment variables for system services in one place.  Reading various sites and systemd documentation only seems to be confusing me at this point.

When I set in /etc/systemd/system.conf DefaultEnvironment="VAR1=Test" 'VAR2=TEST 2', my service reads the variables correctly, but why are these not inherited by the user when they login?
Isn't systemd the parent of all processes and shouldn't that environment I specify be preserved?

Further, what if I need expansion of these variables like DefaultEnvironment="VAR1=$(readlink -f /path/to/symlink)" to work also which complicates things.  /etc/environment does not do this.

On RHEL7 we don't have the system-environment-generator available as it was released in systemd v.233 I think. RHEL has v219.

Thanks,
Kevin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20171218/2ece0939/attachment.html>


More information about the systemd-devel mailing list