Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NB: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin UBUNTU

Tags:

linux

ubuntu

When running command in shell (e.g. sudo apt-get install aptitude) this is the output:

dpkg: warning: 'ldconfig' not found in PATH or not executable.
dpkg: warning: 'start-stop-daemon' not found in PATH or not executable.
dpkg: 2 expected program(s) not found in PATH or not executable.
NB: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin.

This are the variables I've set:

export PATH=$PATH:/usr/local/sbin:/usr/local/bin in bashrc
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" in /etc/environment
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" in /etc/sudoerds
echo $path /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/node/node:/usr/local/sbin:/usr/local/bin
sudo echo $path
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/node/node:/usr/local/sbin:/usr/local/bin
like image 770
Juan Isaias Valentino Avatar asked Dec 24 '22 11:12

Juan Isaias Valentino


2 Answers

Thanks, this worked for me!

nano /root/.bashrc

Go to the very last and enter:

export PATH=/sbin:/bin:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin

After updating the bashrc do:

. /root/.bashrc

OR source /root/.bashrc

like image 124
Vikram Bankar Avatar answered Dec 26 '22 02:12

Vikram Bankar


Try sudo su - and run the same command directly from the root and see if its goes through.

Also set the PATH variable in /root/.bashrc file to be on safer side if it doesn't work.

/root/.bashrc export PATH=/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin

This is just environment variable issue unless those binary's are actually missing which is unlikely, you never know others environment :)

like image 35
Ramesh Shihora Avatar answered Dec 26 '22 00:12

Ramesh Shihora