tteck / Proxmox

Proxmox VE Helper-Scripts
https://Helper-Scripts.com
MIT License
12.91k stars 2k forks source link

Zigbee2mqtt container does not show usb passthrough #1385

Closed Tokn59 closed 1 year ago

Tokn59 commented 1 year ago

A clear and concise description of the issue.

In pve the command lsusb reveals :

Bus 001 Device 013: ID 1a86:55d4 QinHeng Electronics SONOFF Zigbee 3.0 USB Dongle Plus V2

In the container (Zigbee2mqtt - debian 11) the command ls -l /dev/serial/by-id :

image

Container is privileged. Already did reboot etc ..

Any idea whats's wrong ? Thank You !!!!

If relevant, including screenshots or a code block can be helpful in clarifying the issue.

No response

Please provide detailed steps to reproduce the issue.

No response

tteck commented 1 year ago

I do not believe it is an issue with the script. I performed a clean installation, and everything appears to be functioning correctly.

 _____   _       __             ___   __  _______  ____________
/__  /  (_)___ _/ /_  ___  ___ |__ \ /  |/  / __ \/_  __/_  __/
  / /  / / __  / __ \/ _ \/ _ \__/ // /|_/ / / / / / /   / /   
 / /__/ / /_/ / /_/ /  __/  __/ __// /  / / /_/ / / /   / /    
/____/_/\__, /_.___/\___/\___/____/_/  /_/\___\_\/_/   /_/     
       /____/ 🐝

Using Advanced Settings
Using Distribution: debian
Using debian Version: 11
Using Container Type: 0
Using Root Password: 05-03-2023
Container ID: 112
Using Hostname: zigbee2mqtt
Using Disk Size: 4
Allocated Cores: 2
Allocated RAM: 1024
Using Bridge: vmbr0
Using IP Address: 192.168.86.252/24
Using Gateway IP Address: 192.168.86.1
Disable IPv6: yes
Using Interface MTU Size: Default
Using DNS Search Domain: Host
Using DNS Server IP Address: Host
Using Vlan: Default
Enable Root SSH Access: no
Enable Verbose Mode: no
Creating a Zigbee2MQTT LXC using the above advanced settings
 ✓ Using local for Template Storage.
 ✓ Using local-lvm for Container Storage.
 ✓ Updated LXC Template List
 ✓ LXC Container 112 was successfully created.
 ✓ Started LXC Container
 ✓ Set up Container OS
 ✓ Network Connected: 192.168.86.252 
 ✓ Internet Connected
 ✓ DNS Resolved github.com to 140.82.113.4
 ✓ Updated Container OS
 ✓ Installed Dependencies
 ✓ Set up Node.js Repository
 ✓ Installed Node.js
 ✓ Set up Zigbee2MQTT Repository
Switch to Edge/dev branch? (y/N) 
 ✓ Installed Zigbee2MQTT
 ✓ Created Service
 ✓ Cleaned
 ✓ Completed Successfully!

Proxmox Shell

root@server:~# ls -l /dev/serial/by-id
total 0
lrwxrwxrwx 1 root root 13 May  1 16:19 usb-Silicon_Labs_CP2102N_USB_to_UART_Bridge_Controller_a4766cbfb593eb11b7611b4f3d9xxxxx-if00-port0 -> ../../ttyUSB0
root@server:~# 

Zigbee2mqtt LXC Console

root@zigbee2mqtt:~# ls -l /dev/serial/by-id                                        
total 0
lrwxrwxrwx 1 root root 13 May  1 16:19 usb-Silicon_Labs_CP2102N_USB_to_UART_Bridge_Controller_a4766cbfb593eb11b7611b4f3d9xxxxx-if00-port0 -> ../../ttyUSB0
root@zigbee2mqtt:~# 
tteck commented 1 year ago

Run this command dpkg -s usbutils in the Proxmox shell and share the output.

Tokn59 commented 1 year ago

root@zigbee2mqtt:~# dpkg -s usbutils dpkg-query: package 'usbutils' is not installed and no information is available Use dpkg --info (= dpkg-deb --info) to examine archive files.

Not installed so I installed them ...

