You are not logged in.

#1 2011-05-13 15:25:34

Lockheed
Member
Registered: 2010-03-16
Posts: 1,521

bash: command not found

Since two days, I have a problem running some system commands, for example:

mkinitcpio
reboot
lspci

etc.

The result being: bash: mkinitcpio: command not found



The files are there, but work only if I give full path to them. I know it has something to do with the PATH variable not being loaded at the start of system, but I do not know how to fix it.

Help, please.

Last edited by Lockheed (2011-05-13 21:31:31)

Offline

#2 2011-05-13 15:48:14

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: bash: command not found

What's the output of 'echo $PATH'?
https://wiki.archlinux.org/index.php/FA … tart_it.3F says /etc/profile should be sourced.

Last edited by karol (2011-05-13 15:50:28)

Offline

#3 2011-05-13 15:54:55

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,847

Re: bash: command not found

Also, what is the result of

 cat /etc/profile

Check that ~/.profile and ~/.bashrc are not setting PATH to something - or if they are that $PATH: is at the start of the spec.

PATH=$PATH:mypath

"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Offline

#4 2011-05-13 15:56:55

Lockheed
Member
Registered: 2010-03-16
Posts: 1,521

Re: bash: command not found

$ echo $PATH
/usr/lib/libfm:/bin:/usr/bin:/usr/local/bin:/home/juha/bin
$  cat /etc/profile
# /etc/profile

#Set our umask
umask 022

# Set our default path
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
export PATH

# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
    for profile in /etc/profile.d/*.sh; do
        test -r "$profile" && . "$profile"
    done
    unset profile
fi

# Source global bash config
if test "$PS1" && test "$BASH" && test -r /etc/bash.bashrc; then
    . /etc/bash.bashrc
fi

# Termcap is outdated, old, and crusty, kill it.
unset TERMCAP

# Man is much better than us at figuring this out
unset MANPATH

Offline

#5 2011-05-13 16:01:35

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,847

Re: bash: command not found

Something is setting PATH but not referencing the previous PATH, thus overwriting it with what you see when you echo $PATH

Check ~/.profile and ~/.bashrc


"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Offline

#6 2011-05-13 19:55:41

Lockheed
Member
Registered: 2010-03-16
Posts: 1,521

Re: bash: command not found

Spot on. I forgot I messed up my /.bashrc.
Thanks

Offline

#7 2011-05-13 21:31:21

Lockheed
Member
Registered: 2010-03-16
Posts: 1,521

Re: bash: command not found

Ok, I called it solved too quickly.
It seems I can run all programs except for those from /sbin

Offline

#8 2011-05-13 21:46:15

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: bash: command not found

Lockheed wrote:

Ok, I called it solved too quickly.
It seems I can run all programs except for those from /sbin

IIRC you need to be root (or use sudo) to run them.

Offline

#9 2011-05-13 22:28:34

Lockheed
Member
Registered: 2010-03-16
Posts: 1,521

Re: bash: command not found

It doesn't run with sudo

Offline

#10 2011-05-14 20:28:53

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,847

Re: bash: command not found

What's the error message?

EDIT: did you remember the colon after $PATH?

Last edited by skanky (2011-05-14 20:29:46)


"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Offline

#11 2011-05-14 21:02:46

Lockheed
Member
Registered: 2010-03-16
Posts: 1,521

Re: bash: command not found

I think I fixed it. Dropped the output of "cat" it into .bash somewhere as apparently it was being overwritten by some other file at boot up.

Offline

Board footer

Powered by FluxBB