Hass.io problems after power outage

We had a lightning induced outage a while back. Since then, although HA is running fine, I can no longer access the hass.io portion of the system from the webpage, and attempts to access from ssh get either “401 unauthorized” or “parse error: Expected string key before ‘:’ at line 1, column 4”. I have root access to the resin-os module, but I don’t know enough about the architecture to know where to look. Samba shares are working fine, as are all the automations and controls. I just can’t reach the supervisor module at all. For example, in ssh, no hassio call works because the hassio system can’t be accessed.
My Let’s Encrypt key is expiring in 3 weeks and I will be unable to renew it without supervisor access, so that will be the end of my HA system unless I can repair this problem, or I will have to start over from the beginning with a new image. I would really appreciate any help.

If you have ssh access and or samba you can create snapshots and back them up. Then you will be able to flash a new sd card and restore the snapshot.

Have you tried the ‘hassio --help’ from the command line?

Maybe I wasn’t clear - all hassio calls (except help) fail. Hassio is unusable because the supervisor is unusable. Also, I was hoping to avoid flashing a new image if there is a way to repair this without that.

Perhaps you can ask in the Discord channels for Hassio and/or Dev.

(@frenck can perhaps point you in the right direction?)

Try deleting the HA database and restarting, I’ve had that get corrupted a few times after power cuts. You don’t lose anything.

Same for me since a couple of days.

  • Should I delete the database via afp?
  • How to restart safely since “hassio”-cmnds are not working?

No change - still get “parse error: expected string key before ‘:’ at line 1, column 4” or “401: Unauthorized”

I had a simulare thing happen. However it was after commenting out the “Discovery” option in configuration.yaml. I lost the sidebar listing for Hassio.

But I found a solution. Its was to add “hassio:” to the config, then it came back.

It a long shot I know but it resembled the problem I had.

Hope it helps.

That is not my situation. The sidebar is still there and works fine but “Hass.io” gets me “Unable to load the hass.io panel from the supervisor”. With no access to the hass.io I cannot reach the addons (ssh, samba, mosquito, and LetsEncrypt), and my encryption certificate expires in just over two weeks. When that happens, I will have no access via the web to home assistant at all, unless there’s a work around to turn encryption off

That did the trick! I just added “hassio:” to my configuration.yaml et voilá, the “Hass.io” button is back again.

But: I still can’t use any “hassio” ssh-command. It’s still saying “parse error: Expected string key before ‘:’ at line 1, column 4”. Therefore no save reboot is possible.

This doc

https://developers.home-assistant.io/docs/en/hassio_debugging.html

mentions you can access the docker command to access the supervisor

docker logs resin_supervisor

Perhaps you are able to use the docker command to view what’s going on or even restart the supervisor container?

BTW do this at your own risk!

I had the same problem a week back, but that was fixed by doing a reboot by disconnecting power to the Pi

I can reach the logs from docker. One hint might be:
“[homeassistant.components.hassio] /homeassistant/options return code 401.” in the log. Also:
“[homeassistant.components.hassio] /supervisor/options return code 401.”
These mirror the results from some hassio commands in the shell.

For me it changed nothing.

Now i get

pare error: Expected string key before ':' at line 1, column 4

or

401: Unauthorized

if i hit any “hassio […]” command per ssh

I am logging into the resinOS above the HA system and running docker commands.

I never got any answers (lots of suggestions that didn’t work but thanks to all who tried) to how to fix this problem, so I am running a new HA system on a Raspberry Pi 3 B+ using the install method from https://github.com/dale3h/hassio-installer. I had to go through and work out the bugs in MQTT and LetsEncrypt, and I still do not have ssh running, but the system otherwise seems to be working.

Did you ever find a fix for this issue? I’m only able to restart via the hass.io web section and not via the Command line. Getting similar error as you

hassio -d ha info
**Error decoding json invalid character ':' after top-level value: 401: Unauthorized**

I did some digging and the Supervisor docker image logs have this:

18-09-27 23:38:59 WARNING (MainThread) [hassio.api.security] No API token provided for 
/homeassistant/info

So it looks like the hassio command isn’t passing a proper API key to the supervisor…

Did anyone ever find a fix for this issue? I started facing it this morning and things seem to have gotten worse. At first I was able to log in through SSH and every time I tried running a hassio command I would get an error like
Error decoding json invalid character ':' after top-level value: 403: Forbidden

This morning I was unable to log into SSH, and the log of the SSH & Web Terminal addon shows:

[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Hass.io Add-on: SSH & Web Terminal v3.5.0
 SSH & Web Terminal access to your Home Assistant instance
parse error: Expected string key before ':' at line 1, column 4
ERROR: Unknown HTTP error occured
 From: 
parse error: Expected string key before ':' at line 1, column 4
ERROR: Unknown HTTP error occured
 By: 
-----------------------------------------------------------

So it’s not starting properly either. I looked at the logs and found this entry:

18-10-06 17:22:26 ERROR (MainThread) [hassio.api.security] Invalid token for access /addons

Which makes sense because trying to download a snapshot gives me a browser error that says:
Firefox can’t find the file at http://hassio:8123/api/hassio/snapshots/7eae17b5/download?api_password=undefined.

I think @ryanb33 is right in the API key issue but I have no idea where to start to try and fix it.

So… a few minutes after posting my above message I was able to fix the API key!

Random AF, but when I got the link to download the snapshot, I went into my local secrets file and put in the API password I had configured into the URL to download the snapshot.

http://hassio:8123/api/hassio/snapshots/7eae17b5/download?api_password=PASSWORD_HERE

The file downloaded and I thought nothing of it. Then I tried rebooting the SSH server again, and it worked! After that I SSH’d in and tried running a few hassio commands, and they also worked!

It seems like the API password was re-set and saved when I provided it through snapshot URL. Give that a shot guys, it might just work :slight_smile:

So I figured out what my issue was and I was missing the OS variable HASSIO_TOKEN due to modifying the default login shell. To check to see that you have this variable set, simply run this in the shell:
user@host$ echo $HASSIO_TOKEN