Hass.io loosing data after reboot

I configured hass.io for remote shutdown like described here

working fine, until i need to restart hassio/raspberry, then the keys are gone. So i think hass.io is reseting the root folder where the keys are stored after reboot. How or where can i store this files so they get not removed after reboot.

Same problem with fingerprint on ssh connection. First time hassio ask for adding the fingerprint of the ssh connecting, but next time it asks again.

I can not use shell_command for remote shutdown when ssh keys and fingerprint getting lost after reboot. Sure if no reboot it is ok, but sometimes the restart hangs and i need to reboot the machine.

Am i the only one with that problems? Can anyone help please?

I’m quite positive that this is a bug. SSH known hosts keys are stored in the container, which after reboot is “reset”.

You can probably work around this by using ssh -o StrictHostKeyChecking=no hass@TARGET sudo pm-suspend

The second issue with the SSH add-on is kind of the same problem, but this time it is specifically an issue in the add-on.

1 Like

The SSH addon is working well for me (hass.io 0.51.2). It stores keys in the /data directory (see here) which is persisted to the docker host (addon doc).

1 Like

@powdahound You are right and wrong, just like I was in my last message.

Host keys e.d. are indeed stored in the /data folder.

However, the known_hosts file is not persisted. That is where the issue is.

Ah, that is true. But in the run script you can see that ~/.ssh/known_hosts it is populated from the addon’s config when the SSH container boots up (code). So the fix is to add your public key string to the addon config.

It is working now with this line, after storing the key into the data folder and pointing to it for moving the key from here to target and for ssh connection it works fine, thanks guys.

ssh -i /data/.ssh/id_rsa -o StrictHostKeyChecking=no [email protected]

1 Like

Sorry @powdahound The code you are referencing is not about the known_hosts but it about the authorized_keys…
Those are two different things.

1 Like

@skycryer I’m happy you found a workaround :slight_smile:

Yeah but no i have the next problem, running the line direct in hassio over terminal works but when using as shell_command in home assistant config it is not running, no idea why. Tried to find the logs but hassio says docker not found. https://home-assistant.io/developers/hassio/debugging/

Oops! You’re right. I was reading too quickly. :slight_smile: I’m still not having the issue reported by the original poster though, so not sure what’s different for me.

will we see a fix for this?