[Nut-upsuser] Confusing Generic USB UPS cannot be matched

Arnaud Quette aquette.dev at gmail.com
Thu Dec 1 22:31:01 UTC 2011


2011/12/1 R. G. Newbury <newbury at mandamus.org>:
> On 11/30/2011 04:08 AM, Arnaud Quette wrote:
>
>>>>> Anything else in syslog? What if you enable *.debug from syslog?
>>>>>
>>>>> Also, I am not familiar with the options that Fedora uses to build the
>>>>> NUT RPMs. It could be something to do with tcp_wrappers, although I would
>>>>> have expected a syslog message to that effect.
>>>>
>>>>
>>
>> check that nut udev script (nut/scripts/udev/...rules) is installed on
>> your system, to address device permissions.
>> setting manually won't work, because of device name increment.
>>
>> next, post your ups.conf, upsd.{conf,users} and upsmon.conf (trimmed
>> of password!) for analysis.
>>
>> cheers,
>> Arnaud
>
>
> Arnaud,
>
> I have spent another couple of hours messing with this...... and no great
> progress. In order to avoid any tcp_wrapper error I added ALL: ALL to
> /etc/hosts.allow  (Yes, to be revised later!)
>
>
> Here is the information you requested. Since it is rather large I did not
> copy to the list..

it's always a bad idea to not copy the list!

> I include the steps I took along the way. FYI, the unit
> does seem to work properly, but does not seem to honour the settings. I
> pulled the wall plug, and expected a shutdown in 30 minutes. It ran (and
> BEEPED!!! throughout) for just under an hour with this computer attached.
> The computer is an Asus mini-ITX Atom/ION DualCore 330 motherboard and pulls
> probably somewhere around 30 Watts, so an hour is good. It then shutdown
> cleanly as expected. Obviously, this will be a good UPS for my Zotac ION
> VOIP computer running Trixbox (Asterisk) on CentOS, and the routers.
> Interestingly, it did not wait when I replugged the power, and the computer
> booted instantly.
>
> But I cannot actually control it....
>
>
> Nut was installed using yum from Fedora 14 repos. There were NO udev rules
> added to /etc/udev/rules.d
> Clearly this is a problem with the SPEC file and POST-INSTALL procedures.
> This should be checked for the Fedora 15 and 16 repo rpm's as well.
> I copied the nut-usbups.rules (etc) files from the nut tarball. The unit is
> not listed obviously
>
> All testing was done as root, in an attempt to avoid problems.......
>
> Added to nut-usbups.rules
>
> #  Added by RGNewbury  (newbury at mandamus.org)
> #  Fry's Electronics /Nexxtech/MEC  - blazer_usb
> ATTR{idVendor}=="0001", ATTR{idProduct}=="0000", MODE="664",
> GROUP="@RUN_AS_GROUP@"

if this is the actual file on your system
({/etc,/lib}/udev/rules/...), @RUN_AS_GROUP@ MUST be replaced by the
actual value of the nut group.
for you "nutty"

> **************************
> Re-triggered udev using udevadmin
>
> #output of lsusb AFTER udev-rules installation and re-trigger of udev:
> Device ID now auto-incrementing as expected
> Bus 004 Device 005: ID 0001:0000 Fry's Electronics

annotating 'Bus 004 Device 005' for latter remark...

> The following have not been changed in about a week...
>
> ***************************
> /etc/ups/ups.conf
>
>  [nexxtech]
>        driver = blazer_usb
> #       vendorid = 0001
> #       productid = 0000
> #       port = /dev/bus/usb/004/002
> #  Not used due to udev port increment rules
>        port = AUTO
>        desc = "Nexxtech UPS"
>
> ***************************
> /etc/ups/upsd.users
>
>        [nutty]
>                password = ***pass
>                upsmon master
>
> ***************************
> /etc/ups/upsmon.conf
> RUN_AS_USER nutty at localhost
> MONITOR nexxtech at localhost 1 nutty at localhost  ***pass master

the user should be 'nutty' without hostname, ie:
MONITOR nexxtech at localhost 1 nutty  ***pass master

> # USER  nutty and GROUP  nutty are valid users on the system

don't be fooled by system Vs NUT users.
the ones in upsmon.conf are references to upsd.users.
the same goes for upsrw and upscmd

