Tuesday, March 10, 2026

F45 Change Proposal: UseSystemdForManagingPerUserEnvironmentVariables [SelfContained]

Wiki: https://fedoraproject.org/wiki/Changes/UseSystemdForManagingPerUserEnvironmentVariables

Discussion Thread: https://discussion.fedoraproject.org/t/182885

**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 ==

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 ==

* Name: [[User:Faeizmahrus| Faeiz Mahrus]]
* Email: faeizmahrus@proton.me, me@faeizmahrus.bd

== Detailed Description ==

Currently, Fedora relies on shellrc scripts (`~/.bashrc`, `~/.zshrc` files) for modifying an user's environment variables. <br/>

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

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

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

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`. <br/>

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. <br/>

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 ==

Will be updated later.

== Benefit to Fedora ==

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

== Scope ==

* 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: [https://forge.fedoraproject.org/releng/tickets/issues #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 ==

None.

== Early Testing (Optional) ==

Do you require 'QA Blueprint' support? N

== How To Test ==

Will be added later.

== User Experience ==

Cleaner shellrc files will ease management for users.

== Dependencies ==

Will be updated later.

== Contingency Plan ==

* 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 ==

N/A (not a System Wide Change)

== Release Notes ==

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

No comments:

Post a Comment