NAS keeps powering on after shutdown with UPS connected

Whenever my UPS is connected via USB to my NAS, the NAS will automatically restart whenever it is powered off by any means. This includes:

  • Shutdown command in the Web GUI
  • Shutdown command in the console “GUI” (option 9)
  • Automatic shutdown due to going on battery power (!!!)

The behavior is the same in all three cases: As soon as the shutdown process is complete and about 2 seconds pass, the NAS just starts back up, as if the power button has been pressed.
This is especially terrible in the 3rd case. If there is a power loss, the NAS will shut down automatically after the configured 30 seconds, but then immediately boot back up still on battery power. It will complete boot up, realize it’s still on battery power and shut back down. Repeat until I plug the power back in!

  • This is not the “Restore on AC Power Loss” setting in my BIOS, which is set to “Power Off”.
  • This behavior stops if I unplug the USB connection to the UPS.
  • The “Power Off UPS” setting in the UPS service settings of TrueNAS makes no noticable difference to the behavior.

I am running TrueNAS SCALE ElectricEel-24.10.1 my UPS is a Eaton 5E.

I’d be happy for any help!

You don’t mention any of your server hardware, but perhaps you can try a different USB-port? If you’ve tried USB 3.0-ones so far, try a USB 2.0 port or vice versa.

If that doesn’t help, are there USB settings in the BIOS you could play around with? Some motherboards let USB devices wake the computer, you likely don’t need that feature, try disabling it and see what happens, and so on.

Open a shell and post the output of: upsc ups (assuming you used the UI to configure the ups).

Thank you for your replies.

@neofusion
It’s a low-budget home build from old-ish eBay hardware:

  • ASRock C226M WS
  • Intel Xeon E3-1225 v3
  • 16GB ECC memory

I haven’t tried swapping USB ports yet, but will do so soon. Right now I have a long-running uninterruptible download running so I don’t want to do any reboots if I don’t have to. But I have already turned off any “allowed to wake the computer” settings in the BIOS long ago. If I remember there was USB, LAN, PS/2 and a bunch of other things. All of which are turned off.

@Theo:

take@truenas:~$ upsc ups
Init SSL without certificate database
battery.charge: 100
battery.runtime: 2437
battery.type: PbAc
device.mfr: EATON
device.model: 5E 850i
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.synchronous: auto
driver.version: 2.8.0
driver.version.data: MGE HID 1.46
driver.version.internal: 0.47
driver.version.usb: libusb-1.0.26 (API: 0x1000109)
input.voltage: 230.0
outlet.1.status: on
outlet.desc: Main Outlet
outlet.id: 1
outlet.switchable: no
output.frequency: 49.8
output.frequency.nominal: 50
output.voltage: 228.0
output.voltage.nominal: 230
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.firmware: 03.08.0018
ups.load: 13
ups.mfr: EATON
ups.model: 5E 850i
ups.power.nominal: 850
ups.productid: ffff
ups.realpower: 88
ups.start.battery: yes
ups.status: OL
ups.timer.shutdown: -1
ups.vendorid: 0463

Addendum:
I have now tried front USB (3.0) and back USB (2.0 as well as 3.0) with no difference.

Have you also disabled any option that keeps the USB-port powered when the computer is “off”? Use-case typically being that you connect your phone to your powered off computer to charge it. There may be more options in the USB-section that could change port behaviour in this situation, not just the things in the AC Power tab.

Looking through the manual I find these interesting options:
Chipset Configuration → On/Off Play - Disable
Chipset Configuration → Deep Sleep - I recommend trying with this off.
ACPI Configuration → Disable most if not all these “power on” or wake options if not done already.

What does sudo dmidecode | grep Wake-up show?

I disabled this, it made no difference.

Deep Sleep and all the “power on”/wake options were already disabled.

take@truenas:~$ sudo dmidecode | grep Wake-up
	Wake-up Type: Power Switch

That’s all.

Thank you for your help so far! This is most mysterious.

While it’s a long shot, especially so because your issue doesn’t happen if the USB cable isn’t connected, but could this be due to an incorrectly or shorted power/reset chassis cable? You know, those thin ones that are always a pain to connect?

Or a stuck power button even.

Another possibility is a mains lead or between UPS and computer with no earth wire (some cheap ones).

I assume you checked this already, but what are the settings in Truenas for the UPS service, it almost feels like it is set to power off as soon as it goes on battery.

If that is not it, how long does the UPS hold the server if the USB cable is not plugged in?

The buttons are not stuck, they both work fine on their own.
I don’t think it is a shorted cable, because this issue disappears if I disconnect the USB cable to the UPS.

It has an earth connection. I even tried running the NAS straight from the mains with a different cable, but still connected to the UPS via USB. The same behavior still happens with it rebooting.

It’s set to power off after 30 seconds of being on battery. This functions just fine. It just turns right back on, still on battery.
Here are the settings from the Web UI:


The “Power Off UPS” setting makes no difference either way and I cannot determine what it even does.

I honestly have not tried this and I am not sure I want to, because testing this would lead to a hard shutdown of the server, would it not? And it also seems to me like this would discharge the UPS battery to an unnecessarily deep level, which is bad for lead acid batteries. But maybe I am ignorant here.
Per specification the UPS can power a 100W load for 20 minutes. My NAS consumes roughly 60W on idle.

You do not appear to have anything in the ‘Shutdown Command’ box. I am not sure if there is a default one (there must be because your server shuts down!) and what it is. But I typed “shutdown -h now” (without the inverted commas) in this box, and this might be worth a try. Just in case the default is a reset or something!

PS the default is apparently “shutdown -P now”. I have never used it so I don’t know what effect it has on standard motherboards. Might be worth trying -h perhaps?

The issue is unrelated to the shutdown command, because it even happens when I shut down the machine unrelated to the UPS. Regardless, I tried your suggestion, but it made no difference.
Probably, because -h is “equivalent to --poweroff”, which is the same as -P. So it is the same command regardless.

But thank you for your reply.

Yes, noticed that a while ago, a headscratcher since iX has told us not to use shutdown commands in that way in TrueNAS.

I mean, this is a stretch, but maybe it is BIOS related, does there happen to be a new version of BIOS for your system? It seems like reboot after power loss is recognizing a shutdown as a power loss? Weird, but worth looking at.

The BIOS is up to date, for some definition of “up to date”. This is an older board, so the latest version is from 2018, but it is the latest version.

But again, this is not a power loss situation. This is a normal, bog-standard shutdown via the GUI. It also happens if it is a UPS-induced shut-down, but it happens for all shutdown commands issued via software, as long as the UPS is connected via USB.

The NUT software is not supposed to be able to turn the computer on, nor is it supposed to wake on USB activity according to your checks. It is hard to see this as anything other than a hardware electrical problem. Is the UPS earthed? Is there any voltage to earth measurable on the usb lead shield or negative pin? Does it happen with a different usb lead attached to the UPS?

Yes.

I don’t think I can measure the negative pin, at least I am not sure how to. But there is none between earth and the shield.

Yes it does, the lead makes no difference.