How to forward HCI0 (Bluetooth) in LXD inside the container?

Hello,

I would like the hci0 device to be accessible from my container. But it always returns me an error:
Device is not available: Address family not supported by protocol

The HCI device is a Bluethooth UD100-G03 USB flash drive.

Container configuration:

architecture: x86_64
config:
  boot.autostart: "true"
  boot.autostart.delay: "15"
  boot.autostart.priority: "50"
  image.architecture: amd64
  image.description: Debian buster amd64 (20201112_05:24)
  image.os: Debian
  image.release: buster
  image.serial: "20201112_05:24"
  image.type: squashfs
  image.variant: default
  security.nesting: "true"
  security.privileged: "true"
  volatile.base_image: c2940e0195bd04d21acf113c9365be0d8d34fe57590382f98c9e87f9321228f5
  volatile.eth0.host_name: veth43bb1c5b
  volatile.eth0.hwaddr: 00:16:3e:e2:f3:1a
  volatile.eth0.name: eth0
  volatile.idmap.base: "0"
  volatile.idmap.current: '[]'
  volatile.idmap.next: '[]'
  volatile.last_state.idmap: '[]'
  volatile.last_state.power: RUNNING
devices:
  /dev/rfkill:
    path: /dev/rfkill
    type: unix-char
  bluetooth:
    productid: "0001"
    type: usb
    vendorid: 0a12
  ttyUSB1:
    path: /dev/ttyUSB0
    type: unix-char
ephemeral: false
profiles:
- default
- eth0
- mem-2GB
stateful: false
description: ""
root@jeedom-2:~# hcitool dev
Devices:
root@jeedom-2:~# hcitool scan
Device is not available: Address family not supported by protocol
root@jeedom-2:~# rfkill list
1: hci0: Bluetooth
        Soft blocked: no
        Hard blocked: no
root@jeedom-2:~# ls -la /sys/class/bluetooth/hci0
lrwxrwxrwx 1 root root 0 Nov 19 16:03 /sys/class/bluetooth/hci0 -> ../../devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/bluetooth/hci0

Hmm, that’s a good question.

@brauner do you know if bluetooth is part of netns somehow and if so, how one can move those devices into another namespace?

So I’m not sure whether the bluetooth driver is namespace aware. I would think it isn’t. The sysfs files you’re seeing always exist because that part of sysfs is only namespaced for net devices.

Looking at the kernel sources it doesn’t look like any part is namespace aware and it’s a massive codebase.

So there is no solution to include this type of device in LXD?

Looks like this would need significant kernel work before a new device type could be added to LXC/LXD for it.

Ok thanks for your answers and hopefully one day this type of device will be added.