shutting down FreeNAS takes more than 2 minutes

Status
Not open for further replies.

Sander Jansen

Explorer
Joined
Dec 26, 2015
Messages
87
Hey,

I recently bought a UPS and I have a little problem with FreeNAS shutting down.
It takes so long that the UPS dies before FreeNAS has shutdown. Even in general, i had to extend the watchdog timeouts for it to even shutdown properly.

I'm running the latest FreeNAS 11 and i have 2 plugins (couchpotato and sabnzb) and one VM running.
My shutdown script that I use, first shuts down the VM over SSH, then waits 10 seconds (the VM takes about 6 to shutdown)
and then FreeNAS itself shuts down. For FreeNAS, shutting down local daemons takes forever and also exceeds the 90 seconds watchdog timeout (i upped the watchdog to 120).
The system is running from a SSD on USB 2 but still... I've seen better shutdown times on usb 2.

Is there anything i can do to get FreeNAS to shutdown faster? Maybe its because of the 2 plugins? Is there a way that i can change my shutdown script so it first starts shutting down the plugins and the VM and then after shuts down FreeNAS? for now I'm only shutting down the VM manually (i don't trust FreeNAS to actually shut it down properly)

My script:
Code:
ssh sander@VM-IP sudo shutdown now
sleep 10
poweroff

My target is to have FreeNAS shutdown within 90 seconds instead of the 130~ it takes now.
 
Last edited by a moderator:

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
I would just shutdown FreeNAS. Seems like that is how it should work. What does bhyve so when the host is powered down?

Sent from my Nexus 5X using Tapatalk
 

wblock

Documentation Engineer
Joined
Nov 14, 2014
Messages
1,506
FreeNAS has built in functionality to do this based on feedback from the UPS based on battery charge. Why develop something to shut down without feedback when there is a tested solution right there?
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
Hey,

I recently bought a ups and i have a little problem with freenas shutting down.
It takes so long that the ups dies before freenas has shutdown. Even in general, i had to extend the watchdog timeouts for it to even shutdown properly.

Im running the latest freenas 11 and i have 2 plugins (couchpotato and sabnzb) and one VM running.
My shutdown script that i use, first shuts down the VM over SSH, then waits 10 seconds (the VM takes about 6 to shutdown)
and then freenas itself shuts down. for freenas, shutting down local daemons takes forever and also exceeds the 90 seconds watchdog timeout (i upped the watchdog to 120)
The system is running from a SSD on USB 2 but still... ive seen better shutdown times on usb 2.

