SSH command to shutdown Hassio on a Pi3

New user here :laughing:
Loaded Hassio yesterday onto a RPI3(b) and installed openssh addon.
I would like to shutdown the PI via an SSH command but a lot of the hassio commands appear not to work

Using Putty Plink on a windows 10 machine
plink -pw XXXXX [email protected] hassio sn new
hassio ho shutdown or hassio ha check all produce the following error

Error decoding json invalid character ‘:’ after top-level value: 401: Unauthorized

If I ssh in and issue the commands in the CLI they work

BTW. From the ssh server page it has a Note
“This add-on will not enable you to install packages or do anything as root. This is not allowed with Hass.io”
Is this the cause ?

The reason I need to shutdown the PI is that we get 20-30 thunder storms a year where the PI’s (I have 4 of them NAS/Media players…etc) have to be shutdown quickly.
I’ve already had to rebuild the sd card as it got corrupted as the PSU got unplugged (2 hours work lost :grimacing:)
I have an Android app with buttons that send various ssh commands to the PI’s and they shutdown. This is great so that my wife can shut all the PI’s down easily.
Searched all the ssh shutdown messages and it appears you should be able to do it but I’m not

Any help/pointers appreciated

Leigh
Hassio 0.81.0, Hassos 1.11 V138 ??

Any luck getting this resolved?

I have the same problem. All commands (i.e. hassio ha restart) work if I first ssh in.
The only remote commands that appear to work are hassio global options (i.e. hassio help). All others return
Error decoding json invalid character ‘:’ after top-level value: 401: Unauthorized
Anyone find or have a solution to this problem?

Hassio 0.82
hassio version 1.4.0

No replies - I think its because HASSIO is enclosed in a Docker.
I’ve seen somewhere you can login to the actual OS (Resio ?)
I may have to go to hassbien or rasbian+hass or (rasbian+docker+hassio) ?? if I cant find a solution
For the moment the problem is lower on my to do list - Trying to get Sonoffs talking to my MQTT correctly at the moment :slight_smile:

Leigh

Check if your SSH add-on is up-to-date - I started to have similar error messages, but they went when I updated that add-on.

Well, in my case command hassio ho shutdown gives

Unknown error, see log for details

and there I can see “ERROR (MainThread) [hassio.host.control] No manager D-Bus connection available”.

I can restart my RPi by /sbin/restart now , but couldn’t find a way to shutdown it (to take out and backup the SD card, for example).

Try

halt

And you shouldn’t need to use /sbin/restart, most sensible systems will have /sbin/ in your $PATH.

Thanks for the idea.

If I ssh and type halt, connection to my RPi is lost immediately and I’m no longer able to reconnect (Connection refused), BUT the RPi still running and I can access HA’s GUI. Actually, it halts the SSH server as it shows Stopped in Add-on details and I can start it to get ssh access back. Definitely not a shutdown alternative.

Speaking about /sbin/restart, in my case I have HA run on RPi3 and issuing restart in ssh results in`

core-ssh:~# restart
-bash: restart: command not found

`

Under hass.io I think the ssh runs under it own docker so if I ssh into hass.io and issue a halt or poweroff command it only shuts down the ssh (part/docker/demon)? and not the whole PI.
After login via Putty (root), in the ssh cmd window you type “hassio help” and the help shows commands “host, ho reboot, shutdown”
so “hassio host shutdown” causes the PI to shutdown.

Now try the same via plink (used all sorts for flags) I still get the json error
So still unable to do a remote shutdown.

Dashboard shown I’m up to date with the ssh add-on, running HA 0.82.1

Leigh

This problem is new. I know I used to be able to “hassio homeassistant stop hassio host shutdown”. Not anymore :frowning:

As for updating the (dashboard) add-on. I followed the suggestions displayed by the old shh/terminal addon to replace it with the new community add-on SSH and Terminal but I cant get it running at all. Each time I start it I get
FATAL: The configured certfile is not found

No idea what this file is and where it should be located.

try login and then shutdown