Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Unable to reboot, poweroff, or shutdown
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Jt0
n00b
n00b


Joined: 28 Oct 2018
Posts: 32

PostPosted: Wed Dec 12, 2018 1:07 am    Post subject: [SOLVED] Unable to reboot, poweroff, or shutdown Reply with quote

After finishing installation, I'm unable to shut down my computer from the normal user. I searched for this problem and found this SuperUser question, which worked for me on a VM I was working on using a laptop.
I've also got a desktop where I installed Gentoo natively, but after doing the exact same thing (editing the sudoers file with visudo), I'm still unable to use poweroff, shutdown, restart, or halt. I get the same "shutdown: you must be root to do that!" or "poweroff: must be superuser." errors.
I've made my normal user account a member of the wheel group, and I can execute commands via sudo, but it's not recognizing the last four lines. Everything is spelled correctly and /sbin is on my path. I'm able to execute all of these commands as root.


Last edited by Jt0 on Wed Dec 26, 2018 3:12 am; edited 1 time in total
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14074

PostPosted: Wed Dec 12, 2018 3:20 am    Post subject: Reply with quote

What is the output of tail -n10 /etc/sudoers ; sudo shutdown -h now?
Back to top
View user's profile Send private message
Jt0
n00b
n00b


Joined: 28 Oct 2018
Posts: 32

PostPosted: Wed Dec 12, 2018 9:33 pm    Post subject: Reply with quote

Code:
## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL) ALL

## Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL

## Uncomment to allow members of group sudo to execute any command
# %sudo ALL=(ALL) ALL

## Uncomment to allow any user to run sudo if they know the password
## of the user they are running the command as (root by default).
# Defaults targetpw  # Ask for the password of the target user
# ALL ALL=(ALL) ALL  # WARNING: only use this together with 'Defaults targetpw'

## Read drop-in files from /etc/sudoers.d
## (the '#' here does not indicate a comment)
#includedir /etc/sudoers.d

user ALL=(root) NOPASSWD: /sbin/halt
user ALL=(root) NOPASSWD: /sbin/poweroff
user ALL=(root) NOPASSWD: /sbin/reboot
user ALL=(root) NOPASSWD: /sbin/shutdown


where 'user' is my username (this is the output of tail -n22 to show I have sudo enabled for the wheel group). The second command just displays the help text for shutdown (I'm having to mount from my main Fedora installation for now and don't have the Gentoo partitions set up for chroot at the moment, so I can't run the command to copy and paste the text).
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14074

PostPosted: Thu Dec 13, 2018 1:18 am    Post subject: Reply with quote

That is strange. What is the output of type shutdown ; echo $PATH? What if you use sudo /sbin/shutdown -h now, to match the qualified path in the sudoers file?
Back to top
View user's profile Send private message
Jt0
n00b
n00b


Joined: 28 Oct 2018
Posts: 32

PostPosted: Tue Dec 18, 2018 2:58 pm    Post subject: Reply with quote

Thanks for your help, but I'm just going to reinstall. Between the system not being configured correctly for secure boot (I could only use the original kernel I installed with from a chroot from Fedora) and something getting messed up with me trying to transfer /var to its own partition (SDDM would allow me to input a password, but it would attempt to load KDE, fail, and go back to the login screen on every login attempt), it's probably just best to do it correctly from the start. I'll do some more searching before opening a new thread for questions related to the new installation.
Back to top
View user's profile Send private message
Jt0
n00b
n00b


Joined: 28 Oct 2018
Posts: 32

PostPosted: Sat Dec 22, 2018 4:22 am    Post subject: Reply with quote

Alright, so I've reinstalled, got everything working for the most part, except I'm still unable to use these commands from a terminal emulator.

Strangely, I've got the options for reboot, shutdown, etc. in the KDE menu, and they work. But if I try to reboot from Konsole, I get
Code:
reboot: must be superuser.


Output of type shutdown ; echo $PATH:

Code:
$ type shutdown ; echo $PATH
shutdown is /sbin/shutdown
/usr/lib/llvm/7/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin


Going back to the previous suggestion, tail -n10 /etc/sudoers ; sudo shutdown -h now shuts down the computer.

"/sbin/shutdown -h now" results in "shutdown: you must be root to do that!"
"sudo /sbin/shutdown -h now" shuts down the computer without asking me for a password.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14074

PostPosted: Sat Dec 22, 2018 4:55 pm    Post subject: Reply with quote

I am confused. You say you cannot use them from a terminal, then you describe each of them working exactly as expected. It is normal and correct that an unprivileged user cannot run these commands successfully. That is why you configured sudo for them. It is normal and correct that invoking them through sudo, with proper parameters, shuts down without further prompting. KDE's menu probably either uses sudo for you, or has access to some privileged process that performs the shutdown on your behalf.

Could you describe exactly what you think still needs work before this thread is solved to your satisfaction?
Back to top
View user's profile Send private message
Jt0
n00b
n00b


Joined: 28 Oct 2018
Posts: 32

PostPosted: Wed Dec 26, 2018 3:12 am    Post subject: Reply with quote

I'm not sure what I was thinking at the time, but you're right, I think everything's working normally. I'll mark as solved.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum