Pass bluetooth to LXC container

X4V1

New Member
Feb 5, 2024
15
3
3
Hello,

I'm trying to setup bluetooth for one of my LXC container. I found many threads on the forum (like this one) but I don't understand how I could know which /dev/tty* I have to refer to. I have no "/dev/ttyUSBXXX" and/or "/dev/ttyACMEXXX" in my system (proxmox ve 8.1.4).


this what I have in my /dev folder:
Code:
autofs           i2c-6            snd/             tty45            ttyS29
block/           i2c-7            stderr           tty46            ttyS3
bsg/             initctl          stdin            tty47            ttyS30
btrfs-control    input/           stdout           tty48            ttyS31
bus/             kmsg             tpm0             tty49            ttyS4
cec0             kvm              tpmrm0           tty5             ttyS5
char/            log              tty              tty50            ttyS6
console          loop0            tty0             tty51            ttyS7
core             loop1            tty1             tty52            ttyS8
cpu_dma_latency  loop2            tty10            tty53            ttyS9
cuse             loop3            tty11            tty54            udmabuf
disk/            loop4            tty12            tty55            uhid
dm-0             loop5            tty13            tty56            uinput
dm-1             loop6            tty14            tty57            urandom
dm-10            loop7            tty15            tty58            userfaultfd
dm-11            loop-control     tty16            tty59            userio
dm-12            mapper/          tty17            tty6             vcs
dm-13            mcelog           tty18            tty60            vcs1
dm-14            mei0             tty19            tty61            vcs2
dm-15            mem              tty2             tty62            vcs3
dm-2             mqueue/          tty20            tty63            vcs4
dm-3             mtd0             tty21            tty7             vcs5
dm-4             mtd0ro           tty22            tty8             vcs6
dm-5             net/             tty23            tty9             vcsa
dm-6             ng0n1            tty24            ttyprintk        vcsa1
dm-7             null             tty25            ttyS0            vcsa2
dm-8             nvme0            tty26            ttyS1            vcsa3
dm-9             nvme0n1          tty27            ttyS10           vcsa4
dma_heap/        nvme0n1p1        tty28            ttyS11           vcsa5
dri/             nvme0n1p2        tty29            ttyS12           vcsa6
drm_dp_aux0      nvme0n1p3        tty3             ttyS13           vcsu
drm_dp_aux1      nvram            tty30            ttyS14           vcsu1
drm_dp_aux2      port             tty31            ttyS15           vcsu2
ecryptfs         ppp              tty32            ttyS16           vcsu3
fb0              psaux            tty33            ttyS17           vcsu4
fd/              ptmx             tty34            ttyS18           vcsu5
full             ptp0             tty35            ttyS19           vcsu6
fuse             pts/             tty36            ttyS2            vfio/
hpet             pve/             tty37            ttyS20           vga_arbiter
hugepages/       random           tty38            ttyS21           vhci
hwrng            rfkill           tty39            ttyS22           vhost-net
i2c-0            rtc              tty4             ttyS23           vhost-vsock
i2c-1            rtc0             tty40            ttyS24           watchdog
i2c-2            sda              tty41            ttyS25           watchdog0
i2c-3            sg0              tty42            ttyS26           zero
i2c-4            shm/             tty43            ttyS27           zfs
i2c-5            snapshot         tty44            ttyS28

should I install bluez on the host to make the adapter visible in /dev ?

Also I read in another thread that it's not possible to pass bluetooth to a lxc container, is this statement correct and still true ?

Any hint would be really appreciated as it seems to be an issue for a lot of people.

I have a HP elitedesk 800 G5 mini (with the ax200 bluetooth module).
 
Last edited:
should I install bluez on the host to make the adapter visible in /dev ?
Yes, install bluez on the host.

If you do not find the path to device node in /dev, list the devices with hcitool dev or try to search in /sys/devices/
Code:
find /sys/devices/ -name "*bluetooth*"

Also I read in another thread that it's not possible to pass bluetooth to a lxc container, is this statement correct and still true ?
It is possible to pass a bluetooth device to an LXC container. Just add a dev[n] entry to the container config:
Code:
pct set <vmid> --dev0 path=/path/to/bluetooth/adapter
 
Last edited:
  • Like
Reactions: X4V1
@fschauer Thank you for your help :) it's really appreciated !

I checked before installing bluez:
Code:
find /sys/devices/ -name "*bluetooth*"
/sys/devices/platform/soc/fe201000.serial/serial0/serial0-0/bluetooth

Does that mean that I don't need bluez?

What I don't understand is why do we need the host to install bluez if the bluetooth is not used by the host.
Isn't it possible to simply "pass" the device to the lxc container and let the container use it the way it needs ?
Won't it cause conflicts if the host and the container tries to access the bluetooth device ?
 
