我有一个 CyperPower OR500LCDRM1U 通过 USB 连接到 Debian (proxmox) 上的螺母。一段时间(几小时?)后,与 UPS 的连接丢失。非常令人沮丧,因为 UPS 是一个关键组件。它可能当 USB 重新初始化时,设备会暂时变得不可用几秒钟或类似的时间。我不知道。日志中没有什么特别的,但我也无法真正监控它,因为它只在几个小时后发生,然后我发现第二天就意识到了。
无论如何,我的期望是在这种情况下应该重新打开设备!
我的日志充满了
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
当我处理strace -p
这个usbhid-ups -a ups
过程时,我得到:
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
如果我重新启动螺母驱动程序 ( systemctl restart nut-driver.service
),它总是会再次工作(几个小时)。
我创建的/etc/udev/rules.d/90-nut-ups.rules
内容:
# Rule for the UPS - use lsusb for idVendor and idProduct
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0764", ATTR{idProduct}=="0601", MODE="0660", GROUP="nut"
在我的/etc/nut/ups.conf
我有:
maxretry = 3
[ups]
driver = usbhid-ups
port = auto
desc = "CyberPower PR1500LCDRT2U"
vendorid = 0764
productid = 0601
我的 UPS 可作为以下设备文件使用:
# ls -la /dev/bus/usb/001/004
crw-rw-r-- 1 root nut 189, 3 Aug 4 02:30 /dev/bus/usb/001/004
我不提供剩余的坚果配置文件,因为该问题显然与 usbhid-ups 驱动程序和连接upsc ups
失败有关。
# 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
#
我能做些什么来解决这个问题吗?
答案1
pollInterval
我通过将默认值(2 秒)增加到 15 秒解决了这个问题。
/etc/nut/ups.conf
:
maxretry = 3
[ups]
driver = usbhid-ups
port = auto
desc = "CyberPower PR1500LCDRT2U"
vendorid = 0764
productid = 0601
pollinterval = 15 # seconds