> ****************************
>
> PERMISSIONS:
> /var/run/nut                                                    # Standard
> directory permissions plus group ownership
>
> drwxr-xr-x  2 root      nutty     1024 Dec  1 10:26 nut
> /etc/ups
> drwxr-xr-x   2 root nutty   1024 Dec  1 10:36 ups               # Ditto
>
> /etc/ups/*
> drwxr-xr-x   2 root nutty  1024 Dec  1 10:36 .
> -rw-rw-rw-   1 root nutty  1419 Nov 17 15:22 nut.conf
> -rw-rw-rw-   1 root nutty  3809 Dec  1 10:26 ups.conf
> -rw-rw-rw-   1 root nutty  2589 Nov 29 13:40 upsd.conf
> -rw-rw-rw-   1 root nutty  2181 Dec  1 10:34 upsd.users
> -rw-rw-rw-   1 root nutty 11956 Dec  1 10:36 upsmon.conf
> -rw-rw-rw-   1 root nutty  3891 Sep 19 05:37 upssched.conf
>
> /dev/bus/usb/004
> drwxr-xr-x 6 root root       120 Nov 29 17:02 ..
> crw-rw-r-- 1 root nutty 189, 384 Dec  1 10:25 001
> crw-rw-r-- 1 root root  189, 388 Dec  1 10:46 005

as per my annotation, '005' should have 'root nutty'.
'001' is problem a remainder of your manual attempt

> #   After udev retrigger and re-plug. For later boots see below
>
> ***********************************
>
>
> # service ups start
>
> Starting UPS driver controller:                            [FAILED]
> Starting upsd:                                             [  OK  ]
> Starting UPS monitor:                                      [  OK  ]
>
> Darn!
> #blazer_usb -a nexxtech
> Network UPS Tools - Megatec/Q1 protocol USB driver 0.03 (2.6.2)
> writepid: fopen /var/run/nut/blazer_usb-nexxtech.pid: Permission denied
> Can't claim USB device [0001:0000]: could not detach kernel driver from
> interface 0: Operation not permitted
>
> Udev retrigger apparently did not work as expected:
>
> ****************************************
>                      RE-BOOT
> ****************************************
>
> from /var/log/messages
>
> Dec  1 10:53:49 tor2 kernel: [    3.278065] usb 4-4: new low speed USB
> device using ohci_hcd and address 2
>
> Dec  1 10:53:49 tor2 kernel: [   13.480046] usb 4-4: New USB device found,
> idVendor=0001, idProduct=0000
> Dec  1 10:53:49 tor2 kernel: [   13.480287] usb 4-4: New USB device strings:
> Mfr=1, Product=2, SerialNumber=0
> Dec  1 10:53:49 tor2 kernel: [   13.480528] usb 4-4: Product: MEC0002
> Dec  1 10:53:49 tor2 kernel: [   13.480752] usb 4-4: Manufacturer: MEC
>
> Dec  1 10:54:15 tor2 blazer_usb[2100]: Startup successful
> Dec  1 10:54:15 tor2 upsd[2102]: /etc/ups/upsd.conf is world readable
> Dec  1 10:54:15 tor2 upsd[2102]: listening on 127.0.0.1 port 3493
> Dec  1 10:54:15 tor2 upsd[2102]: listening on ::1 port 3493
> Dec  1 10:54:15 tor2 upsd[2102]: /var/run/nut is world readable
> Dec  1 10:54:15 tor2 upsd[2102]: Connected to UPS [nexxtech]:
> blazer_usb-nexxtech
> Dec  1 10:54:15 tor2 upsd[2102]: /etc/ups/upsd.users is world readable
> Dec  1 10:54:15 tor2 upsd[2103]: Startup successful
> Dec  1 10:54:15 tor2 upsmon[2106]: Startup successful
> Dec  1 10:54:15 tor2 upsd[2103]: User nutty at 127.0.0.1 logged into UPS
> [nexxtech]
>
> NOTE: To ensure that the network setup is stable, the network is restarted
> in /etc/rc.d/rc.local. The services ntpd and ups are started in rc.local and
> not by using 'chkconfig ups on'
>
>
> from /var/log/boot.log
>
> Starting UPS driver controller: [ OK ]
> Starting upsd:                  [ OK ]
> Starting UPS monitor:           [ OK ]
>
> ***************************************
>
> # service ups status
> upsmon (pid 2107 2106) is running...
>
> BETTER!
>
>
> # upsc nexxtech
> battery.voltage:13.50
> battery.voltage.nominal:12.0
> beeper.status:disabled
> device.mfr:NEXXTECH
> device.model:6118507
> device.type:ups
> driver.name: blazer_usb
> driver.parameter.pollinterval:2
> driver.parameter.port:AUTO
> driver.version:2.6.2
> driver.version.internal: 0.03
> input.current.nominal:3.0
> input.frequency:60.1
> input.frequency.nominal: 60
> input.voltage: 121.0
> input.voltage.fault: 165.0
> input.voltage.nominal: 115
> output.voltage: 121.0
>
> ups.delay.shutdown: 30
> ups.delay.start: 180
> ups.firmware: VER 1.00UL
> ups.load: 42
>
> ups.mfr: NEXXTECH
> ups.model: 6118507
> ups.productid: 0000
> ups.status: OL
> ups.temperature: 0.0
> ups.type: offline / line interactive
> ups.vendorid: 0001
>
> ************************************

seems my udev rules remark is void...

> # upscmd -l nexxtech
> Instant commands supported on UPS [nexxtech]:
>
> beeper.toggle - Toggle the UPS beeper
> load.off - Turn off the load immediately
> load.on - Turn on the load immediately
> shutdown.return - Turn off the load and return when power is back
> shutdown.stayoff - Turn off the load and remain off
> shutdown.stop - Stop a shutdown in progress
> test.battery.start - Start a battery test
> test.battery.start.deep - Start a deep battery test
> test.battery.start.quick - Start a quick battery test
> test.battery.stop - Stop the battery test
>
>
> # upscmd -u nutty at 127.0.0.1 -p ***pass nexxtech beeper.toggle
>
> Unexpected response from upsd: ERR ACCESS-DENIED
>
> AAAAAAARRRRRGGGGGGHHHHHHH!

as per my above comment, remove "@127.0.0.1", ie:

$ upscmd -u nutty -p ***pass nexxtech beeper.toggle

> On the reboot I saw a udev message flash past about an error referring to
> @RUN_AS_GROUP@
> That message does not appear in /var/log/messages nor in dmesg....
> Strange....
>
> **********************************
>
> AMENDED nut-usbups.rules
>
> #  Added by RGNewbury  (newbury at mandamus.org)
> #  Fry's Electronics /Nexxtech/MEC  - blazer_usb
> ATTR{idVendor}=="0001", ATTR{idProduct}=="0000", MODE="664", GROUP="nutty"

confirmed and fixed

> REBOOTED AGAIN
>
> from /var/log/messages
>
> Dec  1 11:41:44 tor2 blazer_usb[2080]: Startup successful              # Yes
> I know these should NOT be world readable!
> Dec  1 11:41:44 tor2 upsd[2082]: /etc/ups/upsd.conf is world readable
> Dec  1 11:41:44 tor2 upsd[2082]: listening on 127.0.0.1 port 3493
> Dec  1 11:41:44 tor2 upsd[2082]: listening on ::1 port 3493
> Dec  1 11:41:44 tor2 upsd[2082]: /var/run/nut is world readable
> Dec  1 11:41:44 tor2 upsd[2082]: Connected to UPS [nexxtech]:
> blazer_usb-nexxtech
> Dec  1 11:41:44 tor2 upsd[2082]: /etc/ups/upsd.users is world readable
> Dec  1 11:41:44 tor2 upsd[2083]: Startup successful
> Dec  1 11:41:44 tor2 upsmon[2086]: Startup successful
> Dec  1 11:41:44 tor2 upsd[2083]: User nutty at 127.0.0.1 logged into UPS
> [nexxtech]
>
> [root at tor2 log]# dmesg | grep udev
> [    2.127033] udev[104]: starting version 161
> [    5.286275] udev[398]: starting version 161        # No error messages
>
> [root at tor2 log]# dmesg | grep usb
> [    0.546196] usbcore: registered new interface driver usbfs
> [    0.547006] usbcore: registered new interface driver hub
> [    0.547262] usbcore: registered new device driver usb
> [    1.818882] usbcore: registered new interface driver hiddev
> [    1.819182] usbcore: registered new interface driver usbhid
> [    1.819420] usbhid: USB HID core driver
> [    8.715081] usbcore: registered new interface driver btusb
> [   13.473400] usb 4-4: New USB device found, idVendor=0001, idProduct=0000
> [   13.473640] usb 4-4: New USB device strings: Mfr=1, Product=2,
> SerialNumber=0
> [   13.473881] usb 4-4: Product: MEC0002
> [   13.474123] usb 4-4: Manufacturer: MEC
> [   13.505774] generic-usb 0003:0001:0000.0003: hiddev97,hidraw2: USB HID
> v1.00 Device [MEC MEC0002] on usb-0000:00:06.0-4/input0
> [   44.492226] usb 4-4: usbfs: USBDEVFS_CONTROL failed cmd blazer_usb rqt
> 128 rq 6 len 255 ret -110
> [   45.494192] usb 4-4: usbfs: USBDEVFS_CONTROL failed cmd blazer_usb rqt
> 128 rq 6 len 255 ret -110
>
> ********************************************
>
> AND
>
>
> [root at tor2 log]# upscmd -u nutty at 127.0.0.1 -p ***pass nexxtech
> beeper.toggle
>
> Unexpected response from upsd: ERR ACCESS-DENIED

addressed

> And I am where I was.......Except we can see the usbfs error
> USBDEVFS_CONTROL .....

it happens from time to time, no harm.

cheers,
Arnaud
-- 
Linux / Unix Expert R&D - Eaton - http://powerquality.eaton.com
Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org/
Debian Developer - http://www.debian.org
Free Software Developer - http://arnaud.quette.free.fr/



More information about the Nut-upsuser mailing list