networkupstools / nut

The Network UPS Tools repository. UPS management protocol Informational RFC 9271 published by IETF at https://www.rfc-editor.org/info/rfc9271 Please star NUT on GitHub, this helps with sponsorships!
https://networkupstools.org/
Other
1.99k stars 349 forks source link

Blazer_USB works with UPS but not when I try to switch to NutDrv_QX: Driver failed to start (exit status=1) #2359

Open binarydepth opened 7 months ago

binarydepth commented 7 months ago
/lib/nut/usbhid-ups -a aeg -DDDDDD -d 1                                                                                                                                                                              ✔  41s  
Network UPS Tools - Generic HID driver 0.52 (2.8.1)
USB communication driver (libusb 1.0) 0.46
Error: Section aeg not found in ups.conf
upsnotify: notify about state 4 with libsystemd: was requested, but not running as a service unit now, will not spam more about it
upsnotify: failed to notify about state 4: no notification tech defined, will not spam more about it

driver = "blazer_usb" langid_fix="0x409"

driver = "nutdrv_qx" //used to switch

port = "auto" vendorid = "0001" productid = "0000" bus = "005" device = "002" busport = "002"

sudo upsdrvctl start
Network UPS Tools - UPS driver controller 2.8.1 Network UPS Tools - Megatec/Q1 protocol USB driver 0.17 (2.8.1) Duplicate driver instance detected (PID file /run/nut/blazer_usb-megatec.pid exists)! Terminating other driver!

Broadcast message from nut@user (somewhere) (Wed Mar 13 05:51:34 2024):

Communications with UPS megatec@localhost lost

Please note that this driver is deprecated and will not receive new development. If it works for managing your devices - fine, but if you are running it to try setting up a new device, please consider the newer nutdrv_qx instead, which should handle all 'Qx' protocol variants for NUT. (Please also report if your device works with this driver, but nutdrv_qx would not actually support it with any subdriver!)

Switch to NutDrv_QX

sudo upsdrvctl start  ✔ Network UPS Tools - UPS driver controller 2.8.1 Network UPS Tools - Generic Q USB/Serial driver 0.36 (2.8.1) USB communication driver (libusb 1.0) 0.46 Can't claim USB device [0001:0000]@0/0: Entity not found upsnotify: notify about state 4 with libsystemd: was requested, but not running as a service unit now, will not spam more about it upsnotify: failed to notify about state 4: no notification tech defined, will not spam more about it Driver failed to start (exit status=1) Network UPS Tools - Generic Q USB/Serial driver 0.36 (2.8.1) USB communication driver (libusb 1.0) 0.46 Can't claim USB device [0001:0000]@0/0: Entity not found upsnotify: notify about state 4 with libsystemd: was requested, but not running as a service unit now, will not spam more about it upsnotify: failed to notify about state 4: no notification tech defined, will not spam more about it Driver failed to start (exit status=1) Network UPS Tools - Generic Q* USB/Serial driver 0.36 (2.8.1) USB communication driver (libusb 1.0) 0.46 Can't claim USB device [0001:0000]@0/0: Entity not found upsnotify: notify about state 4 with libsystemd: was requested, but not running as a service unit now, will not spam more about it upsnotify: failed to notify about state 4: no notification tech defined, will not spam more about it Driver failed to start (exit status=1)

jimklimov commented 7 months ago

The first part says Error: Section aeg not found in ups.conf and indeed I do not see an [aeg] in the ups.conf excerpt (or is it the full file content - then certainly missing that bit?) Drivers would check that their name matches the driver in the section, so that would be another point for them to complain about mismatches, BTW (usbhid-ups vs. blazer_usb or nutdrv_qx).

Note that for testing you can start driver programs directly with -s arbitraryUpsName and ALL options specified as a series of -x key=value.

FWIW, later "screenshots" indicate a configured section named megatec. And as far as that trail says, you start that one (/run/nut/blazer_usb-megatec.pid) and then try to start with nutdrv_qx. The port is occupied by the blazer driver which you did not indicate stopping, so nutdrv_qx can not use it (termination of the other instance pertains to same-driver fratricide, as a workaround for processes stuck in I/O, etc.).

Not sure what your OS is, but it may be that systemd keeps the driver instance alive (which would also conflict with services you start manually); the nut-driver-enumerator family of services can create nut-driver@name instances based on ups.conf sections (see https://github.com/networkupstools/nut/wiki/nut%E2%80%90driver%E2%80%90enumerator-(NDE) in Wiki).

Potentially, bus, device and busport options can also be troublesome as they depend on OS device (re-)enumeration which can change over time. Try commenting those away too.