You are not logged in.
Hi!
Since a few days ago, I had trouble building a certain software package with cmake. After much confusion, I found out I am running into this problem: https://bbs.archlinux.org/viewtopic.php?id=258714. That is: cmake is being run from /bin — which it does not like — because /bin is in my $PATH (and before /usr/bin). This is a relatively new problem (I've built this same package many times in the past), and as far as I know I have not been fiddling with my $PATH myself recently.
Currently my path looks like:
[~] $ echo "$PATH"
/home/bepaald/.local/bin:/home/bepaald/bin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perlI've been reading the wiki on environment variables (https://wiki.archlinux.org/title/environment_variables) to try and figure out how this path is made exactly.
The first part I know, because I have export PATH=$HOME/.local/bin:$HOME/bin:$PATH in my .bash_profile. All the stuff after /bin I can also understand:
- '/usr/bin:/usr/local/bin:/usr/local/sbin'. These three are set by /etc/profile
- '/usr/lib/jvm/default/bin'. Set by /etc/profile.d/jre.sh
- '/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl'. These three are set by /etc/profile.d/perlbin.sh
But the /bin is a mystery to me. All the other local files mentioned in the wiki (~/.profile, ~/.bash_login, ~/.config/environment.d/) I do not have, and grepping through the rest of '/etc/profile.d/', '/etc/environment' and '/etc/security/pam_env.conf' does not give any hints.
Does anyone know what is adding /bin to my $PATH, or how to find out? And of course, how to stop it?
Thanks!
EDIT I should also mention probably that I created a new user to test. This user does not have the same problem, so that probably excludes any global culprits (in /etc for example) and means the problem is in a user local file.
Last edited by bepaald (2024-01-18 17:34:55)
Offline
Can you post your completely ~/.bash_profile?
I'd bet there is some attempt to set something like PATH=$VARIABLE/bin:$PATH when either the variable is not set and / or when there is a typo in the variable name.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Online
Of course:
[~] $ cat ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
# set path...
export PATH=$HOME/.local/bin:$HOME/bin:$PATH
[~] $ grep PATH ~/.bashrc
[~] $I'd thought about '$HOME' somehow being unset or something, but then I would have expected '/.local/bin' on the PATH as well...
Thanks!
Offline
And how does .bashrc look like?
Inofficial first vice president of the Rust Evangelism Strike Force
Offline
Well, it's long and ugly, but 'PATH' isn't mentioned (that's why I added the 'grep' in my previous post), and the only thing sourced is:
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fiShould I post the whole thing?
Offline
Yes. It does not matter that PATH is not in there. It might be set in a file included within .bashrc, especially if it's "long and ugly".
If you're absolutely sure, that nothing else is included in there, then, no.
Next place to look would then be /etc/bashrc.
If everything fails, you can bring out the shotgun:
$ grep -rE "(\"|:)[^/]*/bin:" /Last edited by schard (2024-01-18 16:16:38)
Inofficial first vice president of the Rust Evangelism Strike Force
Offline
I note it has been assumed you are running Bash as your shell. I assume you would tell us if you were using zsh, fish, etc...
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
Thanks for the replies. I am indeed using bash. I'm just about 100% sure nothing in .bashrc is messing with the PATH, it's just a couple hundred lines of aliases and functions.
[~] $ cat /etc/bashrc
cat: /etc/bashrc: No such file or directory
[~] $(is that actually normal?)
I have a process running at the moment, but in about half an hour I will try emptying out both .bashrc and .bash_profile and rebooting...
Offline
- '/usr/bin:/usr/local/bin:/usr/local/sbin'. These three are set by /etc/profile
No they aren't — that file sets
PATH="/usr/local/sbin:/usr/local/bin:/usr/bin"You shouldn't have /usr/bin/ before /usr/local/{s,}bin.
EDIT: system-wide bash configuration is set in /etc/bash.bashrc btw.
I think you should try shard's shotgun but aim it at "$HOME".
Last edited by Head_on_a_Stick (2024-01-18 16:33:17)
Jin, Jîyan, Azadî
Offline
So, I commented out the export in .bash_profile and renamed .bashrc:
[bepaald@DESKTOP ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
# set path...
#export PATH=$HOME/.local/bin:$HOME/bin:$PATH
[bepaald@DESKTOP ~]$ cat .bashrc
cat: .bashrc: No such file or directory
[svandijk@DESKTOP ~]$ echo $PATH | tr ":" "\n"
/bin
/usr/bin
/usr/local/bin
/usr/local/sbin
/usr/lib/jvm/default/bin
/usr/bin/site_perl
/usr/bin/vendor_perl
/usr/bin/core_perlThe problem remains... So, shards shotgun, aimed at $HOME (I added -I because the binary matching was taking a long time, let me know if I need to remove that):
[~] $ "grep" -rEI "(\"|:)[^/]*/bin:" $HOME
grep: /home/bepaald/stuff/coins/btc_wallet.asc: Permission denied
grep: /home/bepaald/stuff/logins.asc: Permission denied
/home/bepaald/.bash_profile:export PATH=$HOME/.local/bin:$HOME/bin:$PATH
grep: /home/bepaald/temp/Signal-Android-main-OLD/app/src/main/java/org/thoughtcrime/securesms/service/webrtc/.IncomingCallActionProcessor.java.8Qttfi: Permission denied
/home/bepaald/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pleaserun-0.0.24/templates/sysv/default/init.sh:PATH=/sbin:/usr/sbin:/bin:/usr/bin
/home/bepaald/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86_64/lib/vendor/ruby/2.3.0/gems/pleaserun-0.0.24/templates/sysv/default/init.sh:PATH=/sbin:/usr/sbin:/bin:/usr/bin
/home/bepaald/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86_64/lib/ruby/lib/ruby/2.3.0/shell.rb: # /usr/bin:/bin:/usr/local/bin
/home/bepaald/.rustup/toolchains/nightly-2020-11-09-x86_64-unknown-linux-gnu/share/doc/rust/html/std/env/fn.join_paths.html: <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">path_os_string</span>, <span class="ident">OsString</span>::<span class="ident">from</span>(<span class="string">"/bin:/usr/bin"</span>));
/home/bepaald/.rustup/toolchains/nightly-2020-11-09-x86_64-unknown-linux-gnu/share/doc/rust/html/src/std/env.rs.html:<span class="doccomment">/// assert_eq!(path_os_string, OsString::from("/bin:/usr/bin"));</span>
/home/bepaald/.rustup/toolchains/nightly-2021-06-08-x86_64-unknown-linux-gnu/share/doc/rust/html/std/env/fn.join_paths.html: <span class="macro">assert_eq!</span>(<span class="ident">path_os_string</span>, <span class="ident">OsString::from</span>(<span class="string">"/bin:/usr/bin"</span>));
/home/bepaald/.rustup/toolchains/nightly-2021-06-08-x86_64-unknown-linux-gnu/share/doc/rust/html/src/std/env.rs.html:<span class="doccomment">/// assert_eq!(path_os_string, OsString::from("/bin:/usr/bin"));</span>
[~] $ Offline
Ok, new info:
While I said I created a new user and that new user did not have the problem, this is not entirely the case. I did not see the problem with the new user, because I only logged that user in without a graphical environment. If I log the new user into KDE with sddm, the exact same problem occurs. Similarly, if I switch to TTY3 and log myself in (no graphics), I get
[$] echo $PATH | tr ":" "\n"
/home/bepaald/.local/bin
/home/bepaald/bin
/usr/local/sbin
/usr/local/bin
/usr/bin
/usr/lib/jvm/default/bin
/usr/bin/site_perl
/usr/bin/vendor_perl
/usr/bin/core_perlWhich looks good to me. So, it's something to do with the graphical environment (X11?/sddm?/kde?)... Any thoughts?
Thanks!
Last edited by bepaald (2024-01-18 17:22:53)
Offline
What's in your /etc/sddm.conf and /etc/sddm.conf.d/* ?
Offline
>What's in your /etc/sddm.conf and /etc/sddm.conf.d/* ?
I was just coming back to post I solved this, but if I hadn't yet, you were right on the money. For reasons unknown (and for who knows how long), there was a bad DefaultPath= line in my /etc/sddm.conf. I removed it, logged out and now:
[~] $ echo "$PATH" | tr ':' '\n'
/home/bepaald/.local/bin
/home/bepaald/bin
/usr/local/sbin
/usr/local/bin
/usr/bin
/usr/lib/jvm/default/bin
/usr/bin/site_perl
/usr/bin/vendor_perl
/usr/bin/core_perlSo, this is solved. Thank you all for your help, you're all very kind!
Offline