LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions
User Name
Password
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


Reply
  Search this Thread
Old 09-20-2020, 05:41 AM   #1
Pinguino99
Member
 
Registered: Dec 2019
Posts: 44

Rep: Reputation: Disabled
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?
 
Old 09-20-2020, 08:55 AM   #2
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,525

Rep: Reputation: Disabled
These are root owned files, so first I'd check their permissions.
 
Old 09-20-2020, 09:30 AM   #3
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,692
Blog Entries: 19

Rep: Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496
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.
Old 09-21-2020, 12:03 AM   #4
Pinguino99
Member
 
Registered: Dec 2019
Posts: 44

Original Poster
Rep: Reputation: Disabled
even if I'm root the problem continues :\

the commands only work that way, example

Code:
# /sbin/shutdown
ou
# /sbin/mkfs.vfat
 
Old 09-21-2020, 05:39 AM   #5
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,692
Blog Entries: 19

Rep: Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496
Can you post the results of
Code:
echo $PATH
for yourself and root?
 
Old 09-21-2020, 06:05 AM   #6
Pinguino99
Member
 
Registered: Dec 2019
Posts: 44

Original Poster
Rep: Reputation: Disabled
Code:
# echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
 
Old 09-21-2020, 06:16 AM   #7
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,692
Blog Entries: 19

Rep: Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496
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.
 
Old 09-21-2020, 07:30 AM   #8
Pinguino99
Member
 
Registered: Dec 2019
Posts: 44

Original Poster
Rep: Reputation: Disabled
what would be the best solution?
from what I understand the Debian 10 buster has the same problem
 
Old 09-21-2020, 08:02 AM   #9
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,634

Rep: Reputation: 2558Reputation: 2558Reputation: 2558Reputation: 2558Reputation: 2558Reputation: 2558Reputation: 2558Reputation: 2558Reputation: 2558Reputation: 2558Reputation: 2558
Quote:
Originally Posted by Pinguino99 View Post
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?

 
Old 09-21-2020, 08:28 AM   #10
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,692
Blog Entries: 19

Rep: Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496Reputation: 4496
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.
 
Old 09-21-2020, 02:20 PM   #11
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,525

Rep: Reputation: Disabled
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.
 
Old 09-21-2020, 02:46 PM   #12
Pinguino99
Member
 
Registered: Dec 2019
Posts: 44

Original Poster
Rep: Reputation: Disabled
in which file should i add the correct path?
 
Old 09-21-2020, 02:57 PM   #13
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,796

Rep: Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952
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.
 
Old 09-21-2020, 03:24 PM   #14
Pinguino99
Member
 
Registered: Dec 2019
Posts: 44

Original Poster
Rep: Reputation: Disabled
I'm using the su command
 
Old 09-21-2020, 07:12 PM   #15
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,796

Rep: Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952
Use su - command instead.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Devuan - Devuan based distros fatmac Linux - Distributions 50 02-19-2018 08:15 AM
Devuan & Devuan based distro thread fatmac Linux - General 8 07-30-2017 02:55 AM
Difference between mkfs.vfat and mkfs.msdos? EmrldDrgn Linux - Newbie 6 07-23-2009 03:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions

All times are GMT -5. The time now is 12:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration