unable to shutdown / reboot my Debian 10 server

I'm trying to reboot my Debian 10 server but all I get is "Command not found. I've tired

shutdown
reboot
restart
poweroff

but nothing works. I found this thread but when I try to run any of this with sudo I get bash: sudo: command not found. Atm I'm logged in as root so I should have the privileges to restart the machine.\n Any Ideas?

2

6 Answers

The trick on how to fix this inconvenience is to explicitly tell the su to set environment variable as if the user logs in directly. This is can be done by the use of - switch.

$ su -

Debian 10 has now fully switched to Systemd which means that the traditional commands to halt or reboot a system like 'shutdown -h now' or 'reboot' will not work anymore

source

Starting with Debian 10, you should use the commands systemctl poweroff or systemctl reboot.

Edit: It appears the above source was partially incorrect, you can still log in as root (see answer by Eugene) to run the old commands. If you don't want to log in as root, use systemctl.

source

2

As 'root' -> 'systemctl poweroff' or 'systemctl reboot'

3

As 'root' -> Edit /root/.bashrc

Add to the end of the file:

alias reboot='systemctl reboot'
alias poweroff='systemctl poweroff'

Save the file and start session as root again.

1

Try:

nano /bin/reboot

add line: systemctl reboot

exit and save

chmod to your preffered execution level

I'm sure there is a more elegant way to fix this but I am going to have a hard time remembering that only debian 10 requires a special reboot command. This works for me as long as i'm in su first.

Use /sbin/shutdown [OPTIONS...] [TIME] [WALLMSG] :)

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like