How to get bluetooth dongle visible into openhab container?


I have been running openhab for a while in container. Now I thought I add BT dongle to my apu2 board, and let OH use it. I’d like to pass the bluetooth dongle (CSR 4.0) to container space. There is an option like --device and --privileged for docker, but what would the device be in USB dongle case? There is no device like ttyUSB0, as this is not serial device.

How can I pass bluetooth dongle as device to openhab, not running it too privileged?

I aim to use ruuvitag for temp and hum, bluetooth info for proximity, and flic button or similar for action buttons. Any tips on those also welcome :slight_smile:

The best I can find is to run with --net=host --privileged.


Haha, I totally forgot the subject. Now getting back to it. Yes, thanks @rlkoshak, I do get BT device visibility if I loosen up lot of security in the container by letting it use host network stack and running it with all root privileges.

However, even for academic interest, if one would want to run it truly containerized, in it’s own namespace like containers are run nowadays, how would it get done?

Somehow you’d need to pass the USB device into container, and run dbus in there to get bluez going. I tried to achieve this by doing --device to allocate usb device to container. But lt wasn’t enough:

sudo podman run --name ubi-init -ti -h ubi-init --device /dev/bus/usb/001/002 ubi8-init:latest

I tried it with container that has init system built in. I also installed bluez into it. But it won’t see the BT with “hcitool dev”. BTW, the OH container doesn’t seem to have bluez in it for such a case.

Has anyone done this, or is everyone just running it unrestricted?

As far as I can tell, the answer is still “you can’t.”

1 Like