Is there anything i can do to get Freenas to shutdown faster? maybe its because of the 2 plugins? Is there a way that i can change my shutdown script so it first starts shutting down the plugins and the VM and then after shuts down freenas? for now im only shutting down the VM manually (i don't trust freenas to actually shut it down properly)

My script:
ssh sander@VM-IP sudo shutdown now
sleep 10
poweroff


My target is to have freenas shutdown within 90 seconds instead of the 130~ it takes now.
It may be that you simply need a higher-capacity UPS. What is the rating (VA or Watts) of the UPS you're using?

You can use the upsc command to get an idea of the runtime capability of your UPS: upsc ups should provide a listing (see below) with a couple of useful parameters you can review: battery.runtime is the number of seconds the UPS thinks it can provide power under your current load and ups.load is the percentage of the maximum load capability the UPS is currently providing.
Code:
[root@bandit] ~# upsc ups
battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 20
battery.mfr.date: CPS
battery.runtime: 1380
battery.runtime.low: 300
battery.type: PbAcid
battery.voltage: 24.0
battery.voltage.nominal: 24
device.mfr: CPS
device.model: CP1500PFCLCD
device.serial: 000000000000
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 15
driver.parameter.port: /dev/ugen0.4
driver.parameter.synchronous: no
driver.version: 2.7.3
driver.version.data: CyberPower HID 0.4
driver.version.internal: 0.39
input.transfer.high: 139
input.transfer.low: 88
input.voltage: 121.0
input.voltage.nominal: 120
output.voltage: 137.0
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.delay.start: 30
ups.load: 29
ups.mfr: CPS
ups.model: CP1500PFCLCD
ups.productid: 0501
ups.realpower.nominal: 900
ups.serial: 000000000000
ups.status: OL
ups.test.result: Done and passed
ups.timer.shutdown: -60
ups.timer.start: -60
ups.vendorid: 0764
 

Sander Jansen

Explorer
Joined
Dec 26, 2015
Messages
87
Well there starts my main problem. the 10% low battery is not enough to shutdown... ive tried changing it to 15%-20% but it still goed down to 10%...
The system can run about 24 minutes witch in enough... but i don't want the system to shutdown instantly... i know there is a timer function that i can set but i don't like that because if the power fails again within the 6 hours of charge time, it wont help anything as it just wont shutdown because of the timer.

ive tried "override.battery.charge.low = 20" and its reflected in the output but its ignored and still goed down to 10%. if there is a fix for this then my problems are solved. I also like to change the high and low voltages as there off the chart (from factory... wtf...) but if the battery low thing isnt working then i don't like to change them just yet... for safety sake...

i set the driver in the service to: APC ups 2 Smart-UPS USB USB (usbhid-ups)

Code:
Instant commands supported on UPS [ups]:

beeper.disable - Description unavailable
beeper.enable - Description unavailable
beeper.mute - Description unavailable
beeper.off - Description unavailable
beeper.on - Description unavailable
load.off - Description unavailable
load.off.delay - Description unavailable
shutdown.reboot - Description unavailable
shutdown.stop - Description unavailable
test.battery.start.deep - Description unavailable
test.battery.start.quick - Description unavailable
test.battery.stop - Description unavailable
test.panel.start - Description unavailable
test.panel.stop - Description unavailable

root@freenas:~ # upscmd ups test.battery.start.quick
Username (root): sander
Password:
Unexpected response from upsd: ERR ACCESS-DENIED

Even though i set that user as the monitor user in the service.


Code:
battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 50
battery.date: 2001/09/25
battery.mfr.date: 2017/06/14
battery.runtime: 1548
battery.runtime.low: 120
battery.type: PbAc
battery.voltage: 13.5
battery.voltage.nominal: 12.0
device.mfr: American Power Conversion
device.model: Back-UPS XS 700U
device.serial: 3B1647X05681
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: /dev/ugen0.4
driver.parameter.synchronous: no
driver.version: 2.7.4
driver.version.data: APC HID 0.96
driver.version.internal: 0.41
input.sensitivity: medium
input.transfer.high: 290
input.transfer.low: 150
input.voltage: 236.0
input.voltage.nominal: 230
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.firmware: 924.Z3 .I
ups.firmware.aux: Z3
ups.load: 21
ups.mfr: American Power Conversion
ups.mfr.date: 2016/11/22
ups.model: Back-UPS XS 700U
ups.productid: 0002
ups.realpower.nominal: 390
ups.serial: 3B1647X05681
ups.status: OL
ups.test.result: No test initiated
ups.timer.reboot: 0
ups.timer.shutdown: -1
ups.vendorid: 051d
 
Last edited:

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419
ive tried "override.battery.charge.low = 20" and its reflected in the output but its ignored and still goed down to 10%. if there is a fix for this then my problems are solved.

Might be a bug then and should be reported
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
It may be that you simply need a higher-capacity UPS.
It doesn't help that UPSs are "rated" very poorly. When I'm looking for a UPS, I'm not especially interested in its peak power output (as long as it is enough to support whatever I'm going to plug into it); I'm much more interested in runtime, which translates to watt-hour capacity. But if the manufacturer gives you that spec at all, you need to dig for it, and it isn't something that relates directly to the VA capacity. For an example of this, the APC 3U 2200 VA SMART-UPS has 8 x 12v, 7 Ah batteries, for 672 watt-hours capacity. Their 3000 VA 2U SMART-UPS (which I have) has 8 x 12v, 5 Ah batteries, or a capacity of 480 watt-hours. I don't need 3 kVA of power, but I do need (or at least "want") a decent runtime for a rack of equipment that draws around a kilowatt.

Edit: The watt-hour capacities I'm showing are misleading, as they're based on the specs for the batteries, which are assuming a much lower discharge rate than the UPS subjects them to. Batteries are generally rated at the 20-hour discharge rate, or the amp draw that would discharge the battery in 20 hours. If the battery delivers 0.25 amps for 20 hours, that's a 5 amp-hour battery. A UPS is normally going to draw much more power than that, and the relationship isn't linear--if you put that 5 amp-hour battery under a 0.5-amp load, it would last less than 10 hours; under a 1-amp load, it would last considerably less than 5 hours.
 
Last edited:

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
root@freenas:~ # upscmd ups test.battery.start.quick
Username (root): sander
Password:
Unexpected response from upsd: ERR ACCESS-DENIED
[/CODE]
Even though i set that user as the monitor user in the service.
AFAIK, the 'Monitor User' account's only purpose is for accessing the UPS from other servers connected to the same UPS and you need to use a local account to run upscmd.
 

Sander Jansen

Explorer
Joined
Dec 26, 2015
Messages
87
I know... Ive been digging aswell... for me 20 minutes is enough runtime... the power doesnt fail often here... but when it does its not long... (mostly just a fuse inside my home or something) if power fails in the street, its always going to take more then a hour so that is out of the question... id rather have some downtime then spend like 1 grand more on a ups and have the batteries die before power fails in the street. so to say... Power in the street has faild once in like 10 years... so

the thing in this case is that the 10% is just to low for the setup...

Also, this changing the low batterie value bug thing has been reported for 9.2 or so aswell in the past... and should have been fixed? i could report it again but... it may aswell be that its not saved properly do to the driver i chose? maybe the access denied thing for other commands also has something to do with it? is there a way to test this? for now ive tried sending commands to the ups to test battery and stuff but those faild with access denied... or at least from what i can tell... its my first time using a ups directly with freenas so im googling my way through this to try and fiend things i can test

@Spearfoot Ive tried running it as root and still access denied? also the sander account is a local account aswell as a monitor user?
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
I know... Ive been digging aswell... for me 20 minutes is enough runtime... the power doesnt fail often here... but when it does its not long... (mostly just a fuse inside my home or something) if power fails in the street, its always going to take more then a hour so that is out of the question... id rather have some downtime then spend like 1 grand more on a ups and have the batteries die before power fails in the street. so to say... Power in the street has faild once in like 10 years... so

the thing in this case is that the 10% is just to low for the setup...

Also, this changing the low batterie value bug thing has been reported for 9.2 or so aswell in the past... and should have been fixed? i could report it again but... it may aswell be that its not saved properly do to the driver i chose? maybe the access denied thing for other commands also has something to do with it? is there a way to test this? for now ive tried sending commands to the ups to test battery and stuff but those faild with access denied... or at least from what i can tell... its my first time using a ups directly with freenas so im googling my way through this to try and fiend things i can test

@Spearfoot Ive tried running it as root and still access denied? also the sander account is a local account aswell?
Here's what I suggest... Configure the UPS service with 'Shutdown mode' set to 'UPS goes on battery' and 'Shutdown timer' set to something along the lines of 600 seconds. If the power goes down for that length of time, your system will shut down without completely draining your batteries - which is a good thing, IMHO. I don't like to drain the UPS batteries because then you've got 'nothing' if you power the system back up and the power happens to go down again. In your case, with a 10 minute timeout setting, at least you'd still have ~10-12 minutes of additional runtime should that happen.
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
@Spearfoot Ive tried running it as root and still access denied? also the sander account is a local account aswell as a monitor user?
Hmmm.... I believe you may have found a bug! I too get the same 'ACCESS-DENIED' message when I run upscmd as 'root'.
 

Sander Jansen

Explorer
Joined
Dec 26, 2015
Messages
87
seems like the best option for now... though it would be nice if things worked properly... i guess ill leave it at this then... thanks for the info :)
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
Hmmm.... I believe you may have found a bug! I too get the same 'ACCESS-DENIED' message when I run upscmd as 'root'.
After some Googling, I don't think this is a bug. This documentation for upscmd states that you need to define the user and password in the upsd.users file:

http://bsdforge.com/man?query=upscmd&sektion=8&apropos=0&manpath=FreeBSD+8.3-stable

I've never fiddled with this, so I have no idea whether or not you can do this on FreeNAS: any changes you make to NUT files will probably get overwritten if/when you upgrade FreeNAS.
 

Sander Jansen

Explorer
Joined
Dec 26, 2015
Messages
87
yea... im not going to change those files... it might work for now but might also be unstable later on... i need this box to be as stable as possible as im also running some websites and email trafic on this thing (VM)

im annoyed enough that my disks are getting 40~42 degrees C because my room (attic) is getting a fricking 36 degrees C right now... pfff.. but yea in 2 weeks immoving and then i can give it a nice setup in the basement :)
 
Status
Not open for further replies.
Top