12.0-U8.1 -> 13.0-U2 poweroff problem & solution

mib

Dabbler
Joined
Sep 7, 2012
Messages
20
I upgraded from 12.0-U8.1 to 13.0-U2 recently. Some days later I discovered during a power outage that halt -p and poweroff still powered the server down, but then it didn't stay off, starting right back up on its own about 5 seconds later, which became a very significant problem for my UPS runtime.

My initial suspicion was a hardware-related issue since everything had worked fine for years, so I spent a lot of time eliminating USB, WOL, and other suspects. After also doing quite a lot of searching around, I finally discovered the solution and wanted to post it here so that hopefully someone else can save themselves several days of frustrated root causing.

It turns out that FreeBSD 13.0 changed the default power off mechanism from ACPI to EFI. My server's motherboard is not the newest any more and, unsurprisingly, this FreeBSD change surfaced someone's bug. So while the system did power off, the EFI path resulted in an automatic restart despite all the BIOS settings having been carefully set to Stay Off.

The solution is to add hw.efi.poweroff=0 to /etc/sysctl.conf — for those wanting to do this when the system is already up sudo sysctl hw.efi.poweroff=0 does the job.

Now the server behaves just like it did with 12.0-U8.1: it powers down and stays off until manual power on.

Since manual config changes via shell are frowned upon and unsupported, I'd like to suggest to the TrueNAS devs that they consider at least adding an option to prefer ACPI over EFI in the settings for Services > UPS and defaulting this setting to on when upgrading from pre-13 TrueNAS.

I won't be surprised at all to learn that this is going to bite many other 12->13 upgraders in the future as they exercise their power loss plans.
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
If you want to make this setting stick through reboots and upgrades you should add it via a tunable. That's the supported method for changing these types of things.
 

mib

Dabbler
Joined
Sep 7, 2012
Messages
20
If you want to make this setting stick through reboots and upgrades you should add it via a tunable. That's the supported method for changing these types of things.

Thanks; it hadn't occurred to me to put that in tunables but in hindsight it makes perfect sense.

My underlying suggestion to the devs to default to ACPI at least for systems migrating from 12 to 13 remains. This is going to mess up some of the user population at one of the least convenient times imaginable.
 

Hx Jai

Dabbler
Joined
Dec 4, 2016
Messages
29
This solution didn't work for me. I tried both the shell (although 'sudo' doesn't work in the shell), so I added hw.efi.poweroff to tunables SYSCTL, with a value 0. I tried a couple shutdowns - reboots each time.
 

pigpen

Cadet
Joined
Nov 3, 2023
Messages
2
Works here! Thank you so much for this information!
 

Bouba-33

Cadet
Joined
Dec 9, 2023
Messages
1
It's working once if I do sudo sysctl hw.efi.poweroff=0

It doesn't work if I write hw.efi.poweroff=0 in /etc/sysctl.conf

But it work fine if I do in root : sysctl hw.efi.poweroff=0 >> /etc/sysctl.conf.local
 

Lepelot

Dabbler
Joined
Dec 13, 2020
Messages
21
This solution didn't work for me. I tried both the shell (although 'sudo' doesn't work in the shell), so I added hw.efi.poweroff to tunables SYSCTL, with a value 0. I tried a couple shutdowns - reboots each time.
Hello Hx Jai,

I am running into the same situation: adding "hw.efi.poweroff to tunables SYSCTL, with a value 0" didn't work for me either. Did you ever solve this? My system is an old HP PC (Compaq 6000 Pro) with 2x4TB disks and 1 system SSD. It has been working just fine for the last 2 years. I upgraded to Core 13.0 several months ago and suddenly yesterday it started to reboot at every shut down.
 
Top