On 2026-03-22 04:11:52 +0100, Vincent Lefevre wrote:
> LD_PRELOAD is not set with Fvwm 2 / Fvwm 3 / Sawfish / Twm: in
> a terminal, "env | grep LD_PRELOAD" does not output anything.

The purpose of /usr/lib/environment.d is not clear.
The environment.d(5) man page says in "DESCRIPTION":

  Configuration files in the environment.d/ directories contain lists
  of environment variable assignments passed to services started by
  the systemd user instance.

And in "APPLICABILITY":

  Environment variables exported by the user service manager (systemd
  --user instance started in the [email protected] system service) are
  passed to any services started by that service manager. In particular,
  this may include services which run user shells. For example in the
  GNOME environment, the graphical terminal emulator runs as the
  gnome-terminal-server.service user unit, which in turn runs the user
  shell, so that shell will inherit environment variables exported by the
  user manager. For other instances of the shell, not launched by the user
  service manager, the environment they inherit is defined by the program
  that starts them. Hint: in general, systemd.service(5) units contain
  programs launched by systemd, and systemd.scope(5) units contain
  programs launched by something else.

So, in short, /usr/lib/environment.d is not guaranteed to be taken
into account. In particular, in the case of FVWM, it is not the
systemd user instance that starts applications.

Later:

  Specifically, for ssh logins, the sshd(8) service builds an environment
  that is a combination of variables forwarded from the remote system and
  defined by sshd, see the discussion in ssh(1). A graphical display
  session will have an analogous mechanism to define the environment. Note
  that some managers query the systemd user instance for the exported
  environment and inject this configuration into programs they start,
  using `systemctl show-environment` or the underlying D-Bus call.

So, again this is not guaranteed to be taken into account.

BTW, on my machine, "systemctl show-environment" just gives

LANG=C.UTF-8
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin

So the

LD_PRELOAD=libgtk-nocsd.so.0${LD_PRELOAD:+:$LD_PRELOAD}

setting in /usr/lib/environment.d/50-gtk-nocsd.conf is not taken into
account.

/etc/environment remains more general (it is mentioned in various files
under /etc/pam.d, but the other directories from the environment.d(5)
man page aren't).

-- 
Vincent Lefèvre <[email protected]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)

Reply via email to