Cannot open CC2531 in a VM Home Assistant instance

I’ve been trying to connect the CC2531 dongle to Home Assistant. The USB device is detected. But when I start the addon, it won’t be able to connect to it. Here are the logs:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] socat.sh: executing... 
[12:38:43] INFO: Socat not enabled, marking service as down
[cont-init.d] socat.sh: exited 0.
[cont-init.d] zigbee2mqtt.sh: executing... 
[12:38:45] INFO: MQTT available, fetching server detail ...
[12:38:45] INFO: Previous config file found, checking backup
[12:38:45] INFO: Creating backup config in '/config/zigbee2mqtt/.configuration.yaml.bk'
[12:38:45] INFO: Adjusting Zigbee2mqtt core yaml config with add-on quirks ...
[cont-init.d] zigbee2mqtt.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[12:38:46] INFO: Handing over control to Zigbee2mqtt Core ...
> [email protected] start /app
> node index.js
Zigbee2MQTT:error 2021-07-15 12:38:51: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2021-07-15 12:38:51: Failed to start zigbee
Zigbee2MQTT:error 2021-07-15 12:38:51: Exiting...
Zigbee2MQTT:error 2021-07-15 12:38:51: Error: Error while opening serialport 'Error: Error: Operation not permitted, cannot open /dev/bus/usb/002/004'
    at Znp.<anonymous> (/app/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:136:32)
    at Generator.next (<anonymous>)
    at /app/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:27:71
    at new Promise (<anonymous>)
    at __awaiter (/app/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:23:12)
    at SerialPort.<anonymous> (/app/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:134:49)
    at SerialPort._error (/app/node_modules/zigbee-herdsman/node_modules/@serialport/stream/lib/index.js:198:14)
    at /app/node_modules/zigbee-herdsman/node_modules/@serialport/stream/lib/index.js:242:12
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-07-15T10_38_51_158Z-debug.log
[12:38:51] INFO: Handing over control to Zigbee2mqtt Core ...
> [email protected] start /app
> node index.js

This is -part of- the output of the command ha hardware info

...
- attributes:
    BUSNUM: "002"
    DEVNAME: /dev/bus/usb/002/004
    DEVNUM: "004"
    DEVPATH: /devices/pci0000:00/0000:00:06.0/usb2/2-2
    DEVTYPE: usb_device
    DRIVER: usb
    ID_BUS: usb
    ID_FOR_SEAT: usb-pci-0000_00_06_0-usb-0_2
    ID_MODEL: CC2531_USB_Dongle
    ID_MODEL_ENC: CC2531\x20USB\x20Dongle
    ID_MODEL_ID: 16ae
    ID_PATH: pci-0000:00:06.0-usb-0:2
    ID_PATH_TAG: pci-0000_00_06_0-usb-0_2
    ID_REVISION: "6296"
    ID_SERIAL: Texas_Instruments_CC2531_USB_Dongle
    ID_USB_INTERFACES: ':ffffff:'
    ID_VENDOR: Texas_Instruments
    ID_VENDOR_ENC: Texas\x20Instruments
    ID_VENDOR_ID: "0451"
    MAJOR: "189"
    MINOR: "131"
    PRODUCT: 451/16ae/6296
    SUBSYSTEM: usb
    TAGS: ':seat:'
    TYPE: 0/0/0
    USEC_INITIALIZED: "506160837778"
  by_id: null
  dev_path: /dev/bus/usb/002/004
  name: 2-2
  subsystem: usb
  sysfs: /sys/devices/pci0000:00/0000:00:06.0/usb2/2-2
...

And this is the config of the addon itself:

data_path: /config/zigbee2mqtt
external_converters: []
devices: devices.yaml
groups: groups.yaml
homeassistant: true
permit_join: true
mqtt:
  base_topic: zigbee2mqtt
  server: mqtt://182.168.178.35:1883
  user: user
  password: pass
serial:
  port: /dev/bus/usb/002/004
advanced:
  log_level: warn
  pan_id: 6754
  channel: 11
  network_key:
    - 1
    - 3
    - 5
    - 7
    - 9
    - 11
    - 13
    - 15
    - 0
    - 2
    - 4
    - 6
    - 8
    - 10
    - 12
    - 13
  availability_blocklist: []
  availability_passlist: []
device_options: {}
blocklist: []
passlist: []
queue: {}
frontend:
  port: 8099
experimental: {}
socat:
  enabled: false
  master: pty,raw,echo=0,link=/tmp/ttyZ2M,mode=777
  slave: tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5
  options: '-d -d'
  log: false

In the

serial:
  port: /dev/bus/usb/002/004

I’ve tried /sys/devices/pci0000:00/0000:00:06.0/usb2/2-2 and /devices/pci0000:00/0000:00:06.0/usb2/2-2 :frowning: without much luck. Am I missing something? Or do I have to do an extra step to the dongle? I just received it and plugged it in.

Is the firmware loaded on the dongle? Most of them arrive empty. I tried my and it’s detected as ttyusb device in VM by supervisor.
Also, in Synology, have you selected USB 2 or USB 3 as USB type? I’ve tested only with USB 3.0 and it works (again, latest firmware flashed on cc2531

OH YOU GOTTA FLASH IT?!

If you didn’t get one that is already flashed by seller (and 99.9% of the are not), unfortunately, yes…