How to set global environment variables as a Linux distribution? - /etc/environment.d

All packages shipped by Kicksecure / Whonix setting environment variables should deprecate their use of /etc/X11/Xsession.d and /etc/profile.d. Instead. the systemd DefaultEnvironment mechanism should be used.

This style:

Of course, split into different files and contained in the packages that require these.


/etc/X11/Xsession.d and /etc/profile.d mechanism:

  • Works in Debian (and Qubes Debian) in Xorg
  • Doesn’t work for virtual console with zsh.
  • Works with Wayland?
  • Works on non-systemd systems.
    • Related: ⚓ T998 Whonix without systemD (Rejected.)
    • Therefore not important since there are no ports / maintainers for non-systemd enabled systems anyway and also one on the horizon. Other init systems would need to support something similar to DefaultEnvironment.

systemd DefaultEnvironment mechanism:

  • Works in Debian (and Qubes Debian) in Xorg
  • Doesn’t work for virtual console with zsh.
  • Probably works with Wayland.
  • Only for systemd enabled Linux distributions.