Bluetooth device on container

gtrovato

Active Member
May 16, 2019
29
2
43
56
Hi All!

I'm an old user of Proxmox, but just with VM.
I'm approaching now containers, and I've an issue.

I need to manage from a container (Debian 11) a bluetooth device connected to the host (Proxmox 7.3-3).
With lsub it's properly reported inside the container:
Bus 001 Device 003: ID 8087:0aaa Intel Corp. Bluetooth 9460/9560 Jefferson Peak (JfP)

But when I start the bluetooth service from the container, it fails with:
Mar 06 15:52:37 debian bluetoothd[321]: src/adapter.c:adapter_init() Failed to access management interface
Mar 06 15:52:37 debian bluetoothd[321]: src/main.c:main() Adapter handling initialization failed


Same bluetooth service starts properly on the host.

Is it a permission problem?

Thank you!
 
Hi,

since LXC processes use the host kernel, it can see the USB/Bluetooth device just fine.
But to access it inside the container, the appropriate devices need to be "pass-through"d to the container.

So first of you need to get the major, minor numbers for the Bluetooth device by using:
Code:
ls -l /dev/bus/usb/001/003

This should print something like:
Code:
# ls -l /dev/bus/usb/001/003
crw-rw-r-- 1 root root 189, 1 Mar  7 09:54 /dev/bus/usb/001/003

Note the 189, 1 - that are the major and minor numbers of the device.

Now you need to edit your LXC config (/etc/pve/lxc/<vmid>.conf) by hand and add the following at the end:
Code:
lxc.cgroup2.devices.allow: c <major>:<minor> rwm
lxc.mount.entry: /dev/bus/usb/001/003 dev/bus/usb/001/003 none bind,optional,create=file
(Replacing <major> and <minor> with the number you got from the command above.)

This is a bit finicky and might or might not work, depending on your setup, hardware etc. Also, be aware that the bus number (and maybe major, minor) change when plugging it into a different port. Also BIOS/UEFI updates etc. can change them as well.

Stuff like this is usually best solved using a VM, where you can reliably pass through a USB device based on its vendor and product ID.

Hope this helps!
 
Hi,

I've the same, it doesn't work.
This my .conf:

arch: amd64
cores: 2
features: nesting=1
hostname: debian
memory: 2048
nameserver: 192.168.0.254
net0: name=eth0,bridge=vmbr0,gw=192.168.0.254,hwaddr=C6:C0:BD:3D:EC:64,ip=192.168.0.78/24,type=veth
ostype: debian
rootfs: local-lvm:vm-201-disk-0,size=10G
searchdomain: 192.168.0.254
swap: 512
unprivileged: 1
lxc.cgroup2.devices.allow: c 189:2 rwm
lxc.mount.entry: /dev/bus/usb/001/003 dev/bus/usb/001/003 none bind,optional,create=file
 
Do you still get the same error messages from the bluetoothd service?
Also, are there any error messages in the syslog (journalctl -b -p4) which might indicate?

You can try starting the container with the -debug flag (e.g. pct start <vmid> -debug) on the command line, that might also reveal why it doesn't work.
 
I passed my usb stick but get:
Code:
bluetoothd[238]: Bluetooth daemon 5.70
bluetoothd[238]: src/adapter.c:adapter_init() Failed to access management interface
bluetoothd[238]: src/main.c:main() Adapter handling initialization failed
 
  • Like
Reactions: sk1729

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!