Does that mean that I don't need bluez?
You probably do not need it. It just provides some useful tools to manage bluetooth devices.

Won't it cause conflicts if the host and the container tries to access the bluetooth device ?
This would be a problem if the device were to be passed to a VM. Containers on the other hand share resources with the host.
 
You probably do not need it. It just provides some useful tools to manage bluetooth devices.


This would be a problem if the device were to be passed to a VM. Containers on the other hand share resources with the host.
Thank you :)

For the moment I'm still hesistating between VM and LXC (I read a lot of problems with usb passthrough to LXC container). So if the stability is not good on LXC, I'll have to go with VM. So I suppose it's better to not install bluez on the host to avoid future limitations due to that.

So now that I know the path to this: "/sys/devices/platform/soc/fe201000.serial/serial0/serial0-0/bluetooth",
can I mount it like this ?
Code:
pct set <vmid> --dev0 path=/sys/devices/platform/soc/fe201000.serial/serial0/serial0-0/bluetooth
If yes, do you think this solution is "persistent" ? I heard many people saying that the path is changing if the connect/disconnect some other devices like usb devices.

UPDATE: I tried to plug in an usb device, the path "/sys/devices/platform/soc/fe201000.serial/serial0/serial0-0/bluetooth" has changed. Seems that it change when an usb is plugged in.
 
Last edited:
You could look for the device in /sys/class/ or perhaps set up a udev rule to get a persistent device path.
After some research, however, it appear that the Bluetooth device will not be usable from within the unprivileged container anyway, as the Linux kernel does not allow Bluetooth devices to be namespaced. [0]

There is a patch that allows Bluetooth to be used from different namespaces, but it has been rejected. [1]

In conclusion, the easiest and also more secure way is to use a VM and pass the Bluetooth device to it.

[0] https://git.kernel.org/pub/scm/linu.../?id=1b8d7ae42d02e483ad94035cca851e4f7fbecb40
[1] https://lore.kernel.org/lkml/74252530-EF31-4CDA-A4E1-9FDD19DC25FA@holtmann.org/T/
 
You could look for the device in /sys/class/ or perhaps set up a udev rule to get a persistent device path.
After some research, however, it appear that the Bluetooth device will not be usable from within the unprivileged container anyway, as the Linux kernel does not allow Bluetooth devices to be namespaced. [0]

There is a patch that allows Bluetooth to be used from different namespaces, but it has been rejected. [1]

In conclusion, the easiest and also more secure way is to use a VM and pass the Bluetooth device to it.

[0] https://git.kernel.org/pub/scm/linu.../?id=1b8d7ae42d02e483ad94035cca851e4f7fbecb40
[1] https://lore.kernel.org/lkml/74252530-EF31-4CDA-A4E1-9FDD19DC25FA@holtmann.org/T/
Thank you very much for those precious informations ! I'll definitely go with a VM!

Yesterday I understood that my plan to have a LXC with bluetooth was a bit too difficult so I decided to already try to do it with a VM but unfortunately it's not working neither.

I created a debian 12 VM and mounted the usb key like this:
1707908740943.png
In the VM the bluetooth device is recognized but it's not finding devices. It can find 1 device but not all the others, even when devices are next to the pc (so it's not a range issue). I have this mini pc with the AX200 for bluetooth.

So I did some search related to the AX200 card and I found multiple threads where other people are also having issues with the same cards (like this one) so I'm wondering if proxmox can support that card (missing/outdated firmware?). So I tried to add the repo non-free-firmware to see if there is an update for that card but there is nothing. I also found on this thread that there is an update that could potentially be done but I don't know if that could help for this problem.

Then I decided to test if the AX200 is the culprit, I plugged in another BT usb dongle (Logilink BT0037) to see if it changes something.
=> Miracle, if I mount the new adapter in my VM, it works directly !!!! I'm so happy that I finally have the bluetooth working :)

But I'm getting errors when proxmox host is starting:

1707910183286.jpeg

