<varlistentry>
<term>
<command>import-environment</command>
- <optional><replaceable>VARIABLE…</replaceable></optional>
+ <replaceable>VARIABLE…</replaceable>
</term>
<listitem>
arguments are passed, the entire environment block inherited by the <command>systemctl</command>
process is imported. In this mode, any inherited invalid environment variables are quietly
ignored.</para>
+
+ <para>Importing of the full inherited environment block (calling this command without any
+ arguments) is deprecated. A shell will set dozens of variables which only make sense locally and
+ are only meant for processes which are descendants of the shell. Such variables in the global
+ environment block are confusing to other processes.</para>
</listitem>
</varlistentry>
</variablelist>
configuration, with just a few environment variables. The user manager inherits environment variables as
any other system service, but in addition may receive additional environment variables from PAM, and,
typically, additional imported variables when the user starts a graphical session. It is recommended to
- keep the environment blocks in both the system and user managers managers lean.</para>
+ keep the environment blocks in both the system and user managers managers lean. Importing all variables
+ inherited by the graphical session or by one of the user shells is strongly discouraged.</para>
<para>Hint: <command>systemd-run -P env</command> and <command>systemd-run --user -P env</command> print
the effective system and user service environment blocks.</para>
return bus_log_create_error(r);
if (argc < 2) {
- _cleanup_strv_free_ char **copy = NULL;
+ log_warning("Calling import-environment without a list of variable names is deprecated.");
- copy = strv_copy(environ);
+ _cleanup_strv_free_ char **copy = strv_copy(environ);
if (!copy)
return log_oom();
" show-environment Dump environment\n"
" set-environment VARIABLE=VALUE... Set one or more environment variables\n"
" unset-environment VARIABLE... Unset one or more environment variables\n"
- " import-environment [VARIABLE...] Import all or some environment variables\n"
+ " import-environment VARIABLE... Import all or some environment variables\n"
"\n%3$sManager State Commands:%4$s\n"
" daemon-reload Reload systemd manager configuration\n"
" daemon-reexec Reexecute systemd manager\n"