I have a CyperPower OR500LCDRM1U connected via USB to nut on Debian (proxmox). After some time (hours?), the connection to UPS is lost. Extremely frustrating because UPS is a critical component. It might be that USB reinitializes, temporarily device becomes unavailable for a few seconds or similar. I don't know. Nothing in particular in the logs but I can't really monitor it either because it only happens after several hours and then I see realize it the next day.
Regardless, my expectation is that in this case it should just re-open the device!
My logs become filled with
Jul 30 00:19:36 pve1 upsmon[2066730]: UPS [ups@localhost]: connect failed: Connection failure: Connection timed out
Jul 30 00:19:36 pve1 upsmon[2066730]: UPS ups@localhost is unavailable
Jul 30 00:21:51 pve1 upsmon[2066730]: UPS [ups@localhost]: connect failed: Connection failure: Connection timed out
Jul 30 00:24:06 pve1 upsmon[2066730]: UPS [ups@localhost]: connect failed: Connection failure: Connection timed out
Jul 30 00:26:21 pve1 upsmon[2066730]: UPS [ups@localhost]: connect failed: Connection failure: Connection timed out
Jul 30 00:26:21 pve1 upsmon[2066730]: UPS ups@localhost is unavailable
When I strace -p the usbhid-ups -a ups process, I get:
select(7, [5 6], NULL, NULL, {tv_sec=1, tv_usec=898414}) = 0 (Timeout)
ioctl(4, USBDEVFS_SUBMITURB, 0x7ffe4f699750) = 0
ioctl(4, USBDEVFS_REAPURBNDELAY, 0x7ffe4f699718) = -1 EAGAIN (Resource temporarily unavailable)
select(5, NULL, [4], NULL, {tv_sec=0, tv_usec=1000}) = 0 (Timeout)
ioctl(4, USBDEVFS_REAPURBNDELAY, 0x7ffe4f699718) = -1 EAGAIN (Resource temporarily unavailable)
select(5, NULL, [4], NULL, {tv_sec=0, tv_usec=1000}) = 0 (Timeout)
ioctl(4, USBDEVFS_REAPURBNDELAY, 0x7ffe4f699718) = -1 EAGAIN (Resource temporarily unavailable)
select(5, NULL, [4], NULL, {tv_sec=0, tv_usec=1000}) = 0 (Timeout)
ioctl(4, USBDEVFS_REAPURBNDELAY, 0x7ffe4f699718) = -1 EAGAIN (Resource temporarily unavailable)
select(5, NULL, [4], NULL, {tv_sec=0, tv_usec=1000}) = 0 (Timeout)
ioctl(4, USBDEVFS_REAPURBNDELAY, 0x7ffe4f699718) = -1 EAGAIN (Resource temporarily unavailable)
select(5, NULL, [4], NULL, {tv_sec=0, tv_usec=1000}) = 0 (Timeout)
ioctl(4, USBDEVFS_REAPURBNDELAY, 0x7ffe4f699718) = -1 EAGAIN (Resource temporarily unavailable)
select(5, NULL, [4], NULL, {tv_sec=0, tv_usec=1000}) = 0 (Timeout)
ioctl(4, USBDEVFS_REAPURBNDELAY, 0x7ffe4f699718) = -1 EAGAIN (Resource temporarily unavailable)
select(5, NULL, [4], NULL, {tv_sec=0, tv_usec=1000}) = 0 (Timeout)
ioctl(4, USBDEVFS_REAPURBNDELAY, 0x7ffe4f699718) = -1 EAGAIN (Resource temporarily unavailable)
select(5, NULL, [4], NULL, {tv_sec=0, tv_usec=1000}) = 0 (Timeout)
ioctl(4, USBDEVFS_REAPURBNDELAY, 0x7ffe4f699718) = -1 EAGAIN (Resource temporarily unavailable)
select(5, NULL, [4], NULL, {tv_sec=0, tv_usec=1000}) = 0 (Timeout)
ioctl(4, USBDEVFS_REAPURBNDELAY, 0x7ffe4f699718) = -1 EAGAIN (Resource temporarily unavailable)
select(5, NULL, [4], NULL, {tv_sec=0, tv_usec=1000}) = 0 (Timeout)
ioctl(4, USBDEVFS_REAPURBNDELAY, 0x7ffe4f699718) = -1 EAGAIN (Resource temporarily unavailable)
select(5, NULL, [4], NULL, {tv_sec=0, tv_usec=1000}) = 0 (Timeout)
ioctl(4, USBDEVFS_REAPURBNDELAY, 0x7ffe4f699718) = -1 EAGAIN (Resource temporarily unavailable)
select(5, NULL, [4], NULL, {tv_sec=0, tv_usec=1000}) = 1 (out [4], left {tv_sec=0, tv_usec=251})
ioctl(4, USBDEVFS_REAPURBNDELAY, 0x7ffe4f699718) = 0
If I restart the nut driver (systemctl restart nut-driver.service) it always works again (for a few hours).
I have created /etc/udev/rules.d/90-nut-ups.rules with content:
# Rule for the UPS - use lsusb for idVendor and idProduct
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0764", ATTR{idProduct}=="0601", MODE="0660", GROUP="nut"
In my /etc/nut/ups.conf I have:
maxretry = 3
[ups]
driver = usbhid-ups
port = auto
desc = "CyberPower PR1500LCDRT2U"
vendorid = 0764
productid = 0601
My UPS becomes available as the following device file:
# ls -la /dev/bus/usb/001/004
crw-rw-r-- 1 root nut 189, 3 Aug 4 02:30 /dev/bus/usb/001/004
I am not providing the remaining nut config files because the issue is clearly related to the usbhid-ups driver and connection via upsc ups fails.
# cat /etc/debian_version
11.6
# uname -a
Linux pve1 5.15.85-1-pve #1 SMP PVE 5.15.85-1 (2023-02-01T00:00Z) x86_64 GNU/Linux
#
Is there anything I can do to fix this?