Code:
[    0.228880] ACPI: [Firmware Bug]: BIOS _OSI(Linux) query ignored
[    3.903298] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    4.143704] Bluetooth: Core ver 2.22
[    4.143729] NET: Registered PF_BLUETOOTH protocol family
[    4.143731] Bluetooth: HCI device and connection manager initialized
[    4.143733] Bluetooth: HCI socket layer initialized
[    4.143735] Bluetooth: L2CAP socket layer initialized
[    4.143737] Bluetooth: SCO socket layer initialized
[    4.271983] iwlwifi 0000:02:00.0: loaded firmware version 77.bd067429.0 cc-a0-77.ucode op_mode iwlmvm
[    4.338483] Bluetooth: hci0: CSR: Setting up dongle with HCI ver=6 rev=22bb
[    4.338487] Bluetooth: hci0: LMP ver=6 subver=22bb; manufacturer=10
[    4.374820] Bluetooth: hci1: Found device firmware: intel/ibt-20-1-3.sfi
[    4.374869] Bluetooth: hci1: Boot Address: 0x24800
[    4.374870] Bluetooth: hci1: Firmware Version: 255-255.255
[    4.376394] Bluetooth: hci1: FW download error recovery failed (-19)
[    4.376427] Bluetooth: hci1: sending frame failed (-19)
[    4.376443] Bluetooth: hci1: Reading supported features failed (-19)
[    4.376458] Bluetooth: hci1: Error reading debug features
[    4.376459] Bluetooth: hci1: HCI LE Coded PHY feature bit is set, but its usage is not supported.
[    4.376463] Bluetooth: hci1: sending frame failed (-19)
[    4.376473] Bluetooth: hci1: Failed to read MSFT supported features (-19)
[    4.768455] i915 0000:00:02.0: [drm] Finished loading DMC firmware i915/kbl_dmc_ver1_04.bin (v1.4)
[    4.980222] Bluetooth: hci1: Bootloader revision 0.3 build 0 week 24 2017
[    4.981228] Bluetooth: hci1: Device revision is 1
[    4.981230] Bluetooth: hci1: Secure boot is enabled
[    4.981231] Bluetooth: hci1: OTP lock is enabled
[    4.981231] Bluetooth: hci1: API lock is enabled
[    4.981232] Bluetooth: hci1: Debug lock is disabled
[    4.981233] Bluetooth: hci1: Minimum firmware build 1 week 10 2014
[    5.012861] Bluetooth: hci1: Found device firmware: intel/ibt-20-1-3.sfi
[    5.012900] Bluetooth: hci1: Boot Address: 0x24800
[    5.012901] Bluetooth: hci1: Firmware Version: 255-255.255
[    6.931348] Bluetooth: hci1: Waiting for firmware download to complete
[    6.932239] Bluetooth: hci1: Firmware loaded in 1874391 usecs
[    6.932329] Bluetooth: hci1: Waiting for device to boot
[    6.947277] Bluetooth: hci1: Device booted in 14671 usecs
[    6.947291] Bluetooth: hci1: Malformed MSFT vendor event: 0x02
[    6.948060] Bluetooth: hci1: Found Intel DDC parameters: intel/ibt-20-1-3.ddc
[    6.950289] Bluetooth: hci1: Applying Intel DDC parameters completed
[    6.951315] Bluetooth: hci1: Firmware revision 0.3 build 249 week 27 2023
[    6.953320] Bluetooth: hci1: HCI LE Coded PHY feature bit is set, but its usage is not supported.

So now the questions are:
- Any idea how to make the AX200 working ?
- Any idea what could be those errors at startup ? Are they important ? Any way to solve that problem ?

A big big thank you to @fschauer for your help. As I'm not a linux expert it's a real pleasure to see experts like you still helping beginners like me :)

Update: I also find this thread that seems to provide a solution for problems related to ax210, maybe I can give it a try but I'm a bit scared to break everything (I don't know linux enough to understand all the consequence of the change). Would you try it ?
 
Last edited:
I also found on this thread that is an update that could potentially be done but I don't know if that could help for this problem.
The firmware should be present on PVE 8.1 at /lib/firmware/intel/ibt-20-1-4.sfi.xz

Update: I also find this thread that seems to provide a solution for problems related to ax210, maybe I can give it a try but I'm a bit scared to break everything (I don't know linux enough to understand all the consequence of the change). Would you try it ?
No need for that, the file /lib/firmware/iwlwifi-ty-a0-gf-a0.pnvm.xz should already be present in pve-firmware by now.

It does not matter for passthrough though. The device is passed through to the VM, so you need to make sure that the VM has the necessary drivers and firmware blobs.

In the VM the bluetooth device is recognized but it's not finding devices. It can find 1 device but not all the others, even when devices are next to the pc (so it's not a range issue). I have this mini pc with the AX200 for bluetooth.
Then the fault seems to be with some driver or configuration inside the VM or with the device itself.

But I'm getting errors when proxmox host is starting:

1707910183286.jpeg
Since these messages are on the host and the device is later passed through to the VM this should not matter. Still if you do not want the host to attempt to load the bluetooth driver, you can blacklist it in /etc/modprobe.d/blacklist.conf
Code:
blacklist btusb
blacklist btrtl
blacklist btbcm
blacklist btintel
blacklist bluetooth
The changes will take effect upon the next reboot.
 
@fschauer Thank you very much again :)

Good to know that all needed drivers are already there, I will stop wasting my time on firmware update then.
I thought the problem was the passthrough from host to the VM but as you explained, I was probably looking in the wrong direction if the problem is inside the VM (again, helping a lot).

I blacklisted the drivers as mentionned and it indeed removed error message at start, Thank you !
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!