unable to shutdown / reboot my Debian 10 server

Solution 1:

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 -

Solution 2:

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

Solution 3:

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

Solution 4:

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.