UPS shutdown sending NAS into boot/shutdown loop

sprocket

Cadet
Joined
Jun 18, 2022
Messages
6
Trying to debug my first ever (home) NAS setup, running TNS 22.02.1. I have a APC BR1500MS2 UPS running the usbhid-ups driver that I'm trying to troubleshoot a specific issue. I think I've inadvertently into a boot loop. The closest thing I've found on the forums like this is this post:
https://www.truenas.com/community/threads/configure-apc-ups-with-truenas.94421/post-653527

My NUT settings are:

Shutdown mode: UPS goes on battery
Shutdown timer: 300 seconds
Shutdown command:
Code:
/sbin/shutdown -P now

Power off UPS: not checked

The UPS estimated runtime is 30-45 mins. It is brand new. The timer is somewhat arbitrary to avoid shutting down during very brief outages/blinks.

I did a simulated power loss test and it did shutdown after the countdown, as desired. Then it booted itself up again after returning AC power to the UPS without any action on my part. Shortly after this, the UPS would switch back to battery mode despite being plugged into wall AC, which would trigger another shutdown... and then it'd restart itself again... and so on. I understand the restart is probably due to one of the power-on-AC settings in the BIOS, and that this behavior is desirable for uptime reasons; however, I don't want it boot looping during an actual power outage. I also have my modem, router, switch, and raspberry pi on the UPS supporting my small home network.

I think I have 2 options:
  1. Check the "Power off UPS" option and just rely on a manual power on of the UPS upon power restore.
  2. Change the shutdown mode to "UPS reaches low battery", but set the low battery trigger point to be high, say ~75-90%. I assume this will begin the shutdown process fairly early (~1-5 mins), and that the TNS host will STAY offline until power is restored AND the battery level rises to this threshold again. If the battery level is < the limit, I could see the machine boot-looping until the battery charges above the threshold.
Are these options technically correct? Are there better ones I should look at?

If I wanted to do option 2, which parameter is the low battery threshold value and how do I change it? Below is the output of:
Code:
upsc ups
:
Code:
Init SSL without certificate database
battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 50
battery.date: 2001/09/25
battery.mfr.date: 2021/10/23
battery.runtime: 4113
battery.runtime.low: 120
battery.type: PbAc
battery.voltage: 27.3
battery.voltage.nominal: 24.0
device.mfr: American Power Conversion
device.model: Back-UPS RS 1500MS2
device.serial: 4B2142P22438 
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: /dev/uhid
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: 144
input.transfer.low: 88
input.voltage: 120.0
input.voltage.nominal: 120
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.firmware: 969.e2 .D
ups.firmware.aux: e2     
ups.load: 11
ups.mfr: American Power Conversion
ups.mfr.date: 2021/10/23
ups.model: Back-UPS RS 1500MS2
ups.productid: 0002
ups.realpower.nominal: 900
ups.serial: 4B2142P22438 
ups.status: OL
ups.test.result: No test initiated
ups.timer.reboot: 0
ups.timer.shutdown: -1
ups.vendorid: 051d

Or perhaps the solution is not even within TNS, but motherboard BIOS power settings dependent?
 
Joined
Oct 22, 2019
Messages
3,641
Shortly after this, the UPS would switch back to battery mode despite being plugged into wall AC
Isn't this the main issue? Why would your UPS consider itself on battery-only, when it's plugged into an outlet?
 

sprocket

Cadet
Joined
Jun 18, 2022
Messages
6
Isn't this the main issue? Why would your UPS consider itself on battery-only, when it's plugged into an outlet?
I just tried a test repeat with these parameters:

Shutdown mode: UPS goes on battery
Shutdown timer: 120 seconds
Shutdown command:

Code:
/sbin/shutdown -P now


Power off UPS: not checked

I pulled the wall AC to the UPS, TNS shutdown @ 120s as expected. ~60s after TNS shutdown, the UPS shuts down and ... nothing. Upon wall power returning, the machine powers on and boots back to TNS. I repeated this whole process again and got the same results.

I guess the only risk to this method is: if the power is fluctuating/blinking, there may not be enough time for a graceful shutdown. I could mitigate this risk by switching the BIOS setting to not power-on automatically upon AC line power being applied.

Did I get that right?
 

sprocket

Cadet
Joined
Jun 18, 2022
Messages
6
I should add: I don't know WHY the UPS shut itself down after 60s, given I do NOT have the "Power off UPS" option checked. Only thought: maybe there is a minimum load the UPS requires - router, switch, modem, and raspberry pi cannot be much wattage. I'm not convinced this is the reason though.
 
Top