12

I logged in to my Debian 7 server, did an upgrade using apt and wanted to shutdown+reboot using shutdown -r now as i did a lot of times before. This time, the shutdown command can't be found anymore. I've already read somewhere that i can try it with the whole path /sbin/shutdown, but the programm isn't there, too. I also can't find the reboot command anywhere.

What went wrong? What can i do to restore the shutdown command?

TheJeed
  • 231
  • 1
  • 3
  • 9

2 Answers2

15
$ dpkg -S /sbin/shutdown
sysvinit-core: /sbin/shutdown

You probably "upgraded" to systemd, removing shutdown and friends. If so, you now need to do systemctl poweroff to shutdown the system. Why does systemd not provide an alias to shutdown? Why not indeed...

EDIT:

/sbin/shutdown should be available if you install the systemd-sysv package. It would be nice if systemd would recommend or even just suggest systemd-sysv.

wurtel
  • 3,806
  • 12
  • 15
  • You were right! I reinstalled systemd and I've got my shutdown command back where it belongs. Thanks a lot! – TheJeed Oct 31 '14 at 15:11
  • systemd breaking habits :( – Hrvoje Špoljar Oct 31 '14 at 15:12
  • @wurtel As can be seen [here](https://packages.debian.org/search?suite=wheezy&arch=any&searchon=contents&keywords=%2Fsbin%2Fshutdown) the file `/sbin/shutdown` exists in `sysvinit`, `systemd-sysv` and `upstart` in Debian Wheezy. – Håkan Lindqvist Oct 31 '14 at 15:13
  • 1
    Ah, I apologize, I did search packages.debian.org first, but I think I was mentally grepping for `something-systemd`, not `systemd-something`. I'll edit my answer to reflect that. – wurtel Oct 31 '14 at 15:47
10

I found this post after an apt-get dist-upgrade from Debian stretch to Debian buster left me with no shutdown or reboot commands. I tried apt-get install systemd-sysv as suggested above and discovered it was already present.

I was surprised to find that somehow my PATH had gotten mucked up and no longer included /sbin. So /sbin/reboot worked just fine.

I answer here in case other folks run into this situation after an upgrade and become superstitious. The lack of similar concerns on the net suggests this is a rare occurrence. It is obvious that one should check one's path before concluding a command is missing. OTOH, I did a which reboot and got nothing. My goto tool failed me and so I missed the obvious.