nut service not starting

Started by da0, July 28, 2018, 06:03:48 PM

Previous topic - Next topic

hello all,

I am a newbie with OPNsense and trying to connect my UPS to my router
OPNsense version is 18.1.13
UPS is APC back-UPS ES 700G

I installed os-nut plugin (v1.0) and connected my UPS to the router
kernel logs show UPS device is correctly detected:

ugen0.2: <APC Back-UPS ES 700G FW871.O2 .I USB FWO2> at usbus0


in web UI configuration, I enable NUT service with:
in general settings:
  enable NUT : ON
  service mode : standalone
  name : UPSName
in UPS type/USBHID-driver
  enable : ON
  extra arguments : port=auto

I apply configuration and try to leave NUT configuration page ... it takes long time (50 seconds, sometimes less)

next, going back to NUT configuration page : NUT is disabled ... configuration was not applied

from command line, I can see :
files in /usr/local/etc/nut are not modified

and running processes:

# ps aux | grep ups
root    69797   0.0  0.1   12564  2140  -  I    17:43     0:00.00 /usr/local/bin/upsc UPSName@127.0.0.1
root    95901   0.0  0.1   12564  2136  -  S    17:45     0:00.00 /usr/local/bin/upsc UPSName@127.0.0.1
root    96022   0.0  0.1   12564  2136  -  S    17:45     0:00.00 /usr/local/bin/upsc UPSName@127.0.0.1
root    96293   0.0  0.1   12564  2136  -  S    17:45     0:00.00 /usr/local/bin/upsc UPSName@127.0.0.1
root    96486   0.0  0.1   12564  2136  -  S    17:45     0:00.00 /usr/local/bin/upsc UPSName@127.0.0.1
root    96922   0.0  0.1 1080528  2832  0  S+   17:45     0:00.00 grep ups


after rebooting router, I still have same behavior

installing/reinstalling os-nut plugin changes nothing


am I missing some thing in my setup ?

is there somebody to help ?


regards,

Denis

Can you enable debug in browser via F12 / network and look for the error? Must be something wrong when config Not applied


I did not understand it may be related to my web client :(
... so I'm running OS X el capitan 10.11.6 with safari 11.1.2
I also tested firefox 61.0.1

for both safari and firefox, I have same kind of problems : long waits  when entering or leaving "nut service" page
I have this behavior only when nut is disabled.


I enabled web inspector in both browsers and when showing network tab I see a lot of "upsstatus" POST waiting for answer when nut service is disabled

when I click on "enable nut" I get following error :

TypeError: null is not an object (evaluating 'el.nodeName')

... error is triggered in function selectMe in inject.js, line 78

when I click on "apply" button I get same error and a "set" POST is sent ... waiting forever a response
in fact, it takes ages before getting an answer ... and when answer is received, a "reconfigure" POST is sent
=> apply button is displayed with a 'wheel' next to it

in the end, when all POST have completed (it may takes several minutes), nut is enabled
.. and from this point, entering/leaving "nut service" page can be done without long waits  ("upsstatus" seems to run correctly)


Nut tools are a bit bitchy, the status command runs forever when the daemon is stopped.

I am facing this same issue. Tons of upsc always running, GUI freezed even when having "Enable NUT" unchecked.

Maybe this log line helps:

Aug  8 18:58:29 firewall configd[46715]: Timeout (120) executing : nut upsstatus 'eaton@127.0.0.1'

It seems that I have no luck with this plugin, but I'd like to have it running.

When clicking in the plugin web page, it starts to launch several connections to the API endpoint "https://<host>/api/nut/service/upsstatus" even when NUT is NOT enabled. Perhaps this is one bug, but not the only one. This is the cause that freezes the GUI, at least in my case.

I can perform any test you want or need  ::)

Thanks!

Perhaps your UPS is not supported by the driver?

Looks like the known status lockup when the service is deactivated:

> GUI freezed even when having "Enable NUT" unchecked.

and

