15

to Shutdown my Raspberry I type sudo shutdown -h -P now this works fine when I am directly contected via USB Keyboard and Hdmi display but when Iam connected over SHH from my windows Pc using Putty it does not shutdown. It looks like this :

pi@transceiver02 ~ $ sudo shutdown -h -P now
The system is going down for system halt NOW!s/1) (Fri Sep 11 09:45:06 2015):
pi@transceiver02 ~ $ ls
bluez-5.33           command   python_games    testInst
bluez-5.33.tar.xz    Desktop   ShutdownBtn.py  text.txt
bluez-5.33.tar.xz.1  PTest.py  ShutDownBtn.sh
pi@transceiver02 ~ $

So How do I realy shutdown the Raspberry over SSH ?

Zion
  • 321
  • 2
  • 3
  • 4

3 Answers3

15

Depending on your init system, the command may vary.

On a Raspbian with systemd you can switch off the system with:

sudo systemctl poweroff

On a system with SysV-Init system, you can use:

sudo shutdown -h now

or

sudo halt

You can, of course, ommit the sudo if you are already logged in as root or su'd before executing.

Izzy
  • 581
  • 6
  • 16
3

sudo shutdown -h now should work and I do this all the time. The -P doesn't hurt, but as the Pi doesn't have power control does nothing.

This is the recommended method of halting. It can take a little time to actually shut down. It is possible that some running system process may slow things down.

Milliways
  • 59,890
  • 31
  • 101
  • 209
2

Another datapoint, if its useful. I regularly shutdown via ssh, but I run ssh from the command line (not via Putty).

The following shuts down my Pi and powers off (HDMI out becomes disabled, but always on Power LED stays on). Note: this is on Raspbian, and I ran uname to show you my version. The commands below were run remotely from my Macbook.

# ssh pi@raspberrypi -t uname -a
Linux raspberrypi 3.18.7-v7+ #755 SMP PREEMPT Thu Feb 12 17:20:48 GMT 2015 armv7l GNU/Linux
Connection to raspberrypi closed.
# ssh pi@raspberrypi -t sudo shutdown -h -P now

Broadcast message from root@raspberrypi (pts/0) (Fri Sep 11 12:40:01 2015):
The system is going down for system halt NOW!
Connection to raspberrypi closed.
Brian
  • 577
  • 3
  • 9