[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 18
Level 18
Posts: 8748
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 18
Level 18
Posts: 8748
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: 3027
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 18
Level 18
Posts: 8748
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.

User avatar
orcus
Level 1
Level 1
Posts: 16
Joined: Mon Jun 19, 2017 7:13 pm

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

Post by orcus » Thu Apr 04, 2019 7:15 pm

yup - I know it's 2019 already, but as people will likely search on why
/etc/profile
/etc/xprofile
$HOME/.profile
$HOME/.xprofile

are not sourced - will end at related forum posts even in 2019 I'll just add what's the reason + some fix (if people are willing to give it a try)

#######################################
Edit - I've added some better description there (instead of throwing just a comand at people):
https://www.orcus.de/main_workarounds/l ... rofile.htm

leaving most of the original post unchanged...
#######################################

This is just the output of the tool one could use as a temporary fix:

Code: Select all

     source <(wget https://www.orcus.de/Entities/linux/lmde3-fix-profile.sh -O - 2>/dev/null) VERINFO
general information
----------------------------------------------------------------------
LMDE 3 (cindy) did switch the default DM from mdm to lightdm.
With LMDE 2 (betsy) mdm did care about sourcing "*profiles".
With LMDE 3 (cindy) lightdm is missing an according functionality with
the default installation.
----------------------------------------------------------------------
Thus defined export env-variales will not be usabele with this files:

/etc/profile
/etc/xprofile
/home/<username>/.profile (aka $HOME/.profile)
/home/<username>/.xprofile (aka $HOME/.xprofile)

Accordingly it is not possible to setup (install- or) user-specific
environment variables in a common/expected way for the x-session.
----------------------------------------------------------------------
This workaround does
- add missing/required files (lightdm-wrapper and a helper-file for
error-/message-display)
- adjust lightdm config to override a pre-compiled lightdm setting
to honor/use the lightdm-wrapper.
----------------------------------------------------------------------
Remark: lightdm does use precompiled config-values, where defaults
differ between the debian- and ubuntu-based versions regarding usage
of lightdm-wrapper!
ubuntu/mint 19.x -version = active
debian/LMDE3 -version = inactive

Thus an according config-option has to be set explicitly with LMDE3,
to activate the usage of an available lightdm-wrapper.
----------------------------------------------------------------------
Before doing any modifications to the installation, the tool does test
if
- you are using a matching version of LMDE 3
- lightdm is used (a lightdm-session is running) at all
- there are no other/previous versions of the required additional
files present
- the lightdm-wrapper setting is not configured

If any of this tests wont match, the system will NOT get modified.
If you are interested in giving it a try - just run it witout the VERINFO parameter:

Code: Select all

     source <(wget https://www.orcus.de/Entities/linux/lmde3-fix-profile.sh -O - 2>/dev/null)
I'll will add some according bugreport the next days and suggest the fix for it.
If you are having further questions: I often hang around at #linuxmint-help at spotchat-irc

cheers orcus
orcus - by the light of the night

0mcg0
Level 1
Level 1
Posts: 1
Joined: Mon Jun 03, 2019 12:39 pm

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

Post by 0mcg0 » Mon Jun 03, 2019 1:40 pm

Thanks! I've seen this or a very similar bug before in other distros but never found a good solution.

Post Reply

Return to “Software & Applications”