Home Assistant - Cannot Restore Backup
Attempting to restore my Home Assistant Backup (either a local archive backup or cloud backup) results in the following error:
Is this a HA internal backup feature? /mnt/dietpi_userdata/homeassistant/deps is a symlink to the Python environment below /home/homeassistant/.pyenv. Not sure what exactly is aimed to be restored, but I guess not HA itself, and hence no Python modules? In that case, /mnt/dietpi_userdata/homeassistant/deps should be skipped. HA internally installs, up- or downgrades modules on service start based on installed integrations, hence restoring /mnt/dietpi_userdata/homeassistant/deps serves no functional need, as far as I can think of.
Yes it's from Home Assistant's built-in backup.
I have a local backup and a cloud-based backup that's sync'd to my Nani Casa account.
Neither one restores and stops with the same error.
The restore puts back settings, devices, automations etc. that were setup in the previous environment.
Try to extract some more details from journalctl -u home-assistant. I'll try to find the relevant code parts upstream:
- If the backup contains the Python environment from within
./depseven if that is a symlink, it should also restore the environment to the target of the symlink. - If it backs up the symlink as symlink, not its content, it should also restore that symlink ... though, that would break it as well if the Python version changed in the meantime from a
dietpi-software reinstall 157. - The preferred and IMO most reasonable behavior would be to skip
./depscompletely, since that is never required and has only the potential to break things, even without symlink: the Python version may have changed, which does not only change the symlink in our case, but generally means that most modules need to be recompiled. If one restores a backup from a time where the Python version was a different one, and it stores dependency modules, many of them will simply fail to function. The backup of course cannot restore the old Python version itself.
Since we use this symlink since years, the upstream change causing this must have been done very recently.
Try to extract some more details from
journalctl -u home-assistant.
There's a lot - more than the terminal screen can handle!!
Any way to dump it out to a file/filter it for certain terms you're looking for in particular?
If easier I can uninstall Home Assistant, reinstall again and attempt the restore so the logs are fresh?
Hi @MichaIng - let me know what you need for further analysis :)
I had the same when I was moving systems a few months ago, no matter what I tried it failed. I ended up doing a clean install then stopping the service and manually transferring over the whole folder from the backup via sftp and then rebooting and that restored it.
Somewhat related to the general concerns I have with deps being included in the backup: https://github.com/home-assistant/core/issues/130396
Python version and changed OS runtime libraries can break it, and restoring on a different system as aim to transfer the HA instance usually cannot work. When skipping deps, that should all be possible, with HA compiling all missing dependencies automatically, based on the loaded components.
I am travelling this weekend, but will try to check a few things:
- Is the backup an archive that can be extracted on the OS to check it's content? So we see how
depsis included and might be able to identify/narrow down the cause of the issue, i.e. whetherdepsis included as directory with content or as symlink. - If it is a symlink in the backup, does it work to replace that with a directory, repacking and then restoring that backup? If so is
/mnt/dietpi_userdata/homeassistant/depsa dir then, or still the previous symlink? This is more to see how the restoring behaves, whether it follows symlinks, or tries to replace them etc.
I've faced the same issue trying to migrate from HA installed on Raspberry PI to x86_64 PC. DietPI is installed on both systems.
If I extract homeassistant.tar.gz backup archive I see two folders: deps that is empty and deps_venv that is actually a symlink to /home/homeassistant/.pyenv/versions/3.13.1/lib/python3.13/site-packages
Will try to remove both from the archive and see what happens