Failure to create backup FileNotFoundError on zigbee.db-journal

First off, a huge thank you to the community. I’ve been pouring over all kinds of home assistant topics over the last couple of weeks to get my system transferred from SmartThings to Home Assistant and this community has been a huge help. Everything is working and I couldn’t be happier…

I tried to create a backup and it is failing. I’m running hass 2022.2.9 on a Pi4 with a HUSBZB-1 USB zigbee/z-wave stick. I’m running the standard zha integration (NOT zigbee2mqtt).

22-03-01 07:22:27 INFO (MainThread) [supervisor.backups.manager] Creating new full backup with slug ec61cd69
22-03-01 07:22:27 INFO (MainThread) [supervisor.backups.manager] Backing up ec61cd69 store Add-ons
22-03-01 07:22:27 INFO (MainThread) [supervisor.addons.addon] Building backup for add-on core_ssh
22-03-01 07:22:27 INFO (MainThread) [supervisor.addons.addon] Finish backup for addon core_ssh
22-03-01 07:22:27 INFO (MainThread) [supervisor.addons.addon] Building backup for add-on core_zwave_js
22-03-01 07:22:34 INFO (MainThread) [supervisor.addons.addon] Finish backup for addon core_zwave_js
22-03-01 07:22:35 INFO (MainThread) [supervisor.homeassistant.module] Backing up Home Assistant Core config folder
22-03-01 07:25:04 ERROR (MainThread) [supervisor.backups.manager] Backup ec61cd69 error
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/backups/manager.py", line 149, in _do_backup
    await backup.store_homeassistant_config_dir()
  File "/usr/src/supervisor/supervisor/backups/backup.py", line 486, in store_homeassistant_config_dir
    await self.sys_homeassistant.backup(homeassistant_file)
  File "/usr/src/supervisor/supervisor/homeassistant/module.py", line 330, in backup
    await self.sys_run_in_executor(_write_tarfile)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/supervisor/supervisor/homeassistant/module.py", line 321, in _write_tarfile
    atomic_contents_add(
  File "/usr/src/supervisor/supervisor/utils/tar.py", line 180, in atomic_contents_add
    tar_file.add(directory_item.as_posix(), arcname=arcpath, recursive=False)
  File "/usr/local/lib/python3.9/tarfile.py", line 1963, in add
    tarinfo = self.gettarinfo(name, arcname)
  File "/usr/local/lib/python3.9/tarfile.py", line 1842, in gettarinfo
    statres = os.lstat(name)
FileNotFoundError: [Errno 2] No such file or directory: '/data/homeassistant/zigbee.db-journal'

Hi,

Did you find a solution for your backup problem - I face the same issues now running hass 2022.3.7

/Kristian

I managed to work around this issue. Looking at bit into things, it turns out that the -journal file is the SQLite transaction file for the zigbee database. It was written and removed quite often. The backup thinks it should be backed up as it is in the config folder, but it is removed again before it could be backed up - this makes the backup fail… The quick work around was simply to remove the zigbee usb adapter while making the backup as nothing is then changed in the zigbee database.

When I restored the backup on my new Raspberry Pi 4, everything worked right away. The strange thing is that on this new installation I never see the -journal file and backup is working again.

/Kristian

That explains a lot! Kind of frustrating, it should just issue a warning about the missing file rather than actually fatal. I added on a package that automatically creates backups and uploads them to my Google Drive. More often than not it is successful (no errors during backup) so I kind of forgot about this open issue. Thanks for the workaround.