[Nut-upsuser] Problems with NUT 2.7.2 on CentOS 7 and using the Mini-Box OpenUPS

Charles Lepple
2015-03-13T13:48:07Z

On Mar 13, 2015, at 8:21 AM, Philip Taylor <philip at kelsotowers.co.uk>
wrote:

> I?m a new user of NUT and the OpenUPS - in the past I?ve used APC hardware
and apcupsd on Centos 6.
>
> I?ve built NUT 2.7.2 from source but used the OpenUPS HID driver v0.4
that?s in github. I?m using firmware version 1.5 on the openups which is the
latest published version; I?ve also tried 1.7 which Mini-box sent to me but
reverted to the published version. Their support seems a bit slow!
>
> I?ve got NUT working OK and the upsd running, with upsmon working OK too -
all is well as long as I leave the power on, or the battery takes over but
doesn?t need to shut down the system!
>
> But if I try to shut down the system using 'upsdrvctl shutdown? I get a
USB error message - ?Can?t claim USB device [04d8:doo4]:? This looks like
permissions but I?ve set up UDEV and the users in accordance with the
instructions.

The documentation isn't explicit about this, but 'upsdrvctl
shutdown' is meant to be run after all of the other processes on the system
have been killed, real filesystems have been unmounted, and the kernel shutdown
syscall is about to be called. Usually the init scripts will take care of this,
although I don't know how CentOS handles that specifically.

This includes the existing usbhid-ups driver - only one process can talk
*directly* to the UPS at once, and it is usually a driver that is working with
upsd.

If you want to test the low-battery shutdown procedure (where upsmon tells the
rest of the system to shut down, then tells the UPS to power off), you can run
'upsmon -c fsd' (Forced ShutDown). The init scripts should call
'upsdrvctl shutdown' implicitly when everything else has stopped.

> Also if the battery runs down, there is no communication from the UPS via
USB - the power just dies. I could use the motherboard toggle to shut down the
system, but then I can?t run pre-shutdown scripts.

I wonder if that is a calibration issue? Most UPSes will recalibrate as part of
their battery test process, and that should update the runtime estimates and
other variables necessary to detect a low battery condition. Since you mentioned
that the test commands don't show up in upscmd, is there a button or jumper
to trigger calibration?

If either the runtime or battery percentage variable is reliable, it should also
be possible to use the 'ignorelb' setting to synthesize the low battery
signal:

   http://www.networkupstools.org/docs/man/ups.conf.html

> I also can?t collect any data by upsrw (returns blank) or upscmd (no
commands available) - though these functions might not be implemented in the
OpenUPS - does anyone know?

Technically, 'upsrw' could have been called 'upsw' since it does
not actually read the variables: it just lists the writable ones, and allows one
to set them. But the OpenUPS driver does not list any HID usage items as
read/write, or as commands, so that is to be expected:

   https://github.com/networkupstools/nut/blob/master/drivers/openups-hid.c#L297

NUT takes a somewhat conservative approach to the USB HID drivers: we only query
for variables and commands that are known to work with that vendor's UPS.
There are some debug modes available in usbhid-ups that would list all of the
potential variables that the firmware supports, but you may not want to run
those on a production system. Let us know (this list or nut-upsdev) if you would
like more details on that.

--
Charles Lepple
clepple at gmail