Linux - Distributions This forum is for Distribution specific questions.
Red Hat, Slackware, Debian, Novell, LFS, Mandriva, Ubuntu, Fedora - the list goes on and on...
Note: An (*) indicates there is no official participation from that distribution here at LQ. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
09-20-2020, 05:41 AM
|
#1
|
Member
Registered: Dec 2019
Posts: 44
Rep: 
|
Devuan 3.0 - shutdown and mkfs command not found
some commands from the sbin directory are not working without specifying the path, what is the best way to solve this?
|
|
|
09-20-2020, 08:55 AM
|
#2
|
LQ Guru
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: One main distro, & some smaller ones casually.
Posts: 5,862
Rep: 
|
These are root owned files, so first I'd check their permissions.
|
|
|
09-20-2020, 09:30 AM
|
#3
|
LQ Guru
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 8,260
|
If you're using them via sudo, it depends a lot on how the program was built. Some builds of sudo set it to use the root command path, so that commands in /sbin and /usr/sbin are instantly available. Others stick with your user-defined path, which doesn't usually include these directories.
Last edited by hazel; 09-20-2020 at 09:31 AM.
|
|
1 members found this post helpful.
|
09-21-2020, 12:03 AM
|
#4
|
Member
Registered: Dec 2019
Posts: 44
Original Poster
Rep: 
|
even if I'm root the problem continues :\
the commands only work that way, example
Code:
# /sbin/shutdown
ou
# /sbin/mkfs.vfat
|
|
|
09-21-2020, 05:39 AM
|
#5
|
LQ Guru
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 8,260
|
Can you post the results of for yourself and root?
|
|
|
09-21-2020, 06:05 AM
|
#6
|
Member
Registered: Dec 2019
Posts: 44
Original Poster
Rep: 
|
Code:
# echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
|
|
|
09-21-2020, 06:16 AM
|
#7
|
LQ Guru
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 8,260
|
Well, there you are then! /sbin and /usr/sbin are not on root's command path. They ought to be. I don't know how Devuan does it but in most distros, the user login files, .profile and .bashrc, source standard profile and bashrc files in /etc that set these variables. That ensures that they are correctly set for all users.
In your case, the simplest solution is to edit the correct path in by hand in the appropriate root login file.
Last edited by hazel; 09-21-2020 at 06:18 AM.
|
|
|
09-21-2020, 07:30 AM
|
#8
|
Member
Registered: Dec 2019
Posts: 44
Original Poster
Rep: 
|
what would be the best solution?
from what I understand the Debian 10 buster has the same problem
|
|
|
09-21-2020, 08:02 AM
|
#9
|
Senior Member
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,918
|
Quote:
Originally Posted by Pinguino99
from what I understand the Debian 10 buster has the same problem
|
Not sure what problem you're referring to - it's necessary to use sudo/root for shutdown command but root's PATH on my Buster machine is correct.
It appears to be handled at the top of " /etc/profile"...
Code:
$ head -n10 /etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
export PATH
My guesses would be: your file is different; something is stopping it being executed; or something executed later is overriding PATH when it should be appending?
|
|
|
09-21-2020, 08:28 AM
|
#10
|
LQ Guru
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 8,260
|
The way it's supposed to be done is that useradd creates a home directory for a new user and copies over any files it finds in /etc/skel. These files include specimen .bashrc and .profile files, and these in turn source /etc/profile and /etc/bashrc. It's complicated but necessary in an office system, where new accounts may need to be created frequently. For a home system, which typically has only one user account, it's overkill.
In this case, only the root path is problematic, so why not just edit the path in whichever file in /root sets it (probably .profile) adding ":/sbin:/usr/sbin" at the end of the line?
Last edited by hazel; 09-21-2020 at 08:40 AM.
|
|
|
09-21-2020, 02:20 PM
|
#11
|
LQ Guru
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: One main distro, & some smaller ones casually.
Posts: 5,862
Rep: 
|
Here's my Debian path, Devuan should be the same.
Quote:
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin
|
N.B. I'm in the sudo group.
|
|
|
09-21-2020, 02:46 PM
|
#12
|
Member
Registered: Dec 2019
Posts: 44
Original Poster
Rep: 
|
in which file should i add the correct path?
|
|
|
09-21-2020, 02:57 PM
|
#13
|
Moderator
Registered: Aug 2002
Posts: 26,750
|
Are you logging in directly as root or using su to become root?
If the latter are you using su - ? The - switches the environment from your regular user to root's which should then be the path as posted above.
|
|
|
09-21-2020, 03:24 PM
|
#14
|
Member
Registered: Dec 2019
Posts: 44
Original Poster
Rep: 
|
I'm using the su command
|
|
|
09-21-2020, 07:12 PM
|
#15
|
Moderator
Registered: Aug 2002
Posts: 26,750
|
Use su - command instead.
|
|
|
All times are GMT -5. The time now is 09:27 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|