systemd is a service in the background. I think it is started before the script in /etc/profile/ is called. You could try this: https://coreos.com/os/docs/latest/using-environment-variables-in-systemd-units.html and set it inside the systemd environment.