[SOLVED] Why does gnome-terminal ignore $HOME/bin ?

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
Hansl
Level 3
Level 3
Posts: 103
Joined: Fri Dec 09, 2011 3:50 pm

[SOLVED] Why does gnome-terminal ignore $HOME/bin ?

Post by Hansl » Thu Sep 27, 2018 7:56 am

Just did a fresh install of LMDE3 and found this:
In Cinnamon desktop, a freshly opened gnome-terminal does not have $HOME/bin in its path.
Which it should have according to ~/.profile, and did have in LMDE2.
While the virtual terminals (CtrlAlt-F1) do add my ~/bin to their path, a ssh shell also adds it.
(No, I don't have a ~/.bash_profile or ~/.bash_login.)

What is amiss, how should it be fixed?

For a workaround, I copied —

Code: Select all

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi 
from ~/.profile to my ~/.bashrc which works for now.
Last edited by Hansl on Fri Oct 05, 2018 7:01 am, edited 1 time in total.

gm10
Level 12
Level 12
Posts: 4154
Joined: Thu Jun 21, 2018 5:11 pm

Re: Why does gnome-terminal ignore $HOME/bin ?

Post by gm10 » Thu Sep 27, 2018 8:37 am

~/.profile, /etc/profile, etc. aren't sourced by default in LMDE3

Hansl
Level 3
Level 3
Posts: 103
Joined: Fri Dec 09, 2011 3:50 pm

Re: Why does gnome-terminal ignore $HOME/bin ?

Post by Hansl » Thu Sep 27, 2018 9:02 am

Hmm… that's a bit surprising.  And the virtual terminals / ssh behave different.  I see that as a bug. 
Where where they sourced in LMDE2 (Mate)? Can't see it.

gm10
Level 12
Level 12
Posts: 4154
Joined: Thu Jun 21, 2018 5:11 pm

Re: Why does gnome-terminal ignore $HOME/bin ?

Post by gm10 » Thu Sep 27, 2018 9:32 am

I don't know, never used LMDE2, but I would think it used a different display manager and that handled that. I'm not using LMDE, I only noticed the issue the other day while testing something else out about it. I don't know if it's intentional or not - create an issue on github and find out I guess.

Usually you'll want to source ~/.profile by creating ~/.xsessionrc with this content:

Code: Select all

if [ -f ~/.profile ]; then
  . ~/.profile
fi
Source /etc/profile in a similar way if you want.

Monsta
Level 10
Level 10
Posts: 3013
Joined: Fri Aug 19, 2011 3:46 am

Re: Why does gnome-terminal ignore $HOME/bin ?

Post by Monsta » Fri Oct 05, 2018 5:15 am

Yes, it is the display manager. Ubuntu has a patch for lightdm to make it read these profile files. As I understand it, they did it because it was so in gdm, the display manager Ubuntu used before lightdm. See the discussion here.

Debian doesn't have such patch. Here it's stated that the display manager shouldn't read these files.
Graphical logins do not read a shell's startup files (/etc/profile and ~/.profile and so on) by default, but you as a user may choose to create a ~/.xsessionrc file which does this.
As for the previous display manager in Mint, mdm, I think it simply inherited the feature from gdm, as mdm is a fork of gdm 2.20.

Hansl
Level 3
Level 3
Posts: 103
Joined: Fri Dec 09, 2011 3:50 pm

Re: Why does gnome-terminal ignore $HOME/bin ?

Post by Hansl » Fri Oct 05, 2018 6:48 am

Thank you monsta, this explains it.
So, LMDE should now probably have such a ~/.xsessionrc as a copy from ~/.profile, I think.

gm10
Level 12
Level 12
Posts: 4154
Joined: Thu Jun 21, 2018 5:11 pm

Re: Why does gnome-terminal ignore $HOME/bin ?

Post by gm10 » Fri Oct 05, 2018 6:57 am

Hansl wrote:
Fri Oct 05, 2018 6:48 am

So, LMDE should now probably have such a ~/.xsessionrc as a copy from ~/.profile, I think.
Not as a copy, just to source the .profile as I showed you above. Anyway, given LMDE's heritage (LMDE2 and all the Ubuntu LM editions) I would agree with the suggestion to source it by default.

Post Reply

Return to “Software & Applications”