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/,
33 /usr/local/lib/, and /usr/lib/, in order of precedence. Each
34 configuration file in these configuration directories shall be named in
35 the style of filename.conf. Files in /etc/ override files with the same
36 name in /run/, /usr/local/lib/, and /usr/lib/. Files in /run/ override
37 files with the same name under /usr/.
38
39 Packages should install their configuration files in /usr/lib/
40 (distribution packages) or /usr/local/lib/ (local installs). Files in
41 /etc/ are reserved for the local administrator, who may use this logic
42 to override the configuration files installed by vendor packages. All
43 configuration files are sorted by their filename in lexicographic
44 order, regardless of which of the directories they reside in. If
45 multiple files specify the same option, the entry in the file with the
46 lexicographically latest name will take precedence. It is recommended
47 to prefix all filenames with a two-digit number and a dash, to simplify
48 the ordering of the files.
49
50 If the administrator wants to disable a configuration file supplied by
51 the vendor, the recommended way is to place a symlink to /dev/null in
52 the configuration directory in /etc/, with the same filename as the
53 vendor configuration file. If the vendor configuration file is included
54 in the initrd image, the image has to be regenerated.
55
57 The configuration files contain a list of "KEY=VALUE" environment
58 variable assignments, separated by newlines. The right hand side of
59 these assignments may reference previously defined environment
60 variables, using the "${OTHER_KEY}" and "$OTHER_KEY" format. It is also
61 possible to use "${FOO:-DEFAULT_VALUE}" to expand in the same way as
62 "${FOO}" unless the expansion would be empty, in which case it expands
63 to DEFAULT_VALUE, and use "${FOO:+ALTERNATE_VALUE}" to expand to
64 ALTERNATE_VALUE as long as "${FOO}" would have expanded to a non-empty
65 value. No other elements of shell syntax are supported.
66
67 Each KEY must be a valid variable name. Empty lines and lines beginning
68 with the comment character "#" are ignored.
69
70 Example
71 Example 1. Setup environment to allow access to a program installed in
72 /opt/foo
73
74 /etc/environment.d/60-foo.conf:
75
76 FOO_DEBUG=force-software-gl,log-verbose
77 PATH=/opt/foo/bin:$PATH
78 LD_LIBRARY_PATH=/opt/foo/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
79 XDG_DATA_DIRS=/opt/foo/share:${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}
80
81
83 systemd(1), systemd-environment-d-generator(8), systemd.environment-
84 generator(7)
85
86
87
88systemd 243 ENVIRONMENT.D(5)