regolith-desktop icon indicating copy to clipboard operation
regolith-desktop copied to clipboard

$PATH from .profile not available in X11 session since 3.2-beta4 on Ubuntu 22.04

Open peterrus opened this issue 1 year ago • 5 comments

Describe the bug This might be a complex one: $PATH changes made in .profile are not reflected in either i3 or sway sessions when running 3.2-beta4 on Ubuntu 22.04.

Ubuntu ships by default with a ~/.profile that adds ~/.local/bin to your path when that directory exists. By putting a log statement in .profile I can verify that the file is indeed sourced at session startup but once I've opened a terminal (default Gnome terminal with bash) the $PATH variable does not contain ~/.local/bin even though systemctl --user show-environment | egrep ^PATH= does show it (not sure if that is relevant, but something I noticed).

I have done extensive testing on clean Ubuntu installs (test results below) to verify that this problem only occurs on Ubuntu 22.04 + Regolith 3.2-beta4 (I have not tested earlier beta's for this release).

  • All installs of Ubuntu are minimal installs through the graphical installer and then fully apt-updated.
  • All installs of Regolith are done as described here: https://regolith-desktop.com/docs/using-regolith/install/ with the following package set: regolith-desktop regolith-session-flashback regolith-look-lascaille regolith-session-sway.
has issue?
22.04+3.1 no
22.04+3.2-beta4 yes
24.04+3.2-beta4 no

To Reproduce

  • Do clean minimal install of Ubuntu 22.04 through graphical install
  • Login using Gnome
  • mkdir -p ~/.local/bin && echo "working" > ~/.local/bin/testscript && chmod +x ~/.local/bin/testscript
  • Install Regolith as described above using this repo.
  • Reboot
  • Start Regolith X11 session
  • attempt to run testscript in terminal (it is not found).

Expected behavior

  • Whatever gets sourced in ~/.profile should be present in the graphical session (X11, but preferably also Sway/wayland as the Ubuntu Gnome Wayland session also works as expected). This worked fine on Regolith 3.1.

Configuration file(s) Clean install of regolith on a clean fully updated minimal install of Ubuntu 22.04 so no custom configuration.

Installation Details

  • Regolith Install Type: [PPA]
  • Regolith Version: [e.g. 3.2-beta4]
  • PPA url: As described here: https://regolith-desktop.com/docs/reference/Releases/regolith-3.2-release-notes/
  • Host OS (for PPA): [e.g. Ubuntu 22.04]

Additional context I have seen https://github.com/regolith-linux/regolith-desktop/issues/958 but I am also seeing the behavior described above on the X11 session.

peterrus avatar Aug 15 '24 23:08 peterrus

@peterrus , thank you for providing the very detailed bug report.

Whatever gets sourced in ~/.profile should be present in the graphical session (X11, but preferably also Sway/wayland as the Ubuntu Gnome Wayland session also works as expected). This worked fine on Regolith 3.1.

I'm puzzled as to what might be creating this specific behavior on jammy alone. The package responsible for starting a Regolith session (regolith-session) runs the same code on both Jammy and Noble. I am running Regolith 3.2 beta 4 on Debian testing and see elements in my path that seem to have been set by my ~/.profile file.

There is some code in the sway init that does some env variable handling, but the X11 version does not do anything about this. Unclear based on your testing notes where the rootcause may be. I am unaware of anything in Regolith that handles ~/.profile directly.

kgilmer avatar Aug 18 '24 23:08 kgilmer

Interesting, thanks for your reply! Since I switched to 24.04 this is no longer a problem for me but maybe interesting to keep this issue as documentation for other users that run into this problem.

By the way, I think this isn't a .profile-related thing perse, since that always gets sourced. But something related to setting the $PATH for a session. But that's all I have at the moment ;)

peterrus avatar Aug 19 '24 09:08 peterrus

I'm seeing similar behavior, also on Regolith 3.2 on jammy. It's really odd.

After logging in, I start a terminal. I can see all the environment variables set by my .profile script except for PATH which has been reset to a default value.

If I open a new tab in the same gnome terminal, suddenly PATH is set correctly in this second terminal tab. Even more weirdly, I've verified that the .profile script is not executed upon opening the second tab, so somehow it's just inheriting a different set of environment variables.

chrisgavin avatar Oct 22 '24 10:10 chrisgavin

Looking a bit further, I think I've managed to "fix" it. The solution was to delete /etc/environment, which is apparently being loaded after my user profile somewhere and resetting the path.

Possibly there are side effects to this and I will end up with many regrets later, but for now I am happy. :sweat_smile:

chrisgavin avatar Oct 22 '24 10:10 chrisgavin

@chrisgavin that workaround solved it for me as well. I guess for now I'm renaming /etc/environment and sourcing it in my .profile to make sure that it's still included, but not at my expense.

333fred avatar Jan 08 '25 02:01 333fred