[SOLVED] Error while creating zigbee2mqtt on LXC

Bison

New Member
Nov 16, 2024
3
0
1
Hello,

I'm using Proxmox 8.2.8 (just updating to have USB passthourgh).

I try to create a new container for zigbee2mqtt. I created a LXC in Proxmox and use other containers with success since months.

1731782851094.png


I tried to create this using a Stacks with Portainer but i got the same error with docker.

From host :
Code:
root@pve2yp:~# ls -l /dev/serial/by-id
total 0
lrwxrwxrwx 1 root root 13 Nov 16 19:39 usb-1a86_USB_Serial-if00-port0 -> ../../ttyUSB0

From CT "docker" i can see the mapping :
Code:
root@docker:~# ls -l /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
crw-rw---- 1 root root 188, 0 Nov 16 18:41 /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0

I run this :
Code:
docker run \
   --name zigbee2mqtt \
   --restart=unless-stopped \
   --device=/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0:/dev/ttyUSB0 \
   -p 8080:8080 \
   -v /srv/docker/zigbee2mqtt/data:/app/data \
   -v /run/udev:/run/udev:ro \
   -e TZ=Europe/Paris \
   koenkk/zigbee2mqtt

And got this error :
Code:
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error creating device nodes: mount /dev/ttyUSB0:/var/lib/docker/overlay2/57907ebd0d70e18055abb8b88420afde7dcd73cbcc0c4c8c933e26e392a3324e/merged/dev/ttyUSB0 (via /proc/self/fd/6), flags: 0x1000: no such file or directory: unknown.
ERRO[0000] error waiting for container:

Could you help ? I tried many things since hours but nothing works.
 
Please post the results of

Code:
ls -lL /dev/serial/by-id

from the host.

Code:
root@pve2yp:~# ls -lL /dev/serial/by-id
total 0
crw-rw---- 1 root dialout 188, 0 Nov 16 19:39 usb-1a86_USB_Serial-if00-port0
 
Code:
root@pve2yp:~# ls -lL /dev/serial/by-id
total 0
crw-rw---- 1 root dialout 188, 0 Nov 16 19:39 usb-1a86_USB_Serial-if00-port0
What I tought. You may run into a permission problem here. You LX(C) container is probably unpriviledged, so that you will not have access to the file in LXC and therefore also not in your docker container.

My setup is like this:

  • LXC docker-compose-stack

    app:
    image: koenkk/zigbee2mqtt
    hostname: zigbee2mqtt
    volumes:
    - data:/app/data
    - /run/udev:/run/udev:ro
    devices:
    - /dev/ttyUSB0:/dev/ttyUSB0


    and this file

    $ ls -l /dev/ttyUSB0
    crw-rw-rw- 1 nobody root 188, 0 Nov 17 10:22 /dev/ttyUSB0


  • PVE / hypervisor setup

    root@proxmox /etc/pve > cat /etc/udev/rules.d/99-usb-serial.rules
    # dmesg output
    # Jul 17 15:50:28 proxmox kernel: [ 2.202228] usb 1-4: new full-speed USB device number 2 using xhci_hcd
    # Jul 17 15:50:28 proxmox kernel: [ 2.352462] usb 1-4: New USB device found, idVendor=10c4, idProduct=ea60, bcdDevice= 1.00
    # Jul 17 15:50:28 proxmox kernel: [ 2.352468] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    # Jul 17 15:50:28 proxmox kernel: [ 2.352470] usb 1-4: Product: slae.sh cc2652rb stick - slaesh's iot stuff
    # Jul 17 15:50:28 proxmox kernel: [ 2.352472] usb 1-4: Manufacturer: Silicon Labs
    # Jul 17 15:50:28 proxmox kernel: [ 2.352474] usb 1-4: SerialNumber: XX_XX_XX_XX_XX_XX_XX_XX
    # Jul 17 15:50:28 proxmox kernel: [ 11.720697] usb 1-4: cp210x converter now attached to ttyUSB0
    SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{serial}=="XX_XX_XX_XX_XX_XX_XX_XX" SYMLINK+="ttyZIGBEE0" KERNEL=="ttyUSB[0-9]*",MODE="0666",GROUP="100000"


    The group is also important, this is root in the unpriviledged container.

    Container setting

    lxc.cgroup2.devices.allow: c 188:* rwm
    lxc.mount.entry: /dev/ttyZIGBEE0 dev/ttyUSB0 none bind,optional,create=file
 
Oh it works with the Stacks i want to use, thank you !

As i allready tried like this i suspect what you said ...
Code:
GROUP="100000"
is very important because i didn't try with this option

I will now try in real condition with my other Zigbee key on ttyACM0 but i think it will be good.

Come soon to update and close.