whiskerz007 / proxmox_hassio_lxc

MIT License
209 stars 84 forks source link

deCONZ and APC UPS Daemon addons #11

Closed tamet83 closed 4 years ago

tamet83 commented 4 years ago

Hi,

I have problem with this two addons. In particular:

deCONZ from this repository https://home-assistant.io/addons won't install at all. If i push the install buttont it becomes red. The system log gives me the following error

19-12-05 23:41:30 INFO (SyncWorker_8) [hassio.docker.interface] Pull image homeassistant/amd64-addon-deconz tag 3.9. 19-12-05 23:41:31 ERROR (SyncWorker_8) [hassio.docker.interface] Can't install homeassistant/amd64-addon-deconz:3.9 -> 404 Client Error: Not Found ("manifest for homeassistant/amd64-addon-deconz:3.9 not found: manifest unknown: manifest unknown").

Whereas for APC UPS Daemon (from this repository https://github.com/korylprince/hassio-apcupsd) I can install it, but when i push start button it won't start.

For this one the system log gives me this error:

19-12-05 23:55:27 INFO (SyncWorker_7) [hassio.docker.interface] Clean addon_a722577e_apcupsd application 19-12-05 23:55:28 ERROR (SyncWorker_7) [hassio.docker] Can't start addon_a722577e_apcupsd: 500 Server Error: Internal Server Error ("error gathering device information while adding custom device "/dev/usb/": no such file or directory") How can I pass the USB devices to the lxc?

Do you have any advice?

whiskerz007 commented 4 years ago

When did you run the script last? I made some changes that should resolve the issue with the USB devices not being found. I'd suggest running the script again, to setup a new instance, and see if those addons work with the new script.

tamet83 commented 4 years ago

I ran the script 14 days ago. I'll give a try again and let you know. Thanks for your response.

tamet83 commented 4 years ago

Hi, i ran again the script. Now Deconz works well, but I still have problem with APC UPS Daemon. I have only this error:

[hassio.docker] Can't start addon_a722577e_apcupsd: 500 Server Error: Internal Server Error ("error gathering device information while adding custom device "/dev/usb/": no such file or directory")

Giancky79 commented 4 years ago

For use it we need to give another path to lxc for the passtrough From the site https://wiki.debian.org/apcupsd we need to use udev rules to make your APC UPS USB device show up as /dev/usb/hiddevX so that Hass.io can see it, is possible mr. whiskerz insert in lxc configuration?

whiskerz007 commented 4 years ago

@tamet83 I'll need to get a list of devices that are presented to the host (Proxmox) computer and what the name of the devices are that the APC UPS presents. If you would like faster responses, try to catch me on Discord.

tamet83 commented 4 years ago

Hi, thanks for your response. If I run lsusb, I receive this result

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 001 Device 002: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)
Bus 001 Device 004: ID 8087:0aaa Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

The Device 003 is my UPS.

Do you need further details?

whiskerz007 commented 4 years ago

Please respond with the output of udevadm info /dev/bus/usb/001/003; udevadm info -a /dev/bus/usb/001/003 from Proxmox shell.

tamet83 commented 4 years ago

These are screenshots, if you need the text I’ll provide you as soon as I come back in my country:

47DFDE80-FF2B-419E-A86E-DBBC6A637FEA E908E6FF-3BE2-4818-81C4-B285345627D6 8956EB56-F15A-4075-A9BD-B9245F992FD6 3D6F2BC7-1177-468C-83BA-3A22F36E765D

Let me know if it is enough.

Many thanks for your help I really appreciate it

tamet83 commented 4 years ago

Hi,

it it's better following you'll fine the code copy&pasted:

