[systemd-devel] How to set environment variable that is available for later services/shell

Sam Ravnborg sam at ravnborg.org
Sat Mar 11 17:14:17 UTC 2017

Hi all.

How can we set environment variables so they are available for everyone?


On an embedded target we use QT applications.

To start our QT application we need to set environment variables:


For now we use:

This has two drawbacks:
1) We cannot start the QT application from the
   command-line (unless we source the .conf file)
2) We need to use different .conf files (thus different
   .service files) depending on the HW configuration (display type/size)

So we are looking for a way to set the environment variables early
such that they are available in the services launced later,
and they are available in the shell.
The actual system configuration will determine the values and
it may differ from boot to boot.

Thanks in advance,


More information about the systemd-devel mailing list