root@zigbee2mqtt:~# apt install usbutils Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: libusb-1.0-0 The following NEW packages will be installed: libusb-1.0-0 usbutils 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 139 kB of archives. After this operation, 486 kB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://deb.debian.org/debian bullseye/main amd64 libusb-1.0-0 amd64 2:1.0.24-3 [60.2 kB] Get:2 http://deb.debian.org/debian bullseye/main amd64 usbutils amd64 1:013-3 [79.3 kB] Fetched 139 kB in 0s (679 kB/s) Selecting previously unselected package libusb-1.0-0:amd64. (Reading database ... 32558 files and directories currently installed.) Preparing to unpack .../libusb-1.0-0_2%3a1.0.24-3_amd64.deb ... Unpacking libusb-1.0-0:amd64 (2:1.0.24-3) ... Selecting previously unselected package usbutils. Preparing to unpack .../usbutils_1%3a013-3_amd64.deb ... Unpacking usbutils (1:013-3) ... Setting up libusb-1.0-0:amd64 (2:1.0.24-3) ... Setting up usbutils (1:013-3) ... Processing triggers for man-db (2.9.4-2) ... Processing triggers for libc-bin (2.31-13+deb11u6) ... root@zigbee2mqtt:~#

Then ran lsusb:

root@zigbee2mqtt:~# lsusb Bus 001 Device 005: ID 04e8:4001 Samsung Electronics Co., Ltd PSSD T7 Bus 001 Device 006: ID 18d1:9302 Google Inc. Bus 001 Device 013: ID 1a86:55d4 QinHeng Electronics SONOFF Zigbee 3.0 USB Dongle Plus V2 Bus 001 Device 012: ID 1cf1:0030 Dresden Elektronik ZigBee gateway [ConBee II] Bus 001 Device 002: ID 8087:8001 Intel Corp. Integrated Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub root@zigbee2mqtt:~#

tteck commented 1 year ago

I wanted the command run in the Proxmox shell.

tteck commented 1 year ago

What does ls -l /dev/serial/by-id show?

Tokn59 commented 1 year ago

Ok sorry ... here you go ...

root@nucpve:~# dpkg -s usbutils Package: usbutils Status: install ok installed Priority: optional Section: utils Installed-Size: 325 Maintainer: Aurelien Jarno aurel32@debian.org Architecture: amd64 Multi-Arch: foreign Version: 1:013-3 Depends: libc6 (>= 2.14), libudev1 (>= 196), libusb-1.0-0 (>= 2:1.0.22) Breaks: hwdata (<< 0.334-1~), isenkram (<< 0.45~), kinfocenter (<< 4:5.14.5-2~), libosinfo-1.0-0 (<< 1.8.0-1~), usbip (<< 2.0+5.10.4-1~) Description: Linux USB utilities This package contains the lsusb utility for inspecting the devices connected to the USB bus. It shows a graphical representation of the devices that are currently plugged in, showing the topology of the USB bus. It also displays information on each individual device on the bus. Homepage: https://github.com/gregkh/usbutils root@nucpve:~#

Tokn59 commented 1 year ago

sorry about the strikethrough ????

Tokn59 commented 1 year ago

In proxmox pve:

root@nucpve:~# ls -l /dev/serial/by-id ls: cannot access '/dev/serial/by-id': No such file or directory root@nucpve:~#

In the lxc : root@zigbee2mqtt:~# ls -l /dev/serial/by-id total 0 root@zigbee2mqtt:~#

tteck commented 1 year ago

This directory is typically created when you have USB serial devices connected to your system. If the USB serial device is recognized using the command lsusb but the /dev/serial/by-id directory is still missing, you can try creating the directory manually by running the following command mkdir -p /dev/serial/by-id

Tokn59 commented 1 year ago

Ok, did that and rebooted the lxc. Result: root@zigbee2mqtt:~# ls -l /dev/serial/by-id total 0 root@zigbee2mqtt:~#

THANK YOU for helping me sort this out. I saw I am not the only one with this issue btw ...

tteck commented 1 year ago

Did you run mkdir -p /dev/serial/by-id in the Proxmox Shell or LXC console?

Tokn59 commented 1 year ago

Lxc console …

On 3 May 2023, at 19:31, tteckster @.***> wrote:



Did you run mkdir -p /dev/serial/by-id in the Proxmox Shell or LXC console?

— Reply to this email directly, view it on GitHubhttps://github.com/tteck/Proxmox/issues/1385#issuecomment-1533435864, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACGJZ76RI77LPVGTZYFFKKLXEKI6JANCNFSM6AAAAAAXUU77RA. You are receiving this because you authored the thread.Message ID: @.***>

