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 ?

5
  • Please supply information about what OS and what version of that OS you are using. Also, please tell us, whether you use systemd or not.
    – Izzy
    Sep 11, 2015 at 10:15
  • I am using Raspbian Version 3.18 i think i did not uses systemd but i am not sure
    – Zion
    Sep 11, 2015 at 10:27
  • Try ps ax | grep -E "(systemd|upstart|init)" in a terminal and look for systemd or init. This will be your init system.
    – Izzy
    Sep 11, 2015 at 10:47
  • OK I get 1 ? Ss 0:01 init [2]
    – Zion
    Sep 11, 2015 at 11:01
  • Thanks Erverbody I use sudo init 0 and it works!
    – Zion
    Sep 11, 2015 at 11:05

3 Answers 3

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.

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.

0
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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.