Bug 438596 - .profile not being sourced
Summary: .profile not being sourced
Status: RESOLVED NOT A BUG
Alias: None
Product: plasmashell
Classification: Plasma
Component: Startup process (show other bugs)
Version: 5.23.0
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-14 06:59 UTC by krzmbrzl
Modified: 2023-04-10 03:19 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description krzmbrzl 2021-06-14 06:59:59 UTC
SUMMARY
The ~/.profile file does not get sourced anymore (for Konsole). It seems that only .bashrc is being sourced.

In the past however Konsole must have loaded .profile (or the system did beforehand) as the PATH variable I modified in there did contain the respective entries. This has probably started about 2-3 months ago.

STEPS TO REPRODUCE
1. Create .profile
2. Restart system
3. Open Konsole

OBSERVED RESULT
changes from .profile have no effect

EXPECTED RESULT
They should have an effect

SOFTWARE/OS VERSIONS
Operating System: KDE neon 5.22
KDE Plasma Version: 5.22.0
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.3
Kernel Version: 5.4.0-59-generic (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-4770 CPU @ 3.40GHz
Memory: 15,6 GiB of RAM
Graphics Processor: GeForce GTX 660 Ti/PCIe/SSE2

ADDITIONAL INFORMATION
Comment 1 Ahmad Samir 2021-06-14 10:04:29 UTC
This is a shell configuration issue; nothing to do with Konsole.

I'd look at the contents of .bashrc and .bash_profile and/or .profile or whatever your distro uses, and compare with the contents of their counterparts in /etc/skel/.
Comment 2 krzmbrzl 2021-06-14 10:14:32 UTC
Okay but something in KDE (Neon) did change because it used to work and I have not made any changes to .profile nor to .bashrc

In any case though I have followed the steps outlined in https://superuser.com/questions/176404/bash-not-loading-profile-in-new-session-on-linux and moved everything into .bashrc and let .profile only source .bashrc
Comment 3 Chris Caudle 2022-04-13 00:25:17 UTC
Seems unlikely this is a shell configuration issue.  My .bash_profile is sourced in Konsole in Plasma/X11, in non-graphical tty, in bash through SSH.  Only in Konsole running in Plasma/Wayland is .bash_profile not sourced.  I believe this was incorrectly marked as not a bug.
Comment 4 argonel 2022-04-13 02:16:11 UTC
(In reply to Chris Caudle from comment #3)
> Seems unlikely this is a shell configuration issue.  My .bash_profile is
> sourced in Konsole in Plasma/X11, in non-graphical tty, in bash through SSH.
> Only in Konsole running in Plasma/Wayland is .bash_profile not sourced.  I
> believe this was incorrectly marked as not a bug.

The non-graphical and SSH would be login sessions, and bash would therefore source .bash_profile. (https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Bash-Startup-Files)

Given that it works in X11 but not in Wayland, perhaps you have a .xsession file that sources .profile or .bash_profile. (https://wiki.debian.org/Xsession).
Comment 5 Ahmad Samir 2022-04-13 12:02:39 UTC
And this isn't about Konsole, as argonel said, an interactive shell, which is what is executed when you open a Konsole window/tab, doesn't source .bash_profile, only .bashrc. (You can confirm by trying other terminal emulators, gnome-terminal, xterm ...etc).

.bash_profile is supposed to be sourced by login shells, so it's supposed to be sourced when you login, if that works for X11, but not Wayland, then it's an issue in Plasmashell somewhere. Tentatively reassigning to Plasma.
Comment 6 Ahmad Samir 2022-04-13 12:46:48 UTC
I've had a chat with Fabian, and it looks like sddm sources .profile ...etc; for X11 /usr/share/sddm/scripts/Xsession for wayland /usr/share/sddm/scripts/wayland-session, this the default, but distros can override which scripts are sourced by sddm.
Comment 7 Chris Caudle 2022-04-13 13:33:44 UTC
> Given that it works in X11 but not in Wayland, perhaps you have a .xsession
> file that sources .profile or .bash_profile.
> (https://wiki.debian.org/Xsession).

Does not seem to be .xsession initiated:
$ ls -a .Xsession
ls: cannot access '.Xsession': No such file or directory
$ ls -a .xsession
ls: cannot access '.xsession': No such file or directory
$ ls -a | grep session
.pipewire-media-session
$ find ./ -iname .xsession
$

(In reply to argonel from comment #4)
> The non-graphical and SSH would be login sessions, and bash would therefore
> source .bash_profile.

So terminal emulators would be classified as interactive, non-login shells? 
Makes sense from the terminology.  Just kind of odd, or I should say unexpected change in behavior.
I checked using a Gnome session, and these terminals also source .bash_profile:
gnome terminal on X11
gnome terminal on Wayland
xterm on X11
xterm on Wayland
(xterm-resize-371-1.fc35.x86_64, xterm-371-1.fc35.x86_64, gnome-terminal-3.42.2-1.fc35.x86_64)

I will read the bash documentation more carefully, perhaps every other terminal has non-standard behavior that has been baked in for 20+ years, so no one wants to change them at this point.