root@pve:~# udevadm info /dev/bus/usb/001/003
P: /devices/pci0000:00/0000:00:14.0/usb1/1-3
N: bus/usb/001/003
L: 0
E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3
E: DEVNAME=/dev/bus/usb/001/003
E: DEVTYPE=usb_device
E: DRIVER=usb
E: PRODUCT=51d/2/106
E: TYPE=0/0/0
E: BUSNUM=001
E: DEVNUM=003
E: MAJOR=189
E: MINOR=2
E: SUBSYSTEM=usb
E: USEC_INITIALIZED=3336834
E: ID_VENDOR=APC
E: ID_VENDOR_ENC=APC
E: ID_VENDOR_ID=051d
E: ID_MODEL=Back-UPS_ES_700G_FW:871.O3_.I_USB_FW:O3
E: ID_MODEL_ENC=Back-UPS\x20ES\x20700G\x20FW:871.O3\x20.I\x20USB\x20FW:O3\x20
E: ID_MODEL_ID=0002
E: ID_REVISION=0106
E: ID_SERIAL=APC_Back-UPS_ES_700G_FW:871.O3_.I_USB_FW:O3_5B1536T45291
E: ID_SERIAL_SHORT=5B1536T45291
E: ID_BUS=usb
E: ID_USB_INTERFACES=:030000:
E: ID_VENDOR_FROM_DATABASE=American Power Conversion
E: ID_MODEL_FROM_DATABASE=Uninterruptible Power Supply

And

root@pve:~# udevadm info -a /dev/bus/usb/001/003

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/pci0000:00/0000:00:14.0/usb1/1-3':
    KERNEL=="1-3"
    SUBSYSTEM=="usb"
    DRIVER=="usb"
    ATTR{configuration}==""
    ATTR{bNumConfigurations}=="1"
    ATTR{idProduct}=="0002"
    ATTR{serial}=="5B1536T45291  "
    ATTR{bDeviceProtocol}=="00"
    ATTR{bDeviceSubClass}=="00"
    ATTR{authorized}=="1"
    ATTR{removable}=="removable"
    ATTR{urbnum}=="926270"
    ATTR{devpath}=="3"
    ATTR{bConfigurationValue}=="1"
    ATTR{bNumInterfaces}==" 1"
    ATTR{speed}=="1.5"
    ATTR{rx_lanes}=="1"
    ATTR{bMaxPacketSize0}=="8"
    ATTR{bcdDevice}=="0106"
    ATTR{manufacturer}=="APC"
    ATTR{bMaxPower}=="2mA"
    ATTR{bDeviceClass}=="00"
    ATTR{quirks}=="0x0"
    ATTR{maxchild}=="0"
    ATTR{busnum}=="1"
    ATTR{bmAttributes}=="e0"
    ATTR{devnum}=="3"
    ATTR{tx_lanes}=="1"
    ATTR{version}==" 1.10"
    ATTR{avoid_reset_quirk}=="0"
    ATTR{idVendor}=="051d"
    ATTR{ltm_capable}=="no"
    ATTR{product}=="Back-UPS ES 700G FW:871.O3 .I USB FW:O3 "

  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1':
    KERNELS=="usb1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{removable}=="unknown"
    ATTRS{tx_lanes}=="1"
    ATTRS{maxchild}=="12"
    ATTRS{quirks}=="0x0"
    ATTRS{bmAttributes}=="e0"
    ATTRS{version}==" 2.00"
    ATTRS{ltm_capable}=="no"
    ATTRS{idProduct}=="0002"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{serial}=="0000:00:14.0"
    ATTRS{urbnum}=="243"
    ATTRS{speed}=="480"
    ATTRS{bMaxPower}=="0mA"
    ATTRS{bcdDevice}=="0503"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{devnum}=="1"
    ATTRS{interface_authorized_default}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{authorized_default}=="1"
    ATTRS{manufacturer}=="Linux 5.3.13-1-pve xhci-hcd"
    ATTRS{product}=="xHCI Host Controller"
    ATTRS{configuration}==""
    ATTRS{bConfigurationValue}=="1"
    ATTRS{idVendor}=="1d6b"
    ATTRS{devpath}=="0"
    ATTRS{authorized}=="1"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bDeviceClass}=="09"
    ATTRS{rx_lanes}=="1"
    ATTRS{busnum}=="1"
    ATTRS{bDeviceSubClass}=="00"

  looking at parent device '/devices/pci0000:00/0000:00:14.0':
    KERNELS=="0000:00:14.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="xhci_hcd"
    ATTRS{driver_override}=="(null)"
    ATTRS{irq}=="127"
    ATTRS{enable}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x0c0330"
    ATTRS{consistent_dma_mask_bits}=="64"
    ATTRS{subsystem_device}=="0x2074"
    ATTRS{numa_node}=="-1"
    ATTRS{revision}=="0x30"
    ATTRS{ari_enabled}=="0"
    ATTRS{d3cold_allowed}=="1"
    ATTRS{subsystem_vendor}=="0x8086"
    ATTRS{dbc}=="disabled"
    ATTRS{device}=="0x9ded"
    ATTRS{msi_bus}=="1"
    ATTRS{vendor}=="0x8086"
    ATTRS{dma_mask_bits}=="64"
    ATTRS{local_cpus}=="f"
    ATTRS{local_cpulist}=="0-3"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

