[Nut-upsuser] NUT can't connect to USB UPS on OpenBSD

Marc-André Harbec maharbec at gmail.com
Thu Aug 11 02:15:29 BST 2022


Hi everyone,

I have a problem trying to configure NUT with a Eaton 5S1500LCD on
OpenBSD. It is listed as supported
(https://networkupstools.org/ddl/Eaton/5S1500LCD.html) with the driver
`usbhid-ups`, from at least version 2.6.4 and upward.

The OpenBSD that I have is 7.1. I installed NUT via `pkg_add nut` and
it installed version 2.8.0. No matter what I do, I can't seem to make
NUT see the attached UPS via USB.

What follows (between the pound signs) is some debug info on my setup
of OpenBSD and NUT. The symbol ❯ is the command prompt and I sometime
add some explanation as comments above the prompt.

############################################################


❯ uname -a
OpenBSD gateway.home.lan 7.1 GENERIC.MP#0 amd64


# The relevant installed packages for NUT
❯ doas pkg_info | grep -E "nut|usb"
libusb1-1.0.23p2    library for USB device access from userspace
nut-2.8.0           UPS monitoring program supporting many brands


# USB UPS is found within the OS
❯ dmesg
[...]
uhidev2 at uhub0 port 1 configuration 1 interface 0 "EATON Ellipse
PRO" rev 1.10/1.00 addr 6
uhidev2: iclass 3/0, 255 report ids
upd0 at uhidev2
[...]


❯ doas cat /var/log/messages
[...]
Aug 10 16:12:54 gateway /bsd: uhidev2 at uhub0 port 1 configuration 1
interface 0 "EATON Ellipse PRO" rev 1.10/1.00 addr 6
Aug 10 16:12:58 gateway /bsd: uhidev2: iclass 3/0, 255 report ids
Aug 10 16:12:58 gateway /bsd: upd0 at uhidev2
[...]


❯ doas usbdevs -v
Controller /dev/usb0:
addr 01: 8086:0000 Intel, xHCI root hub
     super speed, self powered, config 1, rev 1.00
     driver: uhub0
addr 02: 05e3:0610 Genesys Logic, USB2.0 Hub
     high speed, self powered, config 1, rev 32.98
     driver: uhub1
addr 03: 05e3:0610 Genesys Logic, USB2.0 Hub
     high speed, self powered, config 1, rev 32.98
     driver: uhub2
addr 04: 0557:7000 ATEN International, product 0x7000
     high speed, self powered, config 1, rev 0.00
     driver: uhub3
addr 05: 0557:2419 ATEN International, product 0x2419
     low speed, power 160 mA, config 1, rev 1.00
     driver: uhidev0
     driver: uhidev1
addr 06: 0463:ffff EATON, Ellipse PRO
     low speed, power 20 mA, config 1, rev 1.00, iSerial P344M08JTP
     driver: uhidev2


# These are all the USB devices on my machine
❯ doas ls -l /dev/usb*
crw-r-----  1 root  usb   61,   0 Jun 24 16:21 /dev/usb0
crw-r-----  1 root  usb   61,   1 Jun 24 16:21 /dev/usb1
crw-r-----  1 root  usb   61,   2 Jun 24 16:21 /dev/usb2
crw-r-----  1 root  usb   61,   3 Jun 24 16:21 /dev/usb3
crw-r-----  1 root  usb   61,   4 Jun 24 16:21 /dev/usb4
crw-r-----  1 root  usb   61,   5 Jun 24 16:21 /dev/usb5
crw-r-----  1 root  usb   61,   6 Jun 24 16:21 /dev/usb6
crw-r-----  1 root  usb   61,   7 Jun 24 16:21 /dev/usb7


# The group `usb` have been created by me, to allow user `root` and
`_ups` access to USB devices
❯ doas cat /etc/passwd | grep -E "root|nut|ups"
root:*:0:0:Charlie &:/root:/bin/ksh
daemon:*:1:1:The devil himself:/root:/sbin/nologin
_ups:*:529:529:UPS User:/var/empty:/sbin/nologin
nutmon:*:1003:1005::/home/nutmon:/sbin/nologin


❯ doas cat /etc/group | grep -E "root|nut|ups"
wheel:*:0:root,me
kmem:*:2:root
sys:*:3:root
tty:*:4:root
operator:*:5:root
staff:*:20:root
guest:*:31:root
_ups:*:529:nutmon
usb:*:1004:root,_ups
nutmon:*:1005:


# `nut-scanner` is able to found the UPS
❯ doas nut-scanner -U -N
Scanning USB bus.
[nutdev1]
    driver = "usbhid-ups"
    port = "auto"
    vendorid = "0463"
    productid = "FFFF"
    product = "Ellipse PRO"
    serial = "P344M08JTP"
    vendor = "EATON"
    bus = "000"


# My actual `/etc/nut/ups.conf` file
❯ doas cat /etc/nut/ups.conf
# https://networkupstools.org/docs/man/ups.conf.html

user = _ups

# Should mitigate race condition with slow devices.
maxretry = 3

[eaton1]
    desc = "gateway's Eaton 5S1000LCD"
    driver = "usbhid-ups"
    port = "auto"
    vendorid = "0463"
    productid = "FFFF"
    product = "Ellipse PRO"
    serial = "P344M08JTP"
    vendor = "EATON"


# Trying to start the driver
❯ doas upsdrvctl -u _ups start
Network UPS Tools - UPS driver controller 2.8.0
Network UPS Tools - Generic HID driver 0.47 (2.8.0)
USB communication driver (libusb 1.0) 0.43
libusb1: Could not open any HID devices: no USB buses found
No matching HID UPS found
Driver failed to start (exit status=1)


# Trying the NUT USB driver directly, in debug mode
❯ doas usbhid-ups -a eaton1 -u _ups -DD
Network UPS Tools - Generic HID driver 0.47 (2.8.0)
USB communication driver (libusb 1.0) 0.43
   0.000000    [D1] debug level is '2'
   0.003245    [D2] Initializing an USB-connected UPS with library
libusb-1.0.23 (API: 0x1000107) (NUT subdriver name='USB communication
driver (libusb 1.0)' ver='0.43')
   0.003400    [D1] upsdrv_initups (non-SHUT)...
   0.007256    [D2] libusb1: No appropriate HID device found
   0.007493    libusb1: Could not open any HID devices: no USB buses found
   0.007598    No matching HID UPS found


# Now, the same thing, but while using `root` instead of `_ups`
❯ doas usbhid-ups -a eaton1 -u root -DD
Network UPS Tools - Generic HID driver 0.47 (2.8.0)
USB communication driver (libusb 1.0) 0.43
   0.000000    [D1] debug level is '2'
   0.003353    [D2] Initializing an USB-connected UPS with library
libusb-1.0.23 (API: 0x1000107) (NUT subdriver name='USB communication
driver (libusb 1.0)' ver='0.43')
   0.003515    [D1] upsdrv_initups (non-SHUT)...
   0.011936    [D2] Checking device 1 of 6 (8086/0000)
   [...]
   0.016512    [D2] Device does not match - skipping
   0.017065    [D2] Checking device 2 of 6 (05E3/0610)
   [...]
   0.019659    [D2] Device does not match - skipping
   0.019864    [D2] Checking device 3 of 6 (05E3/0610)
   [...]
   0.022488    [D2] Device does not match - skipping
   0.022647    [D2] Checking device 4 of 6 (0557/7000)
   [...]
   0.023874    [D2] Device does not match - skipping
   0.024030    [D2] Checking device 5 of 6 (0557/2419)
   [...]
   0.025274    [D2] Device does not match - skipping
   0.025460    [D2] Checking device 6 of 6 (0463/FFFF)
   0.437474    [D2] - VendorID: 0463
   0.437636    [D2] - ProductID: ffff
   0.437726    [D2] - Manufacturer: EATON
   0.437851    [D2] - Product: Ellipse PRO
   0.437973    [D2] - Serial Number: P344M08JTP
   0.438054    [D2] - Bus: 000
   0.438199    [D2] - Device: unknown
   0.438285    [D2] - Device release number: 0100
   0.438368    [D2] Trying to match device
   0.438467    [D2] match_function_subdriver (non-SHUT mode): matching
a device...
   0.439016    [D2] Device matches
   0.439185    [D2] Reading first configuration descriptor
   0.854669    [D2] Claimed interface 0 successfully
   0.920447    [D2] HID descriptor length 1145
   4.587203    [D2] Report Descriptor size = 1145
   4.588402    Using subdriver: MGE HID 1.46
   4.588548    [D1] 118 HID objects found
   4.773641    [D1] Path:
UPS.BatterySystem.Battery.AudibleAlarmControl, Type: Feature,
ReportID: 0x20, Offset: 0, Size: 8, Value: 2
   [...]
   6.098336    [D1] Path: UPS.PowerSummary.Voltage, Type: Feature,
ReportID: 0x07, Offset: 8, Size: 16, Value: 27.4
   6.216533    [D2] get_model_name(Ellipse PRO, 1500 )

   6.216715    [D2] comparing with: ellipse 300
   [...]
   6.225152    [D2] comparing with: Galaxy 3000 30 kVA
   6.225555    [D2] Report descriptor retrieved (Reportlen = 1145)
   6.225723    [D2] Found HID device
   6.226000    [D1] Detected a UPS: EATON/Ellipse PRO 1500
   6.226302    [D2] Path: UPS.PowerSummary.Country, Type: Feature,
ReportID: 0x15, Offset: 0, Size: 8, Value: 1
   [...]
   6.874653    [D2] Path: UPS.PowerSummary.AudibleAlarmControl, Type:
Feature, ReportID: 0x1f, Offset: 0, Size: 8, Value: 2
   6.875822    [D1] upsdrv_initinfo...
   6.875990    [D1] upsdrv_updateinfo...
   6.876494    nut_libusb_get_interrupt: Operation not supported or
unimplemented on this platform
   6.876618    [D1] Got 0 HID objects...
   6.876713    [D1] Quick update...
   6.876880    [D2] Path: UPS.PowerSummary.DelayBeforeStartup, Type:
Feature, ReportID: 0x0a, Offset: 0, Size: 32, Value: -1
   [...]
   6.877470    [D2] Path:
UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit, Type:
Feature, ReportID: 0x01, Offset: 1, Size: 1, Value: 0
   6.880985    [D2] dstate_init: sock /var/db/nut/usbhid-ups-eaton1 open on fd 5
   6.881813    [D1] Group and/or user account for this driver was
customized ('root:_ups') compared to built-in defaults. Fixing socket
'/var/db/nut/usbhid-ups-eaton1' ownership/access.
   6.882433    [D1] Group access for this driver successfully fixed
   6.882683    [D1] upsdrv_updateinfo...
   6.882865    nut_libusb_get_interrupt: Operation not supported or
unimplemented on this platform
   6.883012    [D1] Got 0 HID objects...
   6.883116    [D1] Quick update...
   6.883276    [D2] Path: UPS.PowerSummary.DelayBeforeStartup, Type:
Feature, ReportID: 0x0a, Offset: 0, Size: 32, Value: -1
   [...]
   6.883888    [D2] Path:
UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit, Type:
Feature, ReportID: 0x01, Offset: 1, Size: 1, Value: 0
   8.891684    [D1] upsdrv_updateinfo...
   8.891909    nut_libusb_get_interrupt: Operation not supported or
unimplemented on this platform
   8.892053    [D1] Got 0 HID objects...
   8.892227    [D1] Quick update...
   8.944733    [D2] Path: UPS.PowerSummary.DelayBeforeStartup, Type:
Feature, ReportID: 0x0a, Offset: 0, Size: 32, Value: -1
   [...]
   9.041782    [D2] Path:
UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit, Type:
Feature, ReportID: 0x01, Offset: 1, Size: 1, Value: 0
  10.903874    [D1] upsdrv_updateinfo...
  10.904100    nut_libusb_get_interrupt: Operation not supported or
unimplemented on this platform
  10.904246    [D1] Got 0 HID objects...
  10.904414    [D1] Quick update...
  10.952307    [D2] Path: UPS.PowerSummary.DelayBeforeStartup, Type:
Feature, ReportID: 0x0a, Offset: 0, Size: 32, Value: -1
   [...]
  11.048981    [D2] Path:
UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit, Type:
Feature, ReportID: 0x01, Offset: 1, Size: 1, Value: 0
<CTL+C>


# Looking at the socket
❯ doas ls -al /var/db/nut
total 8
drwx------   2 _ups  wheel  512 Aug 10 20:35 .
drwxr-xr-x  10 root  wheel  512 Aug  6 03:30 ..
srw-rw----   1 root  _ups     0 Aug 10 20:35 usbhid-ups-eaton1


############################################################

I don't know why the driver requires the `root` user, I thought I had
configured the `_ups` properly everywhere. But even with `root`, it
can't start. That's pretty much all I can think of on how to debug the
thing. I just don't know what is missing in all the stuff I listed.

Any help would be appreciated, thanks,
M-A Harbec



More information about the Nut-upsuser mailing list