Backups failing - bad file descriptor

Hi,

Ever since the 2025.1.0 release all my backups are failing This is on both my test and production system. The test system runs bare metal and the production one is a ProxMox VM. It doesn’t matter if I try to backup to the samba share or try local. Prior to this it all worked fine.

I’ve tried disabling the encryption but that didn’t work. Anyone who knows how to fix this?

My HA info:

  • Core 2025.2.5
  • Supervisor 2025.02.1
  • Operating System 14.2
  • Frontend 20250221.0

And in the supervisor log I get these error messages:

2025-02-25 20:13:33.233 INFO (MainThread) [supervisor.backups.manager] Backup 472f9e2f starting stage addon_repositories
2025-02-25 20:13:33.234 INFO (MainThread) [supervisor.backups.manager] Creating new partial backup with slug 472f9e2f
2025-02-25 20:13:33.239 INFO (MainThread) [supervisor.backups.manager] Backup 472f9e2f starting stage home_assistant
2025-02-25 20:13:38.613 INFO (MainThread) [supervisor.homeassistant.module] Backing up Home Assistant Core config folder
2025-02-25 20:13:44.288 ERROR (MainThread) [supervisor.homeassistant.module] Can't backup Home Assistant Core config folder: [Errno 9] Bad file descriptor
2025-02-25 20:13:44.292 ERROR (MainThread) [supervisor.backups.manager] Backup 472f9e2f error
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/homeassistant/module.py", line 436, in _write_tarfile
    atomic_contents_add(
    ~~~~~~~~~~~~~~~~~~~^
        backup,
        ^^^^^^^
    ...<2 lines>...
        arcname="data",
        ^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/securetar/__init__.py", line 553, in atomic_contents_add
    return _atomic_contents_add(tar_file, origin_path, file_filter, arcname)
  File "/usr/local/lib/python3.13/site-packages/securetar/__init__.py", line 574, in _atomic_contents_add
    _atomic_contents_add(tar_file, directory_item, file_filter, item_arcname)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/securetar/__init__.py", line 574, in _atomic_contents_add
    _atomic_contents_add(tar_file, directory_item, file_filter, item_arcname)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/securetar/__init__.py", line 574, in _atomic_contents_add
    _atomic_contents_add(tar_file, directory_item, file_filter, item_arcname)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  [Previous line repeated 1 more time]
  File "/usr/local/lib/python3.13/site-packages/securetar/__init__.py", line 577, in _atomic_contents_add
    tar_file.add(directory_item.as_posix(), arcname=item_arcname, recursive=False)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/tarfile.py", line 2241, in add
    self.addfile(tarinfo, f)
    ~~~~~~~~~~~~^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/tarfile.py", line 2272, in addfile
    copyfileobj(fileobj, self.fileobj, tarinfo.size, bufsize=bufsize)
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/tarfile.py", line 253, in copyfileobj
    dst.write(buf)
    ~~~~~~~~~^^^^^
  File "/usr/local/lib/python3.13/site-packages/isal/igzip.py", line 213, in write
    self.fileobj.write(self.compress.compress(data))
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 9] Bad file descriptor
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/homeassistant/module.py", line 445, in backup
    await self.sys_run_in_executor(_write_tarfile)
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/supervisor/supervisor/homeassistant/module.py", line 414, in _write_tarfile
    with tar_file as backup:
         ^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/securetar/__init__.py", line 434, in __exit__
    super().__exit__(exc_type, exc_value, traceback)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/securetar/__init__.py", line 223, in __exit__
    self._tar.close()
    ~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/tarfile.py", line 2031, in close
    self.fileobj.close()
    ~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/gzip.py", line 359, in close
    fileobj.write(self.compress.flush())
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 9] Bad file descriptor
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/backups/backup.py", line 482, in create
    yield
  File "/usr/src/supervisor/supervisor/backups/manager.py", line 476, in _do_backup
    await backup.store_homeassistant(
    ...<3 lines>...
    )
  File "/usr/src/supervisor/supervisor/jobs/decorator.py", line 312, in wrapper
    raise err
  File "/usr/src/supervisor/supervisor/jobs/decorator.py", line 304, in wrapper
    return await self._method(obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/backups/backup.py", line 824, in store_homeassistant
    await self.sys_homeassistant.backup(homeassistant_file, exclude_database)
  File "/usr/src/supervisor/supervisor/jobs/decorator.py", line 312, in wrapper
    raise err
  File "/usr/src/supervisor/supervisor/jobs/decorator.py", line 304, in wrapper
    return await self._method(obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/homeassistant/module.py", line 448, in backup
    raise HomeAssistantBackupError(
    ...<2 lines>...
    ) from err
supervisor.exceptions.HomeAssistantBackupError: Can't backup Home Assistant Core config folder: [Errno 9] Bad file descriptor
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/tarfile.py", line 2022, in close
    self.fileobj.write(NUL * (BLOCKSIZE * 2))
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 9] Bad file descriptor
During handling of the above exception, another exception occurred:
OSError: [Errno 9] Bad file descriptor
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/backups/manager.py", line 472, in _do_backup
    async with backup.create():
               ~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/contextlib.py", line 235, in __aexit__
    await self.gen.athrow(value)
  File "/usr/src/supervisor/supervisor/backups/backup.py", line 481, in create
    with self._outer_secure_tarfile as outer_tarfile:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/securetar/__init__.py", line 223, in __exit__
    self._tar.close()
    ~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/tarfile.py", line 2031, in close
    self.fileobj.close()
    ~~~~~~~~~~~~~~~~~~^^
OSError: [Errno 5] I/O error
  File "/usr/src/supervisor/supervisor/backups/backup.py", line 481, in create
    with self._outer_secure_tarfile as outer_tarfile:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/securetar/__init__.py", line 223, in __exit__
    self._tar.close()
    ~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/tarfile.py", line 2031, in close
    self.fileobj.close()
    ~~~~~~~~~~~~~~~~~~^^
OSError: [Errno 5] I/O error