UPS cuts power instead of shutdown

Status
Not open for further replies.

josch

Cadet
Joined
Aug 7, 2014
Messages
6
Hi,
I have a problem with my UPS.
When I came home today, the UPS was giving a constant beeping noise and power was off.
Turns out, there is a problem with the power outlet on my balcony and during the rain today the residual-current circuit breaker went off. Not a big problem, I switched power back on and restarted the UPS.

Then I checked my FreeNAS logs:
/var/log/ups.log:
Code:
20150520 145923 100 233.0 14 [OL] 25.0 50.5
20150520 150423 100 230.0 13 [OL] 25.0 50.3
20150520 150923 63 0.0 23 [OB] 25.0 50.1
20150520 190815 NA NA NA [WAIT] NA NA
20150520 191314 97 230.0 13 [OL] 25.0 50.3
20150520 191815 97 230.0 13 [OL] 25.0 50.3


last
Code:
josef      pts/1    10.24.42.1             Wed May 20 19:13 - 19:19  (00:06)
boot time                                  Wed May 20 19:12
josef      pts/1    10.24.42.81            Mon May 18 18:53 - 21:10  (02:17)
boot time                                  Fri May 15 23:32


Well, there seems to be no shutdown. Not good.

I checked the battery and it was at 97%, so I just plugged the UPS out and waited.
It started its usual beeping on power loss (~every 20sec or so)
After some time (maybe 1 or 2 min) the UPS just cut the power and started to give off a constant annoying beeping noise.

After booting I checked again and the battery was still at 94%. So I just disconnected the UPS USB connection and removed power. Everything worked fine for 10min. The UPS was still at 81% battery.

So something is wrong in my FreeNAS configuration. It seems the server is shutting down the UPS without shutting down the system first or maybe some waiting time sent to the UPS is not working?

The UPS is a PowerWalker VI 850 SE and is configured with this settings:
ups_1.png


upsc ups gives:
Code:
battery.charge: 93
battery.voltage: 13.30
battery.voltage.high: 13.5
battery.voltage.low: 10.5
battery.voltage.nominal: 12.0
device.type: ups
driver.flag.novendor: enabled
driver.name: blazer_usb
driver.parameter.pollinterval: 15
driver.parameter.port: /dev/ugen0.1
driver.version: 2.7.2
driver.version.internal: 0.11
input.current.nominal: 3.0
input.frequency: 50.3
input.frequency.nominal: 50
input.voltage: 231.4
input.voltage.fault: 231.4
input.voltage.nominal: 230
output.voltage: 231.4
ups.beeper.status: enabled
ups.delay.shutdown: 30
ups.delay.start: 180
ups.load: 13
ups.productid: 5161
ups.status: OL
ups.temperature: 25.0
ups.type: offline / line interactive
ups.vendorid: 0665


What is wrong with my setup?

Bonus question: Is there a way to configure the UPS to not constantly beep when off? that's pretty annoying. I still want to keep the beeps every 20sec or so when running on battery.
 

rogerh

Guru
Joined
Apr 18, 2014
Messages
1,111
Unlike say apcupsd on Linux, NUT on FreeNAS has to send the shutdown command to the UPS before the operating system shuts down. In my limited experience, FreeNAS takes from about 15 seconds to about 90 seconds to shutdown, depending mainly if you have jails to shutdown. Your UPS, according to your upsc report, is set to shutdown 30 seconds after the shutdown signal. Therefore it will probably shut down before FreeNAS has finished shutting down. Interestingly, until recently FreeNAS did not implement UPS shutdown, and, having implemented it, they have discovered that it can have problems. We are promised that in the next update there will be a choice in the GUI not to shutdown the UPS. You could wait for the next update (possibly in the next week) and avoid shutting down the UPS, which would solve the immediate problem, at the cost of running down the UPS batteries if there is any ancillary equipment connected to it and preventing automatic switch on when power returns.


