#1037084 bookworm: When using gdm3 to start non-GNOME wayland sessions, PATH may be set differently #1037084
- Package:
- release-notes
- Source:
- release-notes
- Submitter:
- Jay
- Date:
- 2025-02-12 00:45:03 UTC
- Severity:
- normal
Starting non-GNOME wayland sessions through GDM leads to a user's PATH being set to /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin instead of /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games (from /etc/profile). Example: Starting sway or plasma-workspace-wayland through gdm and trying to launch lutris or gnome-chess only to find out that they won't start even though they are installed. It can take some time for a user to find out that the PATH environment variable is different. This is a regression in bookworm and can surprise users upgrading from bullseye. Possible workarounds are: Using a different display manager such as sddm or starting the wayland session through tty. I first discovered this bug after installing lutris a few months ago[0] and filed a few bug reports[1][2]. As bookworm is about to be released, I thought it may be worthwhile to document this unexpected behavior in its release notes. 0: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1028543 1: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=942131 2: https://gitlab.gnome.org/GNOME/gdm/-/issues/846
GDM imports system user environment variables. This bug would likely be fixed by Debian (the systemd package?) shipping a /usr/lib/systemd/user-environment-generators/ systemd user environment generator with the default PATH Debian already set in /etc/profile. gnome-session importing /etc/profile is a temporary hack, so even for a plain Gnome session this will not work forever without this fix. Or ship an /usr/lib/environment.d/*.conf file (which itself is read by a systemd user environment generator : /usr/lib/systemd/user- environment-generators/30-systemd-environment-d-generator). Cheers, Alban PATH from bullseye. thought it may notes.
I plan to check with the Debian systemd package maintainers about this option. But This might be the solution we're looking for. A /usr/lib/environment.d/??-gdm3.conf file provided by the gdm3 package?
On Mon, 29 Apr 2024 13:09:27 -0700 Jay <santosjaycee.0@gmail.com> wrote: <alban.browaeys@gmail.com> wrote: user this option. read by No, in that it should not be named after gdm. It is a bit far, but to me your issue is due to gdm3 not overwriting the systemd user environment with its own PATH value anymore. This means that you got things back working by reverting https://gitlab.gnome.org/GNOME/gdm/-/commit/ccecd9c975d04da80db4cd547b67a1a94fa83292 because you made gdm3 overwrite the system user session environment PATH value as it was doing before. So the issue is that the systemd user enviroment is not set properly for Debian specific PATH components (and that gdm3 does not overwrite this systemd user session PATH value anymore if one is set, thus the gdm3 fallback PATH mention in the patch. That is if no PATH value is defined in the environment, then the old behavior of gdm setting it is preserved, but if one is defined, then it is not changed). Thus if you get the wrong PATH value it is not because gdm set it to the wrong value, but because it stopped overweriting the bad value (in that Debian requires a specific value that is not hte default and as no Debian specific config has been provided, the default is wrong). So the issue is, to me, Debian systemd specific and only involves gdm because it has stopped overwriting the systemd default value (which is wrong on Debian because Debian has specific path). The Debian specific defaults are shown in /etc/profile if [ "$(id -u)" -eq 0 ]; then PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" else PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games" fi export PATH Debian systemd package just need to ship a config file to set this PATH value. So a /usr/lib/environment.d/??-debian.conf file shipped by the Debian systemd package is what I deem the correct fix. This bug report should be reassigned to systemd in my opinion. So you were right that reverting commit ccecd9c9 would fix your issue, but not because gdm added a bug but because it stopped hiding an underlying "bug" (well wrong default PATH value in systemd for Debian). It could be that systemd maintainers thing this is gdm job to overwrite their value, though it looks more correct to me to bug them first as they are the one setting the wrong default for Debian (or so I believe, I have not checked extensively if the wrong PATH default value could be fine at the systemd level and be changed afterwards). Cheers, Alban
Thanks again! I finally found some time to further investigate this.
I have reassigned this bug report to the systemd package,
but it looks like base-files and libpam-modules are the packages
involved.
My Debian system was installed in 2022-10. To be sure this wasn't
just a misconfigured system in 2022, I checked again with a fresh
Debian 12.5 install and found that the same defaults are present.
Reading that made me check Ubuntu's defaults:
/etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
/etc/profile
(no mention of PATH)
It looks like Ubuntu sets PATH in /etc/environment through libpam-modules
and /usr/lib/environment.d/99-environment.conf is symlinked to it.
Debian sets PATH in /etc/profile through base-files and its
/usr/lib/environment.d/99-environment.conf
is symlinked to an empty /etc/environment also created by libpam-modules.
Ubuntu's libpam-modules runs a postinst script:
# Add PATH to /etc/environment if it's not present there or in
# /etc/security/pam_env.conf
if [ "$1" = "configure" ] && dpkg --compare-versions "$2" lt
1.3.1-5ubuntu5; then
if ! grep -qs ^PATH "$DPKG_ROOT"/etc/security/pam_env.conf; then
if ! grep -qs ^PATH= "$DPKG_ROOT"/etc/environment; then
echo
'PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"'
fi
fi
fi
Debian's libpam-modules postinst:
if dpkg --compare-versions "$2" lt 0.99.9.0-1 && ! [ -f
"$DPKG_ROOT"/etc/environment ]
then
touch "$DPKG_ROOT"/etc/environment
fi
I think we can narrow this down to base-files and/or libpam-modules.
I'm not sure if doing the same thing as the Ubuntu package would be
the right thing
so I'm CC'ing the maintainers for both packages and the debian-desktop
mailing list
for advice instead of reassigning the bug report again.
Hello. My plan for base-files is to stop overriding the PATH in /etc/profile. Ubuntu did that a long time ago and it's probably the right thing to do. I'd like to do this for trixie, but only after the t64 transition is finished and the usr-merge patch from Helmut Grohne is implemented. Also, I want to be sure that nothing breaks, and if it does, I want to be sure that I'm not forced to set the PATH again. See what happened the last time I tried :-) https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=571086 Thanks.
Note that /etc/profile is a configuration file for bourne shells. While it's a common path, it's not especially for other shells (I think zsh still uses it but not all I think) and not graphical sessions. Regards,
Santiago> Hello. My plan for base-files is to stop overriding the
Santiago> PATH in /etc/profile.
Santiago> Ubuntu did that a long time ago and it's probably the
Santiago> right thing to do.
I'd be happy to pick up the Ubuntu patch to include PATH in
/etc/environment for libpam-modules.
It would probably be best to leave /etc/profile as it is. I expected
my wayland desktop session to have
its PATH match the /etc/profile PATH for non-root shells, so I guess
libpam-modules is the package I was
looking for.
I have been testing the following changes locally. It is a variation
based on Ubuntu's libpam-modules.postinst.
*** Debian_salsa/pam/debian/libpam-modules.postinst 2025-02-11
10:13:55.525742196 -0800
--- Debian_salsa_modified/pam/debian/libpam-modules.postinst
2025-02-11 10:29:26.369651525 -0800
***************
*** 16,19 ****
--- 16,29 ----
touch "$DPKG_ROOT"/etc/environment
fi
+ # Add PATH to /etc/environment if it's not present there or in
+ # /etc/security/pam_env.conf
+ if [ "$1" = "configure" ] && dpkg --compare-versions "$2" lt 1.7.0-4; then
+ if ! grep -qs ^PATH "$DPKG_ROOT"/etc/security/pam_env.conf; then
+ if ! grep -qs ^PATH= "$DPKG_ROOT"/etc/environment; then
+ echo
'PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"' >>
"$DPKG_ROOT"/etc/environment
+ fi
+ fi
+ fi
+
#DEBHELPER#