tteck commented 1 year ago

Run it in the Proxmox Shell

Tokn59 commented 1 year ago

Just did ... and rebooted the lxc as well. Same result though ...

root@zigbee2mqtt:~# ls -l /dev/serial/by-id total 0 root@zigbee2mqtt:~#

tteck commented 1 year ago

Unplug and plug back in the USB stick, and run ls -l /dev/serial/by-id in the Proxmox Shell

Tokn59 commented 1 year ago

Done !

image

tteck commented 1 year ago

I'm not certain why your system is not recognizing the device.

Tokn59 commented 1 year ago

That makes 2 of us .... I am also running HASS OS as a VM and that does use USB Passthrough without any issues. I will continue to search for a cause/solution. Meanwhile .. BIG THANKS for all your help !

Will post if I find solution for sure !

tteck commented 1 year ago

Maybe, https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1035094 ?

tteck commented 1 year ago

https://github.com/Koenkk/zigbee2mqtt/issues/17535#issuecomment-1532241700

Tokn59 commented 1 year ago

image

YES !!!!

This did the trick :

Create /etc/apt/sources.list.d/bullseye-backports.list containing

bullseye-backports

deb http://deb.debian.org/debian bullseye-backports main Run sudo apt update Run sudo apt-get -t bullseye-backports install systemd udev reboot

Thanks man !!!!!

tteck commented 1 year ago

Did you use backports on Proxmox or the Zigbee2mqtt LXC?

Tokn59 commented 1 year ago

I wasn't sure so did it on both pve and lxc. Now one step closer but still some issues:

image


tteck commented 1 year ago

Make sure HAOS is not still using the device.

Tokn59 commented 1 year ago

It is not in use by HASSOS (Using a Conbee II) image

Seems user root does not have write access permissions to the serial port. Tried: test -w /dev/ttyACM1 && echo success || echo failure. Resulted in failure.

tteck commented 1 year ago
  serial:
    port: /dev/serial/by-id/<your device>
    #adapter: deconz    #(uncomment for ConBee II)
    #adapter: ezsp  #(uncomment for ITead Sonoff Zigbee 3.0 USB Dongle Plus V2 model "ZBDongle-E version")
Tokn59 commented 1 year ago

This is my current config :

image

But still :

image

tteck commented 1 year ago

Your configuration.yaml is messed up. Look at the example:

frontend:
  port: 9442
homeassistant: true
permit_join: false
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://192.168.86.224:1883'
  user: usr
  password: pwd
  keepalive: 60
  reject_unauthorized: true
  version: 4
serial:
  port: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
  #adapter: deconz  #(uncomment for ConBee II)
  #adapter: ezsp        #(uncomment for ITead Sonoff Zigbee 3.0 USB Dongle Plus V2 model "ZBDongle-E version")
advanced:
  pan_id: GENERATE
  network_key: GENERATE
  channel: 20
Tokn59 commented 1 year ago

Corrected (pasted your file and changed with my data). Still get the same error. Checked the Zigbee2mqtt documentation for the specific error "Error: Resource temporarily unavailable Cannot lock port This error occurs when another program is already using (and thus locking) the adapter. You can find out which via the following command: ls -l /proc/[0-9]/fd/ |grep /dev/ttyACM0 (replace /dev/ttyACM0 with your adapter port)."

So did : ls -l /proc/[0-9]/fd/ |grep /dev/ttyACM1

No processes or programs shown though ...

image

tteck commented 1 year ago

did you uncomment #adapter: ezsp?

Tokn59 commented 1 year ago

Also did a reboot to make sure nothing is occupying the port ...

image

tteck commented 1 year ago

Have you used this device before?

Tokn59 commented 1 year ago

No it's brand new. AFAIK it is not the ezsp model but the Sonoff Zigbee 3.0 USB Dongle Plus

My HASS is using a Conbee II but my goal was to move Zigbee2mqtt out of HASS and use the better Sonoff stick. I will put it ( and YOU) to rest for today. Will try again tomorrow with the Conbvee II stick first.

tteck commented 1 year ago

Check for a cordinator_backup.json in /opt/zigbee2mqtt/data/ if found, remove it.

It states ITead Sonoff Zigbee 3.0 USB Dongle Plus V2 in your devices description. The -P (CC2652P chip) model has a 2.5" case, the -E (EFR chip) model is much shorter.

https://www.youtube.com/watch?v=iW6D0G_rlSA