FS#75738 - [home-assistant] systemd unit is using DynamicUser=1 which dbus-daemon does not like. Bluetooth.

Attached to Project: Community Packages
Opened by Dustin A (dustovich) - Monday, 29 August 2022, 23:34 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:04 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Maxime Gauduin (Alucryd)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No


When using the Bluetooth integration in Home Assistant, it communicates using dBus. According to the systemd issue attached below dbus-daemon and DynamicUser=1 do not play nicely together, this causes the Bluetooth integration to fail. Switching over to dbus-broker solves the problem as is recommended in the issue. Recommend changing this package to create a proper user/group instead of using a systemd dynamic user.

Steps to reproduce:
Install home-assistant with standard arch installation which uses dbus-daemon. Try to enable bluetooth integration. Watch it fail.

Additional info:
home-assistant 1:2022.8.7-1


Logger: homeassistant.config_entries
Source: config_entries.py:388
First occurred: 10:33:22 PM (1 occurrences)
Last logged: 10:33:22 PM
Config entry 'Bluetooth' for bluetooth integration not ready yet: DBus connection broken: [Errno 32] Broken pipe; try restarting `bluetooth` and `dbus`; Retrying in background

Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/homeassistant/config_entries.py", line 357, in async_setup
result = await component.async_setup_entry(hass, self)
File "/usr/lib/python3.10/site-packages/homeassistant/components/bluetooth/__init__.py", line 261, in async_setup_entry
await manager.async_start(
File "/usr/lib/python3.10/site-packages/homeassistant/components/bluetooth/__init__.py", line 359, in async_start
await self.scanner.start() # type: ignore[no-untyped-call]
File "/usr/lib/python3.10/site-packages/bleak/backends/bluezdbus/scanner.py", line 128, in start
manager = await get_global_bluez_manager()
File "/usr/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 812, in get_global_bluez_manager
await instance.async_init()
File "/usr/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 295, in async_init
await bus.connect()
File "/usr/lib/python3.10/site-packages/dbus_next/aio/message_bus.py", line 177, in connect
return await future
File "/usr/lib/python3.10/site-packages/dbus_next/aio/message_bus.py", line 158, in on_hello
raise err
File "/usr/lib/python3.10/site-packages/dbus_next/aio/message_bus.py", line 365, in _message_reader
if self._unmarshaller.unmarshall():
File "/usr/lib/python3.10/site-packages/dbus_next/_private/unmarshaller.py", line 304, in unmarshall
File "/usr/lib/python3.10/site-packages/dbus_next/_private/unmarshaller.py", line 243, in _unmarshall
self.read(16, prefetch=True)
File "/usr/lib/python3.10/site-packages/dbus_next/_private/unmarshaller.py", line 89, in read
data = read_sock(missing_bytes)
File "/usr/lib/python3.10/site-packages/dbus_next/_private/unmarshaller.py", line 83, in read_sock
return self.stream.read(length)
File "/usr/lib/python3.10/socket.py", line 705, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [Errno 104] Connection reset by peer

This task depends upon

Closed by  Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:04 GMT
Reason for closing:  Moved
Additional comments about closing:  https://gitlab.archlinux.org/archlinux/p ackaging/packages/home-assistant/issues/ 1
Comment by Dustin A (dustovich) - Wednesday, 31 August 2022, 21:03 GMT
One other thing, slightly unrelated to the above but still related to the unit. Would it be possible to change from network.wants to network-online.wants to prevent some issues with network card detection and zeroconf errors.
Comment by Maxime Gauduin (Alucryd) - Tuesday, 13 September 2022, 08:02 GMT
I would be more inclined to optdep on dbus-broker instead of going back to a regular user, as that would require some postinstall steps to relocate exinsting installations from /var/lib/private/hass to /var/lib/hass.
Comment by Dustin A (dustovich) - Tuesday, 27 September 2022, 05:09 GMT
The other issue with the dynamic user is that you cannot 'su' into the hass user that I am aware of. This makes it a bit more difficult to install https://hacs.xyz/docs/setup/download. Not that these hurdles can't be overcome, it is just more of a pain.