Netgate 1100 with 24.03-RC and APC Smart-UPS 1000
-
@pfsjap You missed the '-a' option for the ls of /var/db/nut. Please double check and make sure the directory is owned by nut.
Your configuration looks okay.
Can you run the driver by hand in debug mode via ssh please?
First start the service, and then kill the driver:
killall usbhid-ups
Then, run the driver with debug:
/usr/local/libexec/nut/usbhid-ups -DDD -a qnapups
See what error it shows. If it doesn't show enough you can add more 'D's until it does up to "-DDDDDD".
Post the output with the error. This may be lengthy, so it's okay to eliminate duplicated lines in the middle.
Just FYI, I will be going offline for about 48 hours shortly and will look at your output when I return.
-
@dennypage /var/db/nut is owned by nut.
The driver starts, but then stops:
[24.03-RC][admin@pfSense1100.localdomain]/root: /usr/local/libexec/nut/usbhid-ups -DDDDDD -a qnapups Network UPS Tools - Generic HID driver 0.52 (2.8.1.1) USB communication driver (libusb 1.0) 0.46 0.000001 [D5] do_upsconf_args: confupsname=qnapups, var=driver, val=usbhid-ups 0.000088 [D5] do_upsconf_args: call main_arg() 0.000102 [D3] main_arg: var='driver' val='usbhid-ups' 0.000118 [D5] do_upsconf_args: not a main_arg() 0.000131 [D5] do_upsconf_args: this is a 'driver' setting, may we proceed? 0.000145 [D6] testval_reloadable: var=driver, oldval=usbhid-ups, newval=usbhid-ups, reloadable=0, reload_flag=0 0.000161 [D6] testval_reloadable: verdict for (re)loading var=driver value: -1 0.000173 [D5] do_upsconf_args: 'driver' setting already applied with this value 0.000193 [D5] do_upsconf_args: confupsname=qnapups, var=port, val=auto 0.000204 [D5] do_upsconf_args: call main_arg() 0.000215 [D3] main_arg: var='port' val='auto' 0.000229 [D6] testinfo_reloadable: var=port, infoname=driver.parameter.port, newval=auto, reloadable=0, reload_flag=0 0.000241 [D6] testinfo_reloadable: verdict for (re)loading var=port value: 1 0.000290 [D5] send_to_all: SETINFO driver.parameter.port "auto" 0.000391 [D1] Network UPS Tools version 2.8.1.1 (release/snapshot of 2.8.1.1) built with FreeBSD clang version 17.0.6 (https://github.com/llvm/llvm-project.git llvmorg-17.0.6-0-g6009708b4367); Target: aarch64-unknown-freebsd15.0; Thread model: posix and configured with flags: --sysconfdir=/usr/local/etc/nut --program-transform-name= --localstatedir=/var/db/nut --datadir=/usr/local/etc/nut --with-devd-dir=/usr/local/etc/devd --with-drvpath=/usr/local/libexec/nut --with-statepath=/var/db/nut --with-altpidpath=/var/db/nut --with-pidpath=/var/db/nut --with-pkgconfig-dir=/usr/local/libdata/pkgconfig --with-user=nut --with-group=nut --with-python=/usr/local/bin/python3.11 --without-python2 --with-python3=/usr/local/bin/python3.11 --without-nut_monitor --with-ltdl --with-nut-scanner --with-avahi --with-cgi --with-cgipath=/usr/local/www/cgi-bin/nut --with-htmlpath=/usr/local/www/nut --with-gd-includes=-I/usr/local/include --with-gd-libs='-L/usr/local/lib -lgd' --without-dev --without-freeipmi --without-ipmi --with-doc=no --with-modbus --with-neon --without-nss --with-openssl --with-powerman --with-serial --with-snmp --with-usb=auto --prefix=/usr/local --mandir=/usr/local/man --disable-silent-rules --infodir=/usr/local/share/info/ --build=aarch64-portbld-freebsd15.0 0.000429 [D1] debug level is '6' 0.000451 [D5] send_to_all: SETINFO driver.debug "6" 0.000470 [D5] send_to_all: SETFLAGS driver.debug RW NUMBER 0.002571 [D1] Succeeded to become_user(nut): now UID=316 GID=316 0.002739 [D5] send_to_all: SETINFO device.type "ups" 0.002769 [D5] send_to_all: SETINFO driver.state "init.device" 0.002783 [D1] upsdrv_initups (non-SHUT)... 0.002801 [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.46') 0.003507 [D2] libusb1: No appropriate HID device found 0.003576 libusb1: Could not open any HID devices: no USB buses found 0.003590 No matching HID UPS found 0.003661 [D5] send_to_all: SETINFO driver.state "cleanup.exit" 0.003682 upsnotify: failed to notify about state 4: no notification tech defined, will not spam more about it [24.03-RC][admin@pfSense1100.localdomain]/root:
There certainly is USB bus:
[24.03-RC][admin@pfSense1100.localdomain]/root: usbconfig ugen1.1: <Marvell EHCI root HUB> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA) ugen0.1: <Generic XHCI root HUB> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA) ugen0.2: <American Power Conversion Smart-UPS 1000 FW:UPS 09.3 / ID18> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (2mA) [24.03-RC][admin@pfSense1100.localdomain]/root:
-
@pfsjap said in Netgate 1100 with 24.03-RC and APC Smart-UPS 1000:
0.002783 [D1] upsdrv_initups (non-SHUT)...
0.002801 [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.46')
0.003507 [D2] libusb1: No appropriate HID device found
0.003576 libusb1: Could not open any HID devices: no USB buses foundStrange. Immediately following the "Initializing an USB-connected UPS..." line should be a "Checking device 1 of 1" message. It would appear that the USB iterator isn't seeing any USB devices. This could either be an issue with NUT's own usb code, libusb, or a kernel issue.
Were you running 23.09.1 prior to updating to 24.03-RC? Did the UPS work there?
Also, have you tried the other USB port?
-
@dennypage There has been many changes lately due to another problem (Netgate 1100 not rebooting), but if my memory serves me well, I first tried nut in this device running 23.09.1. It didn't work so then used apcupsd for awhile. I would prefer nut, though.
Yes, have tried both USB ports.
-
@pfsjap So, if I understand you correctly, it currently works with apcupsd under 24.03-RC?
-
@dennypage Device is currently running 2nd RC version on which I installed both nut and apcupsd: nut did not work (same driver error msg as before) and apcupsd connected to the UPS.
Both are using the same libusb version (libusb.so.3):
[24.03-RC][admin@pfSense1100.localdomain]/root: ldd /usr/local/libexec/nut/usbhid-ups /usr/local/libexec/nut/usbhid-ups: libusb.so.3 => /usr/lib/libusb.so.3 (0x688505092000) libm.so.5 => /lib/libm.so.5 (0x6885044f5000) libltdl.so.7 => /usr/local/lib/libltdl.so.7 (0x68850627c000) libthr.so.3 => /lib/libthr.so.3 (0x688505b3f000) libc.so.7 => /lib/libc.so.7 (0x68850729c000) [24.03-RC][admin@pfSense1100.localdomain]/root: [24.03-RC][admin@pfSense1100.localdomain]/root: ldd /usr/local/sbin/apcupsd /usr/local/sbin/apcupsd: libwrap.so.6 => /usr/lib/libwrap.so.6 (0x7706afd8a000) libusb.so.3 => /usr/lib/libusb.so.3 (0x7706b0243000) libc++.so.1 => /lib/libc++.so.1 (0x7706b0714000) libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x7706b1454000) libm.so.5 => /lib/libm.so.5 (0x7706b2cf9000) libthr.so.3 => /lib/libthr.so.3 (0x7706b1548000) libc.so.7 => /lib/libc.so.7 (0x7706b1ad1000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x7706b340a000) [24.03-RC][admin@pfSense1100.localdomain]/root:
-
@pfsjap This would generally indicate an issue with NUT's USB library. There is a new version of NUT pending release, although I do not know when it will be pushed. Unfortunately I do not have the resources to do a test arm build.
In the interim, just to make sure it's not a privilege issue, can you test with
user=root
in the Extra Arguments to driver section please?
-
@dennypage It is somehow related to privileges, after setting user=root, nut connected to UPS successfully.
-
@pfsjap Can you have a look at the USB quirks post and see if you are missing a quirk please? Thanks.
-
@dennypage I first checked the vendor and product ids and then checked if there was a quirk and there was (VID=0x051d PID=0x0003):
[24.03-RC][admin@pfSense1100.localdomain]/root: usbconfig dump_device_quirks | grep 0x051d VID=0x051d PID=0x0002 REVLO=0x0000 REVHI=0xffff QUIRK=UQ_HID_IGNORE VID=0x051d PID=0x0003 REVLO=0x0000 REVHI=0xffff QUIRK=UQ_HID_IGNORE [24.03-RC][admin@pfSense1100.localdomain]/root:
Then deleted user=root from driver arguments and restarted nut. It connected to UPS successfully, also after disconnecting and connecting USB cable.
So why is it now working ok? When testing nut and apcupsd above, both were installed, but only one was enabled at a time. After setting user=root and nut working ok, I deinstalled apcupsd. Maybe apcupsd was the culprit, even having been disabled? If that is the case, then I'm sorry and thank you for going through this. ** Edit: or maybe having driver running as root somehow made it work also without it. **
-
@pfsjap Only thing I can think of is that the quirk isn't being recognized and that the kernel is attaching a driver (uhid0). Running the driver as root allows it to detach the driver, which is required in order to access it as a generic USB device. Once the driver is detached, it will always work.
it fails again following a reboot, check to see if the kernel has attached a driver by using show_ifdrv. If it has, then the quirk isn't being applied for some reason.
-
@dennypage After my previous post I already did think about the quirk possibly not being there after reboot, so did shut down 1100 and restarted it. When booted up, nut had connected to the UPS. Quirk being applied is also verified by this:
[24.03-RC][admin@pfSense1100.localdomain]/root: usbconfig ugen1.1: <Marvell EHCI root HUB> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA) ugen0.1: <Generic XHCI root HUB> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA) ugen0.2: <American Power Conversion Smart-UPS 1000 FW:UPS 09.3 / ID18> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (2mA) [24.03-RC][admin@pfSense1100.localdomain]/root: usbconfig -d ugen0.2 show_ifdrv ugen0.2: <American Power Conversion Smart-UPS 1000 FW:UPS 09.3 / ID18> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (2mA) [24.03-RC][admin@pfSense1100.localdomain]/root:
Since I didn't add the quirk, it did come with nut package, right?
-
@pfsjap said in Netgate 1100 with 24.03-RC and APC Smart-UPS 1000:
Since I didn't add the quirk, it did come with nut package, right?
Quirks in FreeBSD are part of the kernel itself. NUT distributes a bunch of quirks, but they are not used in FreeBSD.
I'm glad that it works following reboot. However, this leaves me without any way to explain why it didn't work originally.