Environment Connectz

F45 Change Proposal: Use Systemd For Managing Per User Environment Variables [SelfContained]

Share:

Use Systemd For Managing Per User Environment Variables

Wiki

Announced

This is a proposed Change for Fedora Linux.
This document represents a proposed Change. As part of the Changes process, proposals are publicly announced in order to receive community feedback. This proposal will only be implemented if approved by the Fedora Engineering Steering Committee.

Summary :open_book:

Rely on systemd’s systemd.environment-generator functionality for managing per-user environment variables (such as appending ~/local/.bin and ~/bin to an user’s $PATH) instead of individual shellrc scripts (~/.bashrc, ~/.zshrc etc).

Owner :open_book:

Detailed Description :open_book:

Currently, Fedora relies on shellrc scripts (~/.bashrc, ~/.zshrc files) for modifying an user’s environment variables.

An example of such a case is appending ~/.local/bin and ~/bin directories to $PATH

Such shellrc scripts have only been packaged for the bash and zsh shells. (rpm -ql /etc/skel/{.bashrc,.zshrc} returns packages bash and zsh)

However, Fedora Linux also offers several alternative shells such as fish, nushell (nu), xonsh, dash etc, for which shellrc scripts have not been packaged.

This leads to a situation where an user might change their login shell and be unable to directly launch scripts and programs stored in ~/.local/bin and ~/bin

systemd provides a mechanism for applying environment variables to all user processes via systemd.environment-generator.

Creating simple drop-in file(s) in the /etc/skel/.config/environment.d/ directory is a simpler and much cleaner way for both managing environment variables for an user and for mitigating the $PATH environment variable propagation issue for alternative shells.

Although out of scope for this specific proposal, the broader goal will be to ultimately move as much cruft possible out of shellrc scripts scattered across the filesystem at different places and /etc/profile into environment-generators

Feedback :open_book:

Will be updated later.

Benefit to Fedora :open_book:

This change simplifies per-user environment variable propagation and makes environment variable changes independant of an user’s default shell.

Scope :open_book:

  • Proposal owners:
    Modify the /etc/skel/.*rc files located in the bash and zsh packages, modifying them to either remove any environment variable modification parts or splitting those parts into separate subpackages.

Search for any other packages that also modify environemt variables by shellrc scripts.

  • Other developers:
    Coordinate with the respective package maintainers.
  • Release engineering: [Making sure you’re not a bot! #Releng issue number]
    Most likely no.
  • Policies and guidelines: N/A (not needed for this Change)
  • Trademark approval: N/A (not needed for this Change)
  • Alignment with the Fedora Strategy:

Upgrade/compatibility impact :open_book:

None.

Early Testing (Optional) :open_book:

Do you require ‘QA Blueprint’ support? N

How To Test :open_book:

Will be added later.

User Experience :open_book:

Cleaner shellrc files will ease management for users.

Dependencies :open_book:

Will be updated later.

Contingency Plan :open_book:

  • Contingency mechanism: (What to do? Who will do it?)
    Revert the change. (not a System Wide Change)
  • Contingency deadline: Beta freeze (not a System Wide Change)
  • Blocks release? N/A (not a System Wide Change), Yes/No

Documentation :open_book:

N/A (not a System Wide Change)

Release Notes :open_book:

\nMoved per-user environment variable handling to systemd.environment-generator\n

Last edited by @alking 2026-03-10T16:54:13Z

Last edited by @alking 2026-03-10T16:54:13Z

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *