Help getting NUT working with CyberPower UPS

Started by FullyBorked, March 21, 2021, 07:19:44 PM

Previous topic - Next topic
March 21, 2021, 07:19:44 PM Last Edit: March 21, 2021, 07:30:43 PM by FullyBorked
Finally decided to connect my ups to my firewall via USB and setup NUT to gracefully shut it down during power outages.  Seemed pretty simple using the documentation here https://docs.opnsense.org/manual/how-tos/nut.html, but my diagnostics tab stays blank like it's not connected.  I verified that my ups is supported using the USBHID driver https://networkupstools.org/ddl/Cyber_Power_Systems/CP1500AVRLCD.html, so I'm thinking I'm just missing some simple something. 

Edit: Just noticed the Nut Daemon isn't running and won't start for some reason.

Anyone have any pointers and/or any shell commands I can run to help troubleshoot the issue?

Thanks 8)

NUT and the USB HID driver are broken on FreeBSD because they are using an unsupported legacy API. According to information I got on their mailing list they have implemented the new API, but since they have not tagged a release since 2016, that code has not made it into any FreeBSD package, yet.

Your best bet (IMHO) is to get a network card for your UPS if available and use SNMP.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Quote from: pmhausen on March 21, 2021, 07:24:42 PM
NUT and the USB HID driver are broken on FreeBSD because they are using an unsupported legacy API. According to information I got on their mailing list they have implemented the new API, but since they have not tagged a release since 2016, that code has not made it into any FreeBSD package, yet.

Your best bet (IMHO) is to get a network card for your UPS if available and use SNMP.

Dang, unfortunately my ups is USB only, surprised that's been broken so long.   

Did you reboot the opnsense?  It seems to have to do a reboot with the UPS plugged in to detect it.  Then it is using the USBHID as UPS type.

It works for me on my CyberPower CST135XLU which is about 3 years old, so don't know why it wouldn't work for you.  The key is even on pfsense it requires a reboot.

Also, when you go to Nut/Diagnostics, it doesn't show the status until you click on the UPS status Button.

Quote from: IsaacFL on March 21, 2021, 08:30:28 PM
Did you reboot the opnsense?  It seems to have to do a reboot with the UPS plugged in to detect it.  Then it is using the USBHID as UPS type.

It works for me on my CyberPower CST135XLU which is about 3 years old, so don't know why it wouldn't work for you.  The key is even on pfsense it requires a reboot.
I did reboot.  I'm getting errors in the system log as well.  When I get back home I'll post up my syslog errors.

Sent from my IN2025 using Tapatalk


Quote from: FullyBorked on March 21, 2021, 09:00:24 PM
Quote from: IsaacFL on March 21, 2021, 08:30:28 PM
Did you reboot the opnsense?  It seems to have to do a reboot with the UPS plugged in to detect it.  Then it is using the USBHID as UPS type.

It works for me on my CyberPower CST135XLU which is about 3 years old, so don't know why it wouldn't work for you.  The key is even on pfsense it requires a reboot.
I did reboot.  I'm getting errors in the system log as well.  When I get back home I'll post up my syslog errors.

Sent from my IN2025 using Tapatalk

I have a couple at this at home i use and could not get it working with opnsense, if you figure this out i would be very interested in how.

Quote from: FullyBorked on March 21, 2021, 07:32:40 PM
Dang, unfortunately my ups is USB only, surprised that's been broken so long.
The current version on github seems to work fine, but without a release since 2016 it's almost impossible to update the FreeBSD package.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Here are my current error logs.

2021-03-21T21:43:01 root[43795] /usr/local/etc/rc.d/nut: WARNING: failed precmd routine for nut
2021-03-21T21:43:00 upsmon[94899] upsmon parent: read
2021-03-21T21:42:58 upsmon[95263] UPS [CyberPowerUPS]: connect failed: Connection failure: Operation already in progress
2021-03-21T21:42:27 upsmon[95263] UPS [CyberPowerUPS]: connect failed: Connection failure: Operation timed out
2021-03-21T21:42:04 root[81548] /usr/local/etc/rc.d/nut: WARNING: failed precmd routine for nut

Quote from: pmhausen on March 21, 2021, 11:24:08 PM
Quote from: FullyBorked on March 21, 2021, 07:32:40 PM
Dang, unfortunately my ups is USB only, surprised that's been broken so long.
The current version on github seems to work fine, but without a release since 2016 it's almost impossible to update the FreeBSD package.

How can install the version from github?  Any downsides to sideloading like that?

Quote from: FullyBorked on March 22, 2021, 02:45:39 AM
How can install the version from github?
You would need to checkout the source from github and build it on HardenedBSD yourself.

Quote from: FullyBorked on March 22, 2021, 02:45:39 AM
Any downsides to sideloading like that?
Sorry, no idea.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

I did a fresh install yesterday and ran into the same issue with my Cyberpower UPS.

When I looked into the ups.conf file located at /usr/local/etc/nut, I noticed that opnsense was adding several (3) configs for the ups in the file.  I removed the configs that didn't pertain and was left with:

# Please don't modify this file as your changes might be overwritten with
# the next update.
#
[CP1500PFCLCD]
driver=usbhid-ups
port=auto


After saving and rebooting, it worked.  But since there isn't a widget for the UPS like in pfSense, I'm wondering why I wasted so much time mucking with it.

Quote from: genesysguy on March 22, 2021, 04:02:16 PM
I did a fresh install yesterday and ran into the same issue with my Cyberpower UPS.

When I looked into the ups.conf file located at /usr/local/etc/nut, I noticed that opnsense was adding several (3) configs for the ups in the file.  I removed the configs that didn't pertain and was left with:

# Please don't modify this file as your changes might be overwritten with
# the next update.
#
[CP1500PFCLCD]
driver=usbhid-ups
port=auto


After saving and rebooting, it worked.  But since there isn't a widget for the UPS like in pfSense, I'm wondering why I wasted so much time mucking with it.

This might explain something too, my config file is pretty much blank.

# Please don't modify this file as your changes might be overwritten with
# the next update.
#
MODE=standalone
~
~

If the "old" usb-hid driver works, you are lucky. Sorry if I suggested it was completely broken. It does not work with a couple of devices, though. And the software has indeed not been updated since 2016, because they did not publish another release for 5 years ...
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Quote from: FullyBorked on March 22, 2021, 04:13:19 PM
Quote from: genesysguy on March 22, 2021, 04:02:16 PM
I did a fresh install yesterday and ran into the same issue with my Cyberpower UPS.

When I looked into the ups.conf file located at /usr/local/etc/nut, I noticed that opnsense was adding several (3) configs for the ups in the file.  I removed the configs that didn't pertain and was left with:

# Please don't modify this file as your changes might be overwritten with
# the next update.
#
[CP1500PFCLCD]
driver=usbhid-ups
port=auto


After saving and rebooting, it worked.  But since there isn't a widget for the UPS like in pfSense, I'm wondering why I wasted so much time mucking with it.

This might explain something too, my config file is pretty much blank.

# Please don't modify this file as your changes might be overwritten with
# the next update.
#
MODE=standalone
~
~


You are looking at nut.conf, not ups.conf