unable to shutdown / reboot my Debian 10 server

5

2

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?

BDevGW

Posted 2019-07-22T08:24:39.240

Reputation: 73

Maybe your PATH is empty or messed up. /sbin/reboot should work. If it works, do you still get command not found for many commands after the reboot? – Kamil Maciorowski – 2019-07-22T08:30:51.973

Its a VM where I want to try my new coded C# apps with Mono so I don't use many commands there. I can say that apt, apt-get, su and wget works. So I tried it with your version and it works fine on the machine itself. After the reboot it works with putty too. It was the first start after the installation. Coud whis cause the problem? – BDevGW – 2019-07-22T08:39:06.470

Answers

8

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 -

Eugene Roslyakov

Posted 2019-07-22T08:24:39.240

Reputation: 81

3

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

MartinsBee

Posted 2019-07-22T08:24:39.240

Reputation: 31

1Why, what does this do, explain with more detail. – Pimp Juice IT – 2019-08-29T15:01:13.267

@GammaGames your edit was rejected because it substantially changed the post. Your info is good and so should be its own answer. Please post your own answer. – music2myear – 2019-11-14T18:47:15.383

@music2myear thank you, the reject reasons were generic and did not seem to match your explanation. I have submitted an answer. – GammaGames – 2019-11-14T18:54:21.273

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.

GammaGames

Posted 2019-07-22T08:24:39.240

Reputation: 121