Alternatively, you need to increase the delay marked ups.delay.shutdown in your upsc output. This is driver dependent. Which driver is being used is in your logs somewhere (BTW, posters are encouraged, nay commanded, by the forum rules to tell us their FreeNAS version and hardware, and in this case something from /var/log/messages about your UPS driver would be useful) but I can only say I use the NUT driver usbhid-ups with an APC ups. In my particular case, if I put (see edit2 below) offdelay=180 (with no spaces round the =) in the ups.conf box in the GUI it has the desired effect. Look at the man page for your driver.

Having sorted that, consider any parameters for minimum battery charge before restarting the UPS, and the utility of a delay before restarting the UPS to avoid a race condition between computers losing their standby voltage and the mains coming back. I find not all these can be set via the NUT drivers, and my UPS needs pre-setting via the Windows drivers. This is another possible approach to settings that NUT isn't going to affect.

Edit: beeping when off is a bit annoying, that is the sort of thing there may be a physical switch or a Windows driver setting to fix.

Edit2 fixed typo in offdelay (put ondelay!)
 
Last edited:

josch

Cadet
Joined
Aug 7, 2014
Messages
6
Thanks.
The driver is blazer_usb as in the log above.

I changed my config to include the following, and now it works.

offdelay=360
ondelay=5

But it seems like sometimes the driver crashes before sending the shutdown command. The server shuts down but the UPS stays on until power runs out then.
The blazer_usb driver seems quite buggy. I had it crashing once or twice a week before, so almost since I have the UPS there is a cronjob to check and restart it every 5min.
Since this is just my NAS at home, this is OK for now. Better the server shuts down properly and I have to manually turn it on again than losing any data.
Also this was the first problem with the power since the two years I live in this flat, so that shouldn't happen too often.

My Server is a HP N54L with 16GB ECC RAM and 4x4GB WD Red BTW.
 

rogerh

Guru
Joined
Apr 18, 2014
Messages
1,111
Thanks.
The driver is blazer_usb as in the log above.

I changed my config to include the following, and now it works.

offdelay=360
ondelay=5

But it seems like sometimes the driver crashes before sending the shutdown command. The server shuts down but the UPS stays on until power runs out then.
The blazer_usb driver seems quite buggy. I had it crashing once or twice a week before, so almost since I have the UPS there is a cronjob to check and restart it every 5min.
Since this is just my NAS at home, this is OK for now. Better the server shuts down properly and I have to manually turn it on again than losing any data.
Also this was the first problem with the power since the two years I live in this flat, so that shouldn't happen too often.

My Server is a HP N54L with 16GB ECC RAM and 4x4GB WD Red BTW.


Yes, the NUT drivers seem less stable than the apcupsd drivers for my old model SmartUPS. But, as you say, protecting the server is the main purpose of the exercise. I presume it is a fairly recent FreeNAS 9.3 version you are using, otherwise it wouldn't be shutting down the UPS at all. They had a change of heart on this (it was "not to be fixed") so I moved my NUT master to a Linux box - the driver is no more stable though.


BTW, it is important that the UPS measures ondelay from turn-off or power restoration, whichever is the later. Apparently, some retarded UPSen will restart if the power comes on after they have been told to shut down, but before they have done so. Just to avoid this, I set ondelay > offdelay, but that may be over-cautious. If the FreeNAS box is already shutting down this will do no harm, apart from not power-cycling, therefore not restarting, the computer.
 

josch

Cadet
Joined
Aug 7, 2014
Messages
6
Yes, it's the latest stable.
I could try to run NUT on my router, but if it's not stable on Linux too there is no point in that.
 

rogerh

Guru
Joined
Apr 18, 2014
Messages
1,111
Yes, it's the latest stable.
I could try to run NUT on my router, but if it's not stable on Linux too there is no point in that.
I came to the same, or converse, conclusion, that there is no point putting NUT back on FreeNAS now that it can shutdown the UPS. BTW, sorry for editing my last post without saying so.
 

John Dvoracek