Thanks again for your help

whiskerz007 commented 4 years ago

I am not seeing any devices that should not pass through the LXC with the settings in installation script. Please paste the output from cat /etc/pve/lxc/100.conf (instead of 100, use your Hass.io LXC ID).

szurr commented 4 years ago

Hi Is there a recommend way to pass through devices or USB ports?

tamet83 commented 4 years ago

@whiskerz007 From the pve shell this is my output:

root@pve:~# cat /etc/pve/lxc/108.conf
arch: amd64
cores: 1
features: nesting=1
hostname: hassio
memory: 4096
net0: name=eth0,bridge=vmbr0,gw=192.168.1.1,hwaddr=C6:B2:94:86:89:34,ip=192.168.1.11/24,type=veth
onboot: 0
ostype: debian
rootfs: local-lvm:vm-108-disk-0,size=16G
swap: 512
lxc.cgroup.devices.allow: a
lxc.cap.drop: 
lxc.autodev: 1
lxc.hook.autodev: bash -c 'for dev in $(ls /dev/tty{ACM,S,USB}* 2>/dev/null) $([ -d "/dev/bus" ] && find /dev/bus -type c) /dev/mem /dev/net/tun; do mkdir -p $(dirname ${LXC_ROOTFS_MOUNT}${dev}); for link in $(udevadm info --query=property $dev | sed -n "s/DEVLINKS=//p"); do mkdir -p ${LXC_ROOTFS_MOUNT}$(dirname $link); cp -dR $link ${LXC_ROOTFS_MOUNT}${link}; done; cp -dR $dev ${LXC_ROOTFS_MOUNT}${dev}; done'

If I try to run the addon I have this error:

20-01-06 15:12:42 ERROR (SyncWorker_0) [hassio.docker] Can't start addon_a722577e_apcupsd: 500 Server Error: Internal Server Error ("error gathering device information while adding custom device "/dev/usb/": no such file or directory"

I contacted korylprince (the Apcupsd developer) and he wrote me this:

You'll need to use udev rules to make your APC UPS USB device show up as /dev/usb/hiddevX so that Hass.io can see it. I don't know the details of doing that on Proxmox/LXC, but I'd start with making the /dev/usb/hiddevX device show up on your physical host, then work on getting it passed into the LXC container. There's some udev rule info on this page that may be helpful.

whiskerz007 commented 4 years ago

Do I understand correctly that you are no longer having a problem with deCONZ, but that the only problem you are experiencing is not being able to use the APC addon with the USB device?

whiskerz007 commented 4 years ago

Have you gone through the exercise of creating the udev rules, on the Proxmox host, explained in this link? Please post the results from running ls -la /dev/usb on the Proxmox host.

tamet83 commented 4 years ago

