Frontend: Snapshot upload not working

Created on 12 Oct 2020  路  16Comments  路  Source: home-assistant/frontend

The problem

I woud like to migrate my Hass installation to a new VM, so i made a snapshot, downloaded that one and now trying to restore it on the new VM. I can select the upload option, select the file, but after a while it gives back a 502 Bad Gateway error.

Environment

Latest and greatest version of HassOS OVA (4.13)

  • Operating environment (OS/Container/Supervised/Core): OS

Problem-relevant configuration.yaml

No configuration.yaml file yet as this is in the setup wizard

Traceback/Error logs

502 Bad Gateway

In core log :

ERROR (MainThred) [homeassistant.components.hassio.http] Client timeout error on API request snapshots/new/upload

Additional information

Backup is 1.34GB.

Most helpful comment

No need, all logs/errors have been removed in 0.118

All 16 comments

@ludeeus could you please move this to the supervisor repo? Thanks 馃槉

Sorry for posting it in the wrong one @springstan

Sorry for posting it in the wrong one @springstan

No worries 馃槃

Frontend is probably more fitting @springstan
502 is expected, that means the core is restarting, give it some time @dennisbrouwer91

@ludeeus : I've waited HOURSSS and it's still gaving bad gateway

I have this issue too. Tried importing a snapshot (from 112.4) onto a clean 116.2 install at the beginning of the wizard - 502 Bad Gateway. Created an account and completed the wizard, then tried uploading the same snapshot from the snapshot UI, and I get this in the log:

Client timeout error on API request snapshots/new/upload
This is in a VM on ESXi on an interface with a known working interface.

I have this issue too. Tried importing a snapshot (from 112.4) onto a clean 116.2 install at the beginning of the wizard - 502 Bad Gateway. Created an account and completed the wizard, then tried uploading the same snapshot from the snapshot UI, and I get this in the log:

Exactly same result when try to move config to new hardware.

How i fixed it : Finish the setup wizard, install the SMB plugin, copy the backup and then do a restore from the snapshots page. That works fine!

I belie it is caused by size of a backup file. It will probably timeout before image is uploaded.

I just been able to restore 22MB backup (basicaly just config). It will alow you to restore into "minimal" installation. And then upload larger backup using rsync, scp or smb share and restore it.

This needs to be reopened, it is certainly not fixed. [as of HA 0.117.2]

I spent the morning trying to restore snapshots on hassio 4.15, none of them are restorable...
Received the same message "502 Bad Gateway" everytime w/ Client timeout error on API request snapshots/new/upload showing in the docker logs homeassistant output.

My first try was a 560MB snapshot of which Home Assistant config tarball took 278MB and Open Z-wave tarball took up 164MB of that space. Failed.

I switched to partial backup, dropped Open Z-wave out, ran recorder.purge w/ {"keep_days":"31", "repack":"true"} to shrink my home-assistant_v2.db from 12GB down to 1 GB and managed to produce a snapshot at 266MB. Failed.

The only scenario this seems to work is backing up and restoring an empty virgin configuration of Home Assistant. :\

Here are some suggestions:

  • [ ] test the code with a reasonably large home-assistant configuration / history database snapshot
  • [ ] if there are limitations to the size consider warning users that the snapshots produced will not be usable
  • [ ] handle the error on upload and error out more gracefully (maybe check the size on the client side prior to sending it)
  • [ ] offer a configuration option to drop historical data home-assistant_v2.db during the backup to reduce size

Painful workaround to get a ~400MB snapshot restored on a fresh HassOS install:

  1. create a full snapshot; if you make a partial even if it contains HomeAssistant config supervisor will reject it 20-11-02 20:33:21 ERROR (MainThread) [supervisor.snapshots] 4a386787 is only a partial snapshot!
  2. Connect a screen and keyboard to the raspberry pi and hit enter to get a login prompt
  3. Login w/ root (no password), type login at the ha> prompt
  4. dropbear -B -R start ssh to remote in [email protected] (repeat step 3 when you connect to get shell)
  5. docker exec -i -t homeassistant scp me@myworkstation:Downloads/backup_snapshot.tar . (scp is broken on HassOS /usr/bin/dbclient missing; can't cp dropbear to /usr/bin/dbclient because squashfs / is RO)
  6. mv /mnt/data/supervisor/homeassistant/*.tar /mnt/data/supervisor/backup/
  7. ha snapshots reload
  8. Shutdown your old home assistant instance (don't know if this is required)
  9. ha snapshots restore $(ha snapshots | grep slug | cut -d: -f2)

Open another ssh connection, do step 3 and then run docker logs -f hassio_supervisor to watch restoration do it's thing; this can take a long time on an RPi4.

20-11-02 20:46:12 INFO (MainThread) [supervisor.snapshots] Full-Restore f941c8fd start
....
20-11-02 21:09:31 INFO (MainThread) [supervisor.snapshots] Full-Restore f941c8fd done

Done! 馃槃

This is indeed still broken, just tried on a brand-new installation!

Just doing this today (after the n-th time an SD card failed me) and finding out this is definitely still a problem. I got the Bad Gateway message on a 300MB restore with a fresh install of 4.15. Thank you @deftdawg, your instructions saved my day.

@ludeeus Can this be reopened or should we spin up a duplicate to track this issue?

No need, all logs/errors have been removed in 0.118

Still having the same issue on Home Assistant 0.118.4 on a raspberry pi 3 running on raspberry pi OS using supervised install.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

move[bot] picture move[bot]  路  3Comments

martinhoess picture martinhoess  路  3Comments

Fusseldieb picture Fusseldieb  路  4Comments

TheZoker picture TheZoker  路  3Comments

casperklein picture casperklein  路  4Comments