Dabbler
Joined
May 23, 2015
Messages
10
... In my particular case, if I put (see edit2 below) offdelay=180 (with no spaces round the =) in the ups.conf box in the GUI it has the desired effect. Look at the man page for your driver. ...
Hello and thanks for the information. I am not very linux/unix/bsd conversant yet. Can you give me a few clues where to look for the file to edit? I used to find files on Centos using find, but find behaves very differently on freebsd. Pure dumb luck I've gotten this far. Thanks in advance!

[root@freenas ~]# upsc BR1300LCD | more
battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 50
battery.date: 2047/00/35
battery.mfr.date: 2006/10/07
battery.runtime: 5764
battery.runtime.low: 120
battery.type: PbAc
battery.voltage: 26.5
battery.voltage.nominal: 24.0
device.mfr: American Power Conversion
device.model: Back-UPS XS 1300 LCD
device.serial: JB0641019934
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: /dev/ugen1.3
driver.version: 2.7.2
driver.version.data: APC HID 0.95
driver.version.internal: 0.38
input.sensitivity: high
input.transfer.high: 139
input.transfer.low: 88
input.voltage: 122.0
input.voltage.nominal: 120
ups.beeper.status: disabled
ups.delay.shutdown: 20
ups.firmware: 836.H4 .D
ups.firmware.aux: H4
ups.load: 6
ups.mfr: American Power Conversion
ups.mfr.date: 2006/10/07
ups.model: Back-UPS XS 1300 LCD
ups.productid: 0002
ups.realpower.nominal: 780
ups.serial: JB0641019934
ups.status: OL
ups.test.result: No test initiated
ups.timer.reboot: 0
ups.timer.shutdown: -1
ups.vendorid: 051d

[root@freenas /var/log]# cat ups.log
May 25 13:39:13 freenas newsyslog[1550]: logfile first created
20150526 190758 NA NA NA [WAIT] NA NA
20150526 191258 95 122.0 5 [OL CHRG] NA NA
20150526 191758 97 122.0 5 [OL CHRG] NA NA
20150526 192258 99 122.0 6 [OL CHRG] NA NA
20150526 192758 100 122.0 6 [OL] NA NA
20150526 193258 100 122.0 6 [OL] NA NA
20150526 193758 100 122.0 6 [OL] NA NA

Regards, John
 

rogerh

Guru
Joined
Apr 18, 2014
Messages
1,111
Hello and thanks for the information. I am not very linux/unix/bsd conversant yet. Can you give me a few clues where to look for the file to edit? I used to find files on Centos using find, but find behaves very differently on freebsd. Pure dumb luck I've gotten this far. Thanks in advance!
In this particular case you don't need to find ups.conf as there is a place in the GUI to enter ups.conf parameters. If you click on the spanner beside the UPS service you get a form part of which you must have already filled in. In this is a free text box in which you can enter lines for ups.conf. It may be best to look up the man page for usbhid-ups, but I've just noticed the NUT man pages are not in FreeNAS, which I think I will report as a bug. Easy to find on Google though.

Parenthetically, I have not noticed a difference with 'find' on FreeNAS, but it may be shell related. I generally put any search terms with wild cards in inverted commas. I am no kind of expert though!
 

John Dvoracek

Dabbler
Joined
May 23, 2015
Messages
10
In this particular case you don't need to find ups.conf as there is a place in the GUI to enter ups.conf parameters. ... It may be best to look up the man page for usbhid-ups ...
Thanks for pointing that out.

offdelay = 12o in that GUI form gets:

ups.delay.shutdown: 120

Thank you!
 

John Dvoracek

Dabbler
Joined
May 23, 2015
Messages
10
Unlike say apcupsd on Linux, NUT on FreeNAS has to send the shutdown command to the UPS before the operating system shuts down. ... We are promised that in the next update there will be a choice in the GUI not to shutdown the UPS. ...
I just installed the update FreeNAS-9.3-STABLE-201506042008, and that choice not to shutdown the UPS has been added (as the default).

Thanks again for the thread.
 
Status
Not open for further replies.
Top