Unknown error when creating back-ups

Hello all, I’m hoping someone can point me in the right direction. When I try to create back-ups manually from the Settings -> System -> Backups menu I’m getting an Unknown Error.

When I look in the log I see:

2023-04-16 09:47:07.283 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [546959012912] Error handling message: Unknown error (unknown_error) User from 192.168.1.233 (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/backup/websocket.py", line 70, in handle_create
    backup = await manager.generate_backup()
  File "/usr/src/homeassistant/homeassistant/components/backup/manager.py", line 190, in generate_backup
    size_in_bytes = await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/backup/manager.py", line 241, in _mkdir_and_generate_backup_contents
    atomic_contents_add(
  File "/usr/local/lib/python3.10/site-packages/securetar/__init__.py", line 179, in atomic_contents_add
    tar_file.add(directory_item.as_posix(), arcname=arcpath, recursive=False)
  File "/usr/local/lib/python3.10/tarfile.py", line 2002, in add
    self.addfile(tarinfo, f)
  File "/usr/local/lib/python3.10/tarfile.py", line 2030, in addfile
    copyfileobj(fileobj, self.fileobj, tarinfo.size, bufsize=bufsize)
  File "/usr/local/lib/python3.10/tarfile.py", line 256, in copyfileobj
    raise exception("unexpected end of data")
OSError: unexpected end of data

There is a .tar getting created, but it’s only 10240 bytes which I believe is the minimum size for a tar. Also when I try to de-compress it, there’s nothing there.

~/web_services/home_assistant/home_assistant_config/backups > ls -l 23e07b68.tar 
-rw-r--r-- 1 root root 10240 Apr 16 09:47 23e07b68.tar

A little bit about my system:

  • Running in a docker-container on a Raspberry Pi 3
  • Running Home Assistant 2023.4.1 w/ Frontend 20230406.1 - latest
  • Otherwise, home assistant is functioning totally normally and working

I’m not totally sure how to troubleshoot this or where to go so any advice is much appreciated. Thanks!

Update to 2023.4.4 first.

Will do, I didn’t realize that new releases occur on the first Wednesday of every month.

Has something changed in terms of the HA database, maybe that’s the problem.

Okay, I updated to 2023.4.4 and am still seeing the same error. Any idea how I would check if something about the HA database changed? I haven’t consciously or intentionally changed anything.

1 Like

Logger: homeassistant.components.websocket_api.http.connection
Source: components/backup/manager.py:244
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 6:07:48 PM (3 occurrences)
Last logged: 6:10:05 PM

[140706646999952] Error handling message: Unknown error (unknown_error) GOUKI from 192.168.1.1 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36)

Traceback (most recent call last): File “/var/packages/HomeAssistant/target/lib/python3.11/site-packages/homeassistant/components/websocket_api/decorators.py”, line 26, in _handle_async_response await func(hass, connection, msg) File “/var/packages/HomeAssistant/target/lib/python3.11/site-packages/homeassistant/components/backup/websocket.py”, line 70, in handle_create backup = await manager.generate_backup() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/var/packages/HomeAssistant/target/lib/python3.11/site-packages/homeassistant/components/backup/manager.py”, line 192, in generate_backup size_in_bytes = await self.hass.async_add_executor_job( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/var/packages/python311/target/lib/python3.11/concurrent/futures/thread.py”, line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/var/packages/HomeAssistant/target/lib/python3.11/site-packages/homeassistant/components/backup/manager.py”, line 244, in _mkdir_and_generate_backup_contents atomic_contents_add( File “/var/packages/HomeAssistant/target/lib/python3.11/site-packages/securetar/init.py”, line 191, in atomic_contents_add tar_file.add(directory_item.as_posix(), arcname=arcpath, recursive=False) File “/var/packages/python311/target/lib/python3.11/tarfile.py”, line 2001, in add with bltn_open(name, “rb”) as f: ^^^^^^^^^^^^^^^^^^^^^ PermissionError: [Errno 13] Permission denied: ‘/var/packages/HomeAssistant/home/.homeassistant/configuration.yamlback’

same issue of “unknow error” when try creating a backup

I had the same.
With me the error occurred because in config folder there was a folder/file which could not be read. In my case .bash_history.
With chmod a+r .bash_history i gave everyone read permission. Now backups works.

1 Like

I can confirm the cause and the cure (2023.11.3).
My file with wrong permissions was:

/home/homeassistant/.homeassistant/data/.storage/onboarding