Solved can't get nut 2.8.0 to find usb devices on FreeBSD 13.1p5

Hi,

I have a TrippLIte ECO550 UPS that has been working with nut for years. Recently something must have changed in the USB support, perhaps with the FreeBSD upgrades. Now in dmesg -a I see

Code:
 ...
Setting date via ntp.
 3 Apr 17:09:43 ntpdate[1033]: step time server 38.229.60.9 offset -0.304499 sec
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)
...

Also,

Code:
[ko@wiley ~]$ sudo /usr/local/libexec/nut/usbhid-ups -DDDDD -a eco550
Network UPS Tools - Generic HID driver 0.47 (2.8.0)
USB communication driver (libusb 1.0) 0.43
   0.000000    [D3] do_global_args: var='maxretry' val='3'
   0.000287    [D3] main_arg: var='driver' val='usbhid-ups'
   0.000302    [D3] main_arg: var='port' val='auto'
   0.000322    [D5] send_to_all: SETINFO driver.parameter.port "auto"
   0.000337    [D3] main_arg: var='desc' val='Tripp-Lite ECO550'
   0.000353    [D1] debug level is '5'
   0.000941    [D5] send_to_all: SETINFO device.type "ups"
   0.000954    [D2] Initializing an USB-connected UPS with library libusb-1.0.0 (API: 0x1000102) (NUT subdriver name='USB communication driver (libusb 1.0)' ver='0.43')
   0.000962    [D1] upsdrv_initups (non-SHUT)...
   0.001204    [D2] libusb1: No appropriate HID device found
   0.001214    libusb1: Could not open any HID devices: no USB buses found
   0.001221    No matching HID UPS found
[ko@wiley ~]$



I've searched the web for freebsd libusb1 Could not open any HID devices no USB buses found but couldn't find anything useful.
Does anyone have any ideas?
 
What does # usbconfig say? Is the UPS connected to the machine at all? (The usb cable could be broken, for example).
 
No, it is found:
Code:
root@wiley:/usr/home/ko # usbconfig
...
ugen0.2: <MOSART Semi. 2.4G Wireless Mouse> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
ugen0.3: <vendor 0x0430 product 0x0005> at usbus0, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON (100mA)
ugen4.2: <Tripp Lite TRIPP LITE UPS> at usbus4, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON (100mA)
root@wiley:/usr/home/ko #
 
Maybe permissions? I also use nut (I have EATON Powerware 9130). If it helps somehow, my configuration is here (post 36). The only fix is that in ups.conf the 'port' variable is now set to 'auto' (just like yours).
 
This could be related to this entry in /usr/ports/UPDATING?

Code:
20230116:
  AFFECTS: users of sysutils/nut and sysutils/nut-devel
  AUTHOR: cy@freebsd.org

  As of PR/268960 Network UPS Tools will now run under its own UID and GID
  instead of uucp. Users who wish to continue using the uucp user and
  group may add NUT_USER=uucp and NUT_GROUP=uucp to their make.conf.

  After upgrading sysutils/nut or sysutils/nut-devel with this patch,
  restart devd. Then restart nut. This will fix up the permissions of
  UPS USB devices and allow nut to start normally.

I ran into this problem a few months ago. I do remember, for me, it wasn't as straightforward as outlined above but, in the end, I did get it running properly. IIRC, I also had to physically disconnect the USB plug for my UPS from the system and plug it back in for some reason, YMMV. Double check all relevant permissions for the user, uucp or nut, you elect to use.
 
This could be related to this entry in /usr/ports/UPDATING?

Code:
20230116:
  AFFECTS: users of sysutils/nut and sysutils/nut-devel
  AUTHOR: cy@freebsd.org

  As of PR/268960 Network UPS Tools will now run under its own UID and GID
  instead of uucp. Users who wish to continue using the uucp user and
  group may add NUT_USER=uucp and NUT_GROUP=uucp to their make.conf.

  After upgrading sysutils/nut or sysutils/nut-devel with this patch,
  restart devd. Then restart nut. This will fix up the permissions of
  UPS USB devices and allow nut to start normally.

I ran into this problem a few months ago. I do remember, for me, it wasn't as straightforward as outlined above but, in the end, I did get it running properly. IIRC, I also had to physically disconnect the USB plug for my UPS from the system and plug it back in for some reason, YMMV. Double check all relevant permissions for the user, uucp or nut, you elect to use.
This is a devd issue.

A member of the security-officer team noted that nut using the same UID/GID as uucp was a security concern. It was changed for this reason.

Yes, you can build the port using any UID:GID you wish, i.e. uucp:uucp. However binary packages will always be shipped with UID:GID of nut:nut.

When getting this error, an ls -l of /dev/usb is the first thing to look at. If no device nodes are owned by nut:nut, i.e. one or more owned by uucp:uucp, devd has some old configuration that needs to be removed. It may be possible the old /usr/local/etc/devd/nut-usb.conf was not updated or a user could have copied it to another file, possibly causing it to override the file that is supplied by the nut port/pkg. /dev permissions should be altered by devd when USB devices are attached.
 
Thanks to everyone who responded. The problem was finally solved as follows:
  1. The latest version of the nut port, 2.8.0_22, automates a lot of things, manages all permissions automatically, and is, in general, much easier to get working. Thanks to the maintainer, cy@ for this.
  2. After a long round of emails with cy@, my specific problem turned out to be VirtualBox. I use VirtualBox to run Windows 10 on FreeBSD. The FreeeBSD manual specifies that in order to have USB support in VBox, you need to add to /etc/devfs.rules these lines:
    Code:
    [system=10]add path 'usb/*' mode 0660 group operator
  3. This messes up the automatic USB configuration (permissions) that nut does and the HID UPS becomes inaccessible.
 
Back
Top