Preventing FreeBSD From Shutting Down on Low Battery

Hi. I have a laptop that has problems reading battery, and the system thinks the battery is at 0% even though it isn't. FreeBSD also sees the battery as 0% as a result and always powers off after 10 minutes. Is there any way to prevent FreeBSD from shutting down when a low battery is detected?
 
Are you sure the battery isn’t just dead (worn out)? 🪦 If you haven’t configured nothing, the the operating system does not initiate a proper shutdown. 🔌 Your hardware either just cuts power (denoted “crash” in the last(1) log) or, I guess, automatically sends an acpi(4) event akin to pressing the power button which the OS could ignore (e. g. sysctl hw.acpi.power_button_state=NONE).​
 
Are you sure the battery isn’t just dead (worn out)? 🪦 If you haven’t configured nothing, the the operating system does not initiate a proper shutdown. 🔌 Your hardware either just cuts power (denoted “crash” in the last(1) log) or, I guess, automatically sends an acpi(4) event akin to pressing the power button which the OS could ignore (e. g. sysctl hw.acpi.power_button_state=NONE).​
This prevents the power button from giving a signal. It doesn't prevent the system from automatically shutting down from low battery. Is there anyway to prevent the system from shutting from low *detected* battery?
 
My point is: The FreeBSD operating system – in its default configuration, as shipped out – does not automatically initiate a shutdown based on battery readings. 🤸‍♀️ Either you must have configured something so only you can reverse this configuration, or the hardware interferes so you must learn how to persuade the hardware to keep running regardless.

You probably already have browsed all the BIOS settings. Maybe the hardware was previously infested with Winblows? Do a factory reset, which usually involves physically removing the battery on the motherboard for a day. That’ll wipe any freak settings you can only access via some M$ desktop interface. A factory reset for the battery electronics is virtually impossible though. 🚮 It’s single‑use hardware.​
 
Hi. I have a laptop that has problems reading battery, and the system thinks the battery is at 0% even though it isn't.

What make and model laptop?

Most laptops don't shutdown according to displayed percent charge, but at a battery voltage well below rated volts.

FreeBSD also sees the battery as 0% as a result and always powers off after 10 minutes. Is there any way to prevent FreeBSD from shutting down when a low battery is detected?

Charge the system, then disconnect the power adaptor. Wait for about half a minute for readings to settle, then run

% acpiconf -i0 | tee -a somefile

Repeat every minute or so, so we can see the volts and watts measured during discharge.

Reattach charger, then post 'somefile' here in a code block.
 
Are you installed a DE? FreeBSD in default configurations does not power off the system in low battery
If you have, you can disable shutdown in low battery from power manager settings.
 
Are you installed a DE? FreeBSD in default configurations does not power off the system in low battery
If you have, you can disable shutdown in low battery from power manager settings.

Good point. Yes, let's see what happens in a FreeBSD console [edit: with DE not running or with changed settings.]
 
Back
Top