Do I understand correctly that you are no longer having a problem with deCONZ, but that the only problem you are experiencing is not being able to use the APC addon with the USB device?

Yes I confirm that deCONZ works perfectly, the problem now is only with apcupsd addon that won’t start at all. I’ll try your suggestions and let you know as soon as possible.

Thanks again

whiskerz007 commented 4 years ago

The previous suggestion to modify udev rules should not be necessary. Try to run the install script again (I've made some changes which should resolve this problem).

gomez85 commented 4 years ago

Hi @whiskerz007 , I've the same tamet83 problem. I've just run the install script but I retrieve the same problem. After I'd also tried to use udev rules but when I try to start the addon i retrieve this error:

Can't start addon_a722577e_apcupsd: 500 Server Error: Internal Server Error ("error gathering device information while adding custom device "/dev/usb/": not a device node")

If helping, my device is located in /dev/bus/usb/003/002

Any suggestion?

Giancky79 commented 4 years ago

maybe the problem is debian10 and apcupsd?

whiskerz007 commented 4 years ago

Please plug in the APC UPS, run the following on Proxmox shell, and post results. (NOTE: Replace XXX with your Hass.io LXC ID)

echo "######"; lsusb; echo "######"; find /dev/usb -type c; echo "######"; cat /etc/pve/lxc/XXX.conf
tamet83 commented 4 years ago

Hi,

following my results:

root@pve:~# echo "######"; lsusb; echo "######"; find /dev/usb -type c; echo "######"; cat /etc/pve/lxc/XXX.conf
######
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 001 Device 002: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)
Bus 001 Device 004: ID 8087:0aaa Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
######
/dev/usb/hiddev0
######
cat: /etc/pve/lxc/XXX.conf: No such file or directory
whiskerz007 commented 4 years ago

@tamet83 Please read the entire post and follow appropriate actions. There is missing information.

tamet83 commented 4 years ago

@whiskerz007 I'm so sorry, I copied the wrong code. Following the correct results:

root@pve:~# echo "######"; lsusb; echo "######"; find /dev/usb -type c; echo "######"; cat /etc/pve/lxc/108.conf
######
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 001 Device 002: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)
Bus 001 Device 004: ID 8087:0aaa Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
######
/dev/usb/hiddev0
######
arch: amd64
cores: 1
features: nesting=1
hostname: hassio
memory: 4096
net0: name=eth0,bridge=vmbr0,gw=192.168.1.1,hwaddr=C6:B2:94:86:89:34,ip=192.168.1.11/24,type=veth
onboot: 0
ostype: debian
rootfs: local-lvm:vm-108-disk-0,size=16G
swap: 512
lxc.cgroup.devices.allow: a
lxc.cap.drop: 
lxc.autodev: 1
lxc.hook.autodev: bash -c 'for dev in $(ls /dev/tty{ACM,S,USB}* 2>/dev/null) $([ -d "/dev/bus" ] && find /dev/bus -type c) /dev/mem /dev/net/tun; do mkdir -p $(dirname ${LXC_ROOTFS_MOUNT}${dev}); for link in $(udevadm info --query=property $dev | sed -n "s/DEVLINKS=//p"); do mkdir -p ${LXC_ROOTFS_MOUNT}$(dirname $link); cp -dR $link ${LXC_ROOTFS_MOUNT}${link}; done; cp -dR $dev ${LXC_ROOTFS_MOUNT}${dev}; done'
whiskerz007 commented 4 years ago

It looks like you are using the LXC from a previous install script. For testing purposes, please run the install script again (with the USB device plugged in) and add just the desired addon. Please report your findings.

tamet83 commented 4 years ago

@whiskerz007 I really thank you. I ran again the script and now Apcupsd addon seems working again. Here the results of your requests.

