Issue with different PATHs for root when on non-login vs login shells in LFS build
Hey guys :)
First let me start off by thanking the people behind the LFS project. What an amazing project. I've learned so much doing this. I've completed the LFS book and is basically done with the BLFS as well. I've been following the LFS v9 System V and am running GNOME. I have installed Firefox, Libreoffice, VLC, Transmission and a whole lot of other stuff. My build is nearly worthy of being a daily driver as far as my laptop goes. I have a few various small issues though. One of them is that the $PATH for my normal user and root are not the same with the path for my normal user being as it should, but root has a much smaller path variable, but only when using a non-login shell like Gterm. When I login to a TTY, like if I don't boot into the GUI, all the paths are correct. I understand this is due to all the various bash scripts, and there are a number of them. To me this seems slightly more complicated than it needs to me. To the best of my knowledge it seems like the scripts in /etc/profile.d are not executed for the root user when in GNOME and Gterm as it seems the missing paths are the ones found there. My /etc/profile: https://pastebin.com/7tJpsuDU My /etc/bashrc: https://pastebin.com/9FrX3hkn An example from /etc/profile.d/extrapaths.sh: https://pastebin.com/PMuFYVRv The /usr/local/sbin path found here is missing when running the non-login shell from GNOME. The ~/.bash_profile of root: https://pastebin.com/vV85FNWg The ~/.bashrc of root: https://pastebin.com/FZAChB7x The ~/.profile of root: https://pastebin.com/VrBRx8hn All the home directory scripts are identical for my normal user. Output of paths for normal user: Code:
bio@bioLinux [~]# echo $PATH Code:
root@bioLinux[ /home/bio]# echo $PATH |
I don't usually expect the PATHs of normal users and root to be the same. Yes, often a non-privileged user has a longer path.
Is this causing a problem for you? What is the problem? You can modify the root path to be what you want in root's .bash_profile or .bashrc. |
Quote:
Quote:
Quote:
Speaking about bash, you can see the man page (see section invocation) and you will see how are the different files are used (during start of the shell). Quote:
Quote:
|
Quote:
I've managed to resolve the issue for now though by copying this from /etc/profile into "~/.bashrc": Code:
for script in /etc/profile.d/*.sh ; do Quote:
EDIT: I've changed the title of my OP to better reflect the actual issue. |
It's a pity that graphical logins no longer behave like logins.
They do not run /etc/profile and .profile These should run once - at login. Some distros take care, e.g. by running /etc/profile from /etc/bash.bashrc If that's not the case in your distro then I suggest to run /etc/profile in your .bashrc The /etc/profile should run the /etc/profiles.d/ files. Code:
if [ -z "$MY_PROFILE_RUN" ] (Some distros have such a variable in /etc/profile ...) |
Quote:
|
Quote:
Quote:
|
All times are GMT -5. The time now is 01:08 AM. |