Restore Snapshot from Hassio CLI

Hi there, I’m in bad trouble: I restarted HA and it is not starting again. I was trying to solve a konnected switch issue.

  • running Hassio on Raspberry PI 3 B+
  • Home assistant v0.94.4
    After restart:
  • No web interface
  • when connecting keyboard and hdmi to Raspberry PI 3, Hassio shows that is starting, to the point I can interact with HASSOS CLI.
  • tried to connect directly to computer with the ethernet cable, and calling ‘login’ command on hassos (after ‘root’ login) but nothing happend through 192.168.1.50:8123 or hassio.local:8123
  • I can see the last 4 snapshots that I made last week through the hassio snapshots command.
  • Samba was enable, but ssh is not working

How can I recovery my yaml files? or restore from the last snapshot?

I have a YEAR of work on those yaml files. I know. I shoud copy those snapshots…

HELP PLEASE!

Do you have Samba access to the files?

Assuming you do, before you do a restoration, have you checked your homeassistant.log file for any clues of what might be happening?

You should be able to access the snapshots through Samba. They will be in a tar file format. Expand them, and expand them again and again (they are comprised of multiple compressed files within one compressed file) until you get all of your files expanded. You can then just copy the files that have changed over the top of the ones causing the issues. Worst case, you could just delete all the files in your config directory and restore it from your backups, but please check the homeassistant.log file first …

I just re-read your post. So if I am reading correctly, you must be accessing the Hassio command line through a physical monitor and keyboard connected directly to your Pi. If you have access to the Hassio command line, you have everything you need.

hassio snapshots will list all of your snapshots. Take note of the “slug” for the snapshot you want to restore.

hassio snapshot restore -h will give you the parameters you need to pass to restore a given snapshot.

hassio snapshot restore [slug] will restore the snapshot in its totality. You may want to check the flags options available if you don’t want to do a complete restore.

Advice about checking your homeassistant.log still applies. No use doing a restore if it isn’t going to fix it.

Thanks for your help Andrew!

So a snapshot restore is an option. I have a lot of code work during last week that I will lost with totally restore. Is there an option to recovery the config yaml files? partial restore is an option here?

And I checked the home assistant log, until it stop recording logs, I did not find anything out of the ordinary. The only thing that caught my attention was that the configuration for the roku component had stopped working …

To be honest, the 3 times I have restored, it has been a complete snapshot restore due to SD card failure, upgrade to new Pi and then change of OS from ResinOS to HassOS. I haven’t done a partial restore, but I have untarred the files and replaced individual YAML files a few times when I have got myself in a jam and couldn’t back out any other way.

I would start with editing your config and commenting out the Roku component if that is what you think may have done the damage.

My best guess would be to run the restore command and use the -f flag with /config, but I am only having a stab in the dark …

I just want to thank you, I tried restoring from an update in the web interface and it did not work.
I had samba setup and was about to wipe and add the backups in until I saw your instructions to do it with the command line. This saved so much time

Glad it helped.

So other ppl don`t waste felt 4h sweating and trembling here is how you do it nowdays on home asistant on docker

You dont use it with hassio prefix. But rather only snapshot …


`snapshots`  will list all of your snapshots. Take note of the “slug” for the snapshot you want to restore.

`snapshot restore -h`  will give you the parameters you need to pass to restore a given snapshot.

`snapshot restore [slug]`  will restore the snapshot in its totality. You may want to check the  `flags`  options available if you don’t want to do a complete restore.
2 Likes

just seen this this will help me immensely THANK YOU

When I try to run “ha snapshot restore 3dd0c91a”, it says “Processing… Done.” and nothing changes. It does not restore anything. What can I do? My HA is down.

how long did you wait? Just because the CLI says DONE doesn’t mean it’s finished. It can take 30+ minutes to restore and restart.

Thank you for your suggestion. Yes, I waited long enough.

I found a way around the problem. I emptied /config/.storage/core.device_registry file and put only

{ }

in that file. After reboot, my GUI came back up and I was able to restore everything using my snapshot.

for those using HA (in docker config)… once you enter the hassio_cli container, you use the command ‘ha’ since ‘hassio’ doesn’t exist.

ha sn list
ha sn restore -h
ha sn restore

I am trying to restore from CLI but I can’t view my most recent backup slug since they all scroll by too quickly when I enter the list command. Can I view them 1 by 1 using an addon command?

try ha sn list | more

Have the same problem, my list is way to big and it just goes by and list | more didnt work. Trying to find a way to scroll up but control/shift/alt or a combination with arrows or pg up/down does nothing. This cli interface through hdmi output is not that easy.