> Aug  8 18:58:29 firewall configd[46715]: Timeout (120) executing : nut upsstatus 'eaton@127.0.0.1'

While this is annoying why don't we talk about enabled services and log file errors from a running process? :)


Cheers,
Franco

I've noticed even when I was still running pfSense in the past and when I made the switch to OPNsense that despite the system recognizing the UPS is plugged in. If I set everything up (just like yours da0) and even reboot multiple times the service will not register until I unplug the usb cable at least at one end then plug back in (maybe another reboot) to get the service to recognize. I can't recall if I've had the freezing issue on the Gui but the occasional extended wait if I restart it or start it up if it wasn't running.

My OPNsense node:
Dell R220
OS: OPNsense Latest stable release (amd64)
CPU: GHz
RAM: 32GB
NIC: Intel I350T4V2BLK
Hard drive: 500GB UFS

The freezing is just OPN related since the status is called when opening nut menu.
I have to rework the menu so it's only called when clicked .. but I need a bit time for this.

I hope this can be fixed soon.


I wanted to move the USB connection from my APC UPS from my Windows PC to the firewall, so I thought I should probably connect the USB first then do the plug-in. Disconnected the USB cable, all was fine, connected it to firewall, it immediately shuts down. At least it was clean but not a great start.


Now I can't even configure it as the GUI just won't let me - it's so slow, and nothing is getting the service started.


For now I have removed the plugin and everything is back to normal. As I'm going on vacation later this week I will wait until I get back to play some more.

Any idea if this should work with my APC SmartUPS 750? I changed the type to "APCSMART driver" and disabled the "USBHID driver", but I'm still getting the GUI hangs, and these kinds of messages:


Jan 4 17:20:11 upsmon[69654]: UPS Firewall_UPS is unavailable
Jan 4 17:20:11 upsmon[69654]: UPS [Firewall_UPS]: connect failed: Connection failure: Operation timed out
Jan 4 17:18:51 upsmon[69654]: Communications with UPS Firewall_UPS lost
Jan 4 17:18:51 upsmon[69654]: UPS [Firewall_UPS]: connect failed: Connection failure: Operation timed out
Jan 4 17:17:36 upsmon[69424]: Startup successful
Jan 4 17:17:36 root: /usr/local/etc/rc.d/nut: WARNING: failed precmd routine for nut
Jan 4 17:17:05 root: /usr/local/etc/rc.d/nut_upsmon: WARNING: failed to start nut_upsmon
Jan 4 17:17:05 root: /usr/local/etc/rc.d/nut: WARNING: failed precmd routine for nut
Jan 4 17:16:28 upsmon[80600]: upsmon parent: read
Jan 4 17:16:28 upsmon[80757]: Signal 15: exiting
Jan 4 17:16:22 upsmon[80757]: UPS [Firewall_UPS]: connect failed: Connection failure: Operation already in progress
Jan 4 17:16:22 root: /usr/local/etc/rc.d/nut: WARNING: failed precmd routine for nut
Jan 4 17:16:17 upsmon[80757]: UPS [Firewall_UPS]: connect failed: Connection failure: Operation timed out
Jan 4 17:14:57 upsmon[80757]: UPS Firewall_UPS is unavailable
Jan 4 17:14:57 upsmon[80757]: UPS [Firewall_UPS]: connect failed: Connection failure: Operation timed out



It works fine when connected to my Windows 10 PC so I know the UPS is fine. I'm up to date with the main firewall code.

You have to remove the nut part from config.xml and start over again. Normally the gui should not hang when you dont hit Diagnostics

Quote from: mimugmail on January 04, 2019, 06:28:41 PM
You have to remove the nut part from config.xml and start over again.


I'm not sure what this means - for now I have removed the plug-in and reconnected the UPS back on my Windows PC, but I can try again if there's a possibility that it would work.

Edit /conf/config.xml, search for nut and remove the xml container.
If you don't know how, just install the plugin again, disable the service and set all settings as before.