Restoring snapshot doesn't do anything

I have been pulling out (what’s left of) my hair over the last few weeks trying to restore from a backup. Everything was working fine until one morning at the end of March when Home Assistant no longer responded. Luckily I’ve been using the Google Drive backup to take a full snapshot every three days.

Every time I attempt to restore from the snapshot, as soon as I click the “Restore” button, the screen shows “Restoring from Backup” for about one second and then just refreshes the onboarding page as if nothing happened.

Here’s what I have attempted (restoring from HA version 2021.3.3):

  • Flashed same SD card w/ Hassio 5.13 and attempted to restore on the same RPI 3
  • Flashed brand new SD card w/ Hassio 5.13 and attempted to restore on the same RPI 3
  • Flashed same SD card w/ Hassio 5.13 and attempted to restore on the different RPI 3
  • Flashed brand new SD card w/ Hassio 5.13 and attempted to restore on the different RPI 3
  • I’ve attempted all of these scenarios with four or five different backup .tar files each
  • Attempted clicking “Restore Everything” and “Restore Selected” (with everything checked)
  • And I’ve repeated all of these attempts with Hassio 5.12 just in case

After reading several similar posts on the forums, I’ve also tried waiting overnight to give the backup plenty of time to do its thing just in case the UI just wasn’t showing the work in progress. Still no luck.

I haven’t been able to access the log files because it’s a fresh HASSIO install and SSH and/or Samba Share have not been installed/restored.

Anyone have any ideas? I desperately want to restore and not start over.

So I moved forward by creating an account and completing the onboarding just so that I could access the log. Here are the error messages.

2021-04-10 14:20:13 WARNING (Recorder) [homeassistant.components.recorder.migration] Database is about to upgrade. Schema version: 13
2021-04-10 14:20:18 ERROR (MainThread) [homeassistant.config_entries] Error importing platform config_flow from integration hassio to set up hassio configuration entry: No module named 'homeassistant.components.hassio.config_flow'
2021-04-10 14:20:32 WARNING (MainThread) [homeassistant.components.webhook] Received message for unregistered webhook a22db625d25b446aa51842ae16b9b22843cd570c131c6f3562eba80af8b2c17e from 192.168.86.30
2021-04-10 14:23:41 WARNING (zeroconf-Engine-241) [zeroconf] Choked at offset 0 while unpacking b'\n\xba\x10\x00'
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/zeroconf/__init__.py", line 743, in __init__
self.read_header()
File "/usr/local/lib/python3.8/site-packages/zeroconf/__init__.py", line 780, in read_header
) = self.unpack(b'!6H')
File "/usr/local/lib/python3.8/site-packages/zeroconf/__init__.py", line 767, in unpack
info = struct.unpack(format_, self.data[self.offset : self.offset + length])
struct.error: unpack requires a buffer of 12 bytes

Any idea what I might be doing wrong?

After attempting a restore from the Snapshots view, only one warning and one error are shown. So it must be related to the following:

2021-04-12 14:57:44 WARNING (Recorder) [homeassistant.components.recorder.migration] Database is about to upgrade. Schema version: 13
2021-04-12 14:57:50 ERROR (MainThread) [homeassistant.config_entries] Error importing platform config_flow from integration hassio to set up hassio configuration entry: No module named 'homeassistant.components.hassio.config_flow'

I would try doing a restore, but uncheck the first checkbox - the option to restore Home Assistant itself (Core). 2021.4 included a database upgrade, and that may be related to your issue. If that works you could restart Home Assistant and let it auto-detect the newest version of Core available and perform the upgrade. You can also revert to any previous version of Core by running one of the following commands in the Terminal window:
ha core update --version=2021.3.1
ha core update --version=2021.3.2
ha core update --version=2021.3.3
ha core update --version=2021.3.4
ha core update --version=2021.4.1
ha core update --version=2021.4.2
ha core update --version=2021.4.3

Thanks for the suggestion! I tried it but had no luck. After running the terminal command to revert to 2021.3.3, upon reboot the onboarding page appears and refreshes in a constant loop. Very strange.

