DietPi icon indicating copy to clipboard operation
DietPi copied to clipboard

Home Assistant - Cannot Restore Backup

Open Dynamic5912 opened this issue 3 months ago • 9 comments

Attempting to restore my Home Assistant Backup (either a local archive backup or cloud backup) results in the following error:

Image

Dynamic5912 avatar Sep 16 '25 19:09 Dynamic5912

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.

MichaIng avatar Sep 16 '25 19:09 MichaIng

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.

Dynamic5912 avatar Sep 16 '25 20:09 Dynamic5912

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 ./deps even 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 ./deps completely, 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.

MichaIng avatar Sep 16 '25 21:09 MichaIng

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?

Dynamic5912 avatar Sep 18 '25 12:09 Dynamic5912

If easier I can uninstall Home Assistant, reinstall again and attempt the restore so the logs are fresh?

Dynamic5912 avatar Sep 18 '25 13:09 Dynamic5912

Hi @MichaIng - let me know what you need for further analysis :)

Dynamic5912 avatar Sep 21 '25 13:09 Dynamic5912

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.

mdr92 avatar Sep 24 '25 01:09 mdr92

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 deps is included and might be able to identify/narrow down the cause of the issue, i.e. whether deps is 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/deps a 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.

MichaIng avatar Sep 26 '25 16:09 MichaIng

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

steals avatar Dec 02 '25 19:12 steals