1ENVIRONMENT.D(5) environment.d ENVIRONMENT.D(5)
2
3
4
6 environment.d - Definition of user session environment
7
9 ~/.config/environment.d/*.conf
10
11 /etc/environment.d/*.conf
12
13 /run/environment.d/*.conf
14
15 /usr/lib/environment.d/*.conf
16
17 /etc/environment
18
20 The environment.d directories contain a list of "global" environment
21 variable assignments for the user environment. systemd-environment-d-
22 generator(8) parses them and updates the environment exported by the
23 systemd user instance to the services it starts.
24
25 It is recommended to use numerical prefixes for file names to simplify
26 ordering.
27
28 For backwards compatibility, a symlink to /etc/environment is
29 installed, so this file is also parsed.
30
32 Configuration files are read from directories in /etc/, /run/, and
33 /usr/lib/, in order of precedence. Each configuration file in these
34 configuration directories shall be named in the style of filename.conf.
35 Files in /etc/ override files with the same name in /run/ and
36 /usr/lib/. Files in /run/ override files with the same name in
37 /usr/lib/.
38
39 Packages should install their configuration files in /usr/lib/. Files
40 in /etc/ are reserved for the local administrator, who may use this
41 logic to override the configuration files installed by vendor packages.
42 All configuration files are sorted by their filename in lexicographic
43 order, regardless of which of the directories they reside in. If
44 multiple files specify the same option, the entry in the file with the
45 lexicographically latest name will take precedence. It is recommended
46 to prefix all filenames with a two-digit number and a dash, to simplify
47 the ordering of the files.
48
49 If the administrator wants to disable a configuration file supplied by
50 the vendor, the recommended way is to place a symlink to /dev/null in
51 the configuration directory in /etc/, with the same filename as the
52 vendor configuration file. If the vendor configuration file is included
53 in the initrd image, the image has to be regenerated.
54
56 The configuration files contain a list of "KEY=VALUE" environment
57 variable assignments, separated by newlines. The right hand side of
58 these assignments may reference previously defined environment
59 variables, using the "${OTHER_KEY}" and "$OTHER_KEY" format. It is also
60 possible to use "${FOO:-DEFAULT_VALUE}" to expand in the same way as
61 "${FOO}" unless the expansion would be empty, in which case it expands
62 to DEFAULT_VALUE, and use "${FOO:+ALTERNATE_VALUE}" to expand to
63 ALTERNATE_VALUE as long as "${FOO}" would have expanded to a non-empty
64 value. No other elements of shell syntax are supported.
65
66 Each KEY must be a valid variable name. Empty lines and lines beginning
67 with the comment character "#" are ignored.
68
69 Example
70 Example 1. Setup environment to allow access to a program installed in
71 /opt/foo
72
73 /etc/environment.d/60-foo.conf:
74
75 FOO_DEBUG=force-software-gl,log-verbose
76 PATH=/opt/foo/bin:$PATH
77 LD_LIBRARY_PATH=/opt/foo/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
78 XDG_DATA_DIRS=/opt/foo/share:${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}
79
80
82 systemd(1), systemd-environment-d-generator(8), systemd.environment-
83 generator(7)
84
85
86
87systemd 239 ENVIRONMENT.D(5)