I’m wondering if this is a new bug introduced by the database upgrade in 2021.4. Perhaps restoring a snapshot from a previous version fails due to this.

Next I’ll try to find a way to get a clean install of 2021.3.3. Not sure how to go about that yet.

I’m back up and running, but it wasn’t pretty. After extracting the files in my snapshots, I noticed two problems. One, most of my configuration files (even configuration.yaml itself) were missing even though I was doing full snapshots. Two, the snapshots included and old, corrupt database file that I had just never deleted from the RPI. I’m thinking that might be the database conversion error, and of course not having all the .yaml files had to play a role as well.

I found an older snapshot that had all the missing files. I extracted them from the .tar file and then copied them over to the RPI using Samba Share after a clean install with the latest Home Assistant core. To my surprise, everything came up and just started working. :grinning:

Oh man… i just had the same problem and I don’t have an old snapshot, just the later ones from google drive… =(

Is it just me or is HomeAssistant Snapshots a false hope of reassurance when it comes to backups. My snapshots are all working with all files there but after a restore the WebUI just never comes up. I’m going to try fresh install and only copy the config files excluding the DB as Ive tried copying everything and then it just does the same as the snapshot restore.

2 Likes

Same here. Also: if it install HAOS 7.1 on a fresh new SD card, the “preparing” will never end until I connect internet again. And connecting internet will mean that HAOS will auto-update to the latest core and supervisor, rendering useless the backup restore process, since 2022.3.3 since to have a lot of issues doing so. I’m totally stuck with no solution.
It’s really unbelievable that I cannot restore a (ie) December 21 backup on a December HAOS release (7.1 for example) without incurring in an auto-update that would rendere everything useless.
Also: you can rollback the core to a previous version, but can’t do so with supervisor.

1 Like

Same here. I struggling with this for more that a week now. The restore just does’nt do anything. I tried 3 different USB sticks and several older release from Hass (7.1 & 7.0). I have the same issue on both a RPi 3 & 4. I’m going to try the solution from fenster24. I’ll keep you posted.

Restoring from backup snapshots certainly isn’t a user-friendly experience. I think what ultimately allowed my restore to succeed was manually restoring all the files except the database.

If this turns out to be the solution for anyone else, perhaps a new feature request would be to add a new option during a restore to exclude the old database (and any other DBs in the snapshot) and start a new DB from scratch. I think at this point in failed restore efforts, everyone else would be more than willing to lose their device history just to get the system up and running again with the configuration they spent so long customizing to their needs.

1 Like

OK, this seems to work. Thanks

1 Like

Glad it worked! I’ve created a feature request to start with a new DB during the restore process here. If anyone else experiences the same problem, please jump over and add a vote.

https://community.home-assistant.io/t/add-option-to-start-with-a-new-db-from-restore-dont-restore-backed-up-db/402156

Hi, I’ve failed to restore a backup to VM instance that crapped itself a few days ago. I’ve tried using the latest vm/ova image and see on GitHub that many are struggling to restore on the recent ha os. Does anyone know where I can download older versions of the ova image 7.1 or 7.2 with core 2022.3.1? Thanks

You can exclude the database from being inside your backups if you want. Won’t help with existing backups but helps for the future. Also the backups size decreases dramatically.
It’s not native but let me know if this is what you want to do.

I spent very much time but nothing works. Snapshot is very very bad.

Snapshot backups have never let me down.

I have a Backup on my RPI 4 and would it use on my Intel NUC with Windows and Home Assistant in VirtualBox but nothing do ifI use the snapshot to restore. I have do another snapshot but still nothing do.

You are lucky. I cannot get any to restore on a newly built HA OS install.

The big issue which HA has never addressed is that you cannot ever reliably do a file-level snapshot on a running database, be it SQLite or Postgres/Timescale or MariaDB or whatever. You’re almost certainly guaranteed to create at least a partially broken backup, and you can also break the running database. A config-only backup without any history isn’t much of a backup at all for those of us primarily using HA for monitoring basic stuff. The core team still haven’t seen any pressing need to add hooks into the backup process to trigger a proper db dump, so the entire backup/restore process is just fundamentally broken. It’s weird!