Bug 2224879

Summary: riello_usb driver not recognize certain common keywords (vendorid,productid,product,vendor,bus
Product: [Fedora] Fedora Reporter: Frantisek Hanzlik <franta>
Component: nutAssignee: Michal Hlavinka <mhlavink>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 38CC: cra, james, mhlavink, orion, scott
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Frantisek Hanzlik 2023-07-23 18:57:14 UTC
I have Riello UPS SEP 2200 ER NP model, connected via USB cable. nut-scanner find it and generates (IMO reasonable) description for /etc/ups/ups.conf :
# nut-scanner -U
Scanning USB bus.
[nutdev1]
        driver = "riello_usb"
        port = "auto"
        vendorid = "04B4"
        productid = "5500"
        product = "USB to Serial"
        vendor = "Cypress Semiconductor"
        bus = "001"

but then driver start fails with syslog messages 'Fatal error: 'vendorid' is not a valid variable name for this driver':

Jul 23 20:33:47 nosec systemd[1]: Starting nut-driver - Network UPS Tools - device driver for nutdev1...
Jul 23 20:33:47 nosec nut-driver@nutdev1[453060]: Network UPS Tools - Riello USB driver 0.07 (2.8.0)
Jul 23 20:33:47 nosec nut-driver@nutdev1[453060]: Warning: This is an experimental driver.
Jul 23 20:33:47 nosec nut-driver@nutdev1[453060]: Some features may not function correctly.
Jul 23 20:33:47 nosec nut-driver@nutdev1[453060]: Fatal error: 'vendorid' is not a valid variable name for this driver.
Jul 23 20:33:47 nosec nut-driver@nutdev1[453060]: Look in the man page or call this driver with -h for a list of
Jul 23 20:33:47 nosec nut-driver@nutdev1[453060]: valid variable names and flags.
Jul 23 20:33:47 nosec nut-driver@nutdev1[453032]: Network UPS Tools - UPS driver controller 2.8.0
Jul 23 20:33:47 nosec nut-driver@nutdev1[453061]: Can't open /run/nut/riello_usb-nutdev1.pid: No such file or directory
Jul 23 20:33:47 nosec nut-driver@nutdev1[453061]: Can't open /run/nut/riello_usb-auto.pid either: No such file or directory
Jul 23 20:33:47 nosec nut-driver@nutdev1[453061]: Network UPS Tools - UPS driver controller 2.8.0
Jul 23 20:33:47 nosec systemd[1]: nut-driver: Control process exited, code=exited, status=1/FAILURE
Jul 23 20:33:47 nosec systemd[1]: nut-driver: Failed with result 'exit-code'.
Jul 23 20:33:47 nosec systemd[1]: Failed to start nut-driver - Network UPS Tools - device driver for nutdev1.

If I comment vendorid= line in ups.conf, then driver start fails on productid keyword:

Jul 23 20:38:54 nosec systemd[1]: Starting nut-driver - Network UPS Tools - device driver for nutdev1...
Jul 23 20:38:54 nosec nut-driver@nutdev1[455385]: Network UPS Tools - Riello USB driver 0.07 (2.8.0)
Jul 23 20:38:54 nosec nut-driver@nutdev1[455385]: Warning: This is an experimental driver.
Jul 23 20:38:54 nosec nut-driver@nutdev1[455385]: Some features may not function correctly.
Jul 23 20:38:54 nosec nut-driver@nutdev1[455385]: Fatal error: 'productid' is not a valid variable name for this driver.
Jul 23 20:38:54 nosec nut-driver@nutdev1[455385]: Look in the man page or call this driver with -h for a list of
Jul 23 20:38:54 nosec nut-driver@nutdev1[455385]: valid variable names and flags.
Jul 23 20:38:54 nosec nut-driver@nutdev1[455357]: Network UPS Tools - UPS driver controller 2.8.0
Jul 23 20:38:54 nosec nut-driver@nutdev1[455386]: Can't open /run/nut/riello_usb-nutdev1.pid: No such file or directory
Jul 23 20:38:54 nosec nut-driver@nutdev1[455386]: Can't open /run/nut/riello_usb-auto.pid either: No such file or directory
Jul 23 20:38:54 nosec nut-driver@nutdev1[455386]: Network UPS Tools - UPS driver controller 2.8.0
Jul 23 20:38:54 nosec systemd[1]: nut-driver: Control process exited, code=exited, status=1/FAILURE
Jul 23 20:38:54 nosec systemd[1]: nut-driver: Failed with result 'exit-code'.
Jul 23 20:38:54 nosec systemd[1]: Failed to start nut-driver - Network UPS Tools - device driver for nutdev1.

It is same with other keywords product, vendor and bus. When UPS description has only driver and port, then driver fails with:

Jul 23 20:48:58 nosec systemd[1]: Starting nut-driver - Network UPS Tools - device driver for nutdev1...
Jul 23 20:48:58 nosec nut-driver@nutdev1[459348]: Network UPS Tools - Riello USB driver 0.07 (2.8.0)
Jul 23 20:48:58 nosec nut-driver@nutdev1[459348]: Warning: This is an experimental driver.
Jul 23 20:48:58 nosec nut-driver@nutdev1[459348]: Some features may not function correctly.
Jul 23 20:48:58 nosec nut-driver@nutdev1[459348]: libusb1: Could not open any HID devices: insufficient permissions on everything
Jul 23 20:48:58 nosec nut-driver@nutdev1[459348]: No supported devices found. Please check your device availability with 'lsusb'
Jul 23 20:48:58 nosec nut-driver@nutdev1[459348]: and make sure you have an up-to-date version of NUT. If this does not help,
Jul 23 20:48:58 nosec nut-driver@nutdev1[459348]: try running the driver with at least 'subdriver', 'vendorid' and 'productid'
Jul 23 20:48:58 nosec nut-driver@nutdev1[459348]: options specified. Please refer to the man page for details about these options
Jul 23 20:48:58 nosec nut-driver@nutdev1[459348]: (man 8 riello_usb).
Jul 23 20:48:58 nosec nut-driver@nutdev1[459320]: Driver failed to start (exit status=1)
Jul 23 20:49:03 nosec nut-driver@nutdev1[459376]: Network UPS Tools - Riello USB driver 0.07 (2.8.0)
Jul 23 20:49:03 nosec nut-driver@nutdev1[459376]: Warning: This is an experimental driver.
Jul 23 20:49:03 nosec nut-driver@nutdev1[459376]: Some features may not function correctly.
Jul 23 20:49:03 nosec nut-driver@nutdev1[459376]: libusb1: Could not open any HID devices: insufficient permissions on everything
Jul 23 20:49:03 nosec nut-driver@nutdev1[459376]: No supported devices found. Please check your device availability with 'lsusb'
Jul 23 20:49:03 nosec nut-driver@nutdev1[459376]: and make sure you have an up-to-date version of NUT. If this does not help,
Jul 23 20:49:03 nosec nut-driver@nutdev1[459376]: try running the driver with at least 'subdriver', 'vendorid' and 'productid'
Jul 23 20:49:03 nosec nut-driver@nutdev1[459376]: options specified. Please refer to the man page for details about these options
Jul 23 20:49:03 nosec nut-driver@nutdev1[459376]: (man 8 riello_usb).
Jul 23 20:49:03 nosec nut-driver@nutdev1[459320]: Driver failed to start (exit status=1)
Jul 23 20:49:08 nosec nut-driver@nutdev1[459394]: Network UPS Tools - Riello USB driver 0.07 (2.8.0)
Jul 23 20:49:08 nosec nut-driver@nutdev1[459394]: Warning: This is an experimental driver.
Jul 23 20:49:08 nosec nut-driver@nutdev1[459394]: Some features may not function correctly.
Jul 23 20:49:08 nosec nut-driver@nutdev1[459394]: libusb1: Could not open any HID devices: insufficient permissions on everything
Jul 23 20:49:08 nosec nut-driver@nutdev1[459394]: No supported devices found. Please check your device availability with 'lsusb'
Jul 23 20:49:08 nosec nut-driver@nutdev1[459394]: and make sure you have an up-to-date version of NUT. If this does not help,
Jul 23 20:49:08 nosec nut-driver@nutdev1[459394]: try running the driver with at least 'subdriver', 'vendorid' and 'productid'
Jul 23 20:49:08 nosec nut-driver@nutdev1[459394]: options specified. Please refer to the man page for details about these options
Jul 23 20:49:08 nosec nut-driver@nutdev1[459394]: (man 8 riello_usb).
Jul 23 20:49:08 nosec nut-driver@nutdev1[459320]: Driver failed to start (exit status=1)
Jul 23 20:49:08 nosec nut-driver@nutdev1[459320]: Network UPS Tools - UPS driver controller 2.8.0
Jul 23 20:49:08 nosec systemd[1]: nut-driver: Control process exited, code=exited, status=1/FAILURE
Jul 23 20:49:08 nosec systemd[1]: nut-driver: Failed with result 'exit-code'.
Jul 23 20:49:08 nosec systemd[1]: Failed to start nut-driver - Network UPS Tools - device driver for nutdev1.
Jul 23 20:49:08 nosec audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=nut-driver@nutdev1 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
Jul 23 20:49:12 nosec systemd[1]: Stopped nut-driver - Network UPS Tools - device driver for nutdev1.



Reproducible: Always




perhaps unrelated small fix for 'grep: warning: stray \ before #' warning message:

--- nut-driver-enumerator.sh_upto_2023.07.23    2023-07-22 23:07:52.000000000 +0200
+++ nut-driver-enumerator.sh    2023-07-23 19:38:28.368764126 +0200
@@ -832,7 +832,7 @@
         -e 's,=\"\([^\ '"$TABCHAR"']*\)\"$,=\1,' \
         -e 's,^\(\[[^]'"$TABCHAR"'\ ]*\]\)['"$TABCHAR"'\ ]*\(#.*\)*$,\1,' \
     | grep -E -v '^$' \
-    | grep -E '([\[\=]|^[^ '"$TABCHAR"']*$|^[^ '"$TABCHAR"']*[ '"$TABCHAR"']*\#.*$)'
+    | grep -E '([\[\=]|^[^ '"$TABCHAR"']*$|^[^ '"$TABCHAR"']*[ '"$TABCHAR"']*#.*$)'
 }