root@pve:~# echo "######"; lsusb; echo "######"; find /dev/usb -type c; echo "######"; cat /etc/pve/lxc/108.conf
######
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 001 Device 002: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)
Bus 001 Device 004: ID 8087:0aaa Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub######/dev/usb/hiddev0
######
arch: amd64
cores: 1
features: nesting=1
hostname: hassio
memory: 4096
net0: name=eth0,bridge=vmbr0,gw=192.168.1.1,hwaddr=32:46:81:97:67:4E,ip=192.168.1.11/24,type=veth
onboot: 1
ostype: debian
rootfs: local-lvm:vm-108-disk-0,size=16G
swap: 512
lxc.cgroup.devices.allow: a
lxc.cap.drop: 
lxc.autodev: 1
lxc.hook.autodev: bash -c 'for dev in $(ls /dev/tty{ACM,S,USB}* 2>/dev/null) $([ -d "/dev/bus" ] && find /dev/bus -type c) $([ -d "/dev/usb" ] && find /dev/usb -type c)
 /dev/mem /dev/net/tun; do mkdir -p $(dirname ${LXC_ROOTFS_MOUNT}${dev}); for link in $(udevadm info --query=property $dev | sed -n "s/DEVLINKS=//p"); do mkdir -p ${LXC
_ROOTFS_MOUNT}$(dirname $link); cp -dR $link ${LXC_ROOTFS_MOUNT}${link}; done; cp -dR $dev ${LXC_ROOTFS_MOUNT}${dev}; done'

I’d like to buy you a coffee :)

gomez85 commented 4 years ago

hi @whiskerz007 , I ran again the script but the addon still don't start.

this is the result of your request:

`root@pve:~# echo "######"; lsusb; echo "######"; find /dev/usb -type c; echo "######"; cat /etc/pve/lxc/105.conf

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 003: ID 0408:03f1 Quanta Computer, Inc. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 004 Device 004: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO) Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 004: ID 051d:0002 American Power Conversion Uninterruptible Power Supply Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

find: ‘/dev/usb’: No such file or directory

arch: amd64 cores: 1 features: nesting=1 hostname: hassio memory: 1536 net0: name=eth0,bridge=vmbr0,hwaddr=62:39:32:05:CF:38,ip=dhcp,type=veth onboot: 1 ostype: debian rootfs: local-lvm:vm-105-disk-0,size=64G swap: 512 lxc.cgroup.devices.allow: a lxc.cap.drop: lxc.autodev: 1 lxc.hook.autodev: bash -c 'for dev in $(ls /dev/tty{ACM,S,USB}* 2>/dev/null) $([ -d "/dev/bus" ] && find /dev/bus -type c) $([ -d "/dev/usb" ] && find /dev/usb -type c) /dev/mem /dev/net/tun; do mkdir -p $(dirname ${LXC_ROOTFS_MOUNT}${dev}); for link in $(udevadm info --query=property $dev | sed -n "s/DEVLINKS=//p"); do mkdir -p ${LXC_ROOTFS_MOUNT}$(dirname $link); cp -dR $link ${LXC_ROOTFS_MOUNT}${link}; done; cp -dR $dev ${LXC_ROOTFS_MOUNT}${dev}; done'`

whiskerz007 commented 4 years ago

@gomez85 The extent of my ability to support is to make sure the proper devices presented to Proxmox are passed to the LXC. According to your response, Proxmox is unable to find a device in the /dev/usb folder, which the APC addon requires to start. The script will not pass a device (or folder) to the LXC unless it exists on Proxmox before it starts.

The APC is presenting some communication to Proxmox, but it does not present the needed device. This may be due to a lack of a driver installed in Proxmox or a failure of your UPS.

I hope this helps you with troubleshooting.

gomez85 commented 4 years ago

@whiskerz007 , Thanks to @Giancky79 and @tamet83 I found the problem and solved it. To test the addon, I had associated the UPS USB connection with the VM and therefore the LXC container could not quite find it.

After shutting down the VM and restarting the LXC container, the addon started regularly.

So I confirm that the problem is solved for me too.

I would like to thank you for your expertise and availability by offering you a beer.