Safely draining the battery

I just installed new battery to an old laptop running pretty bare-bones endeavourOS and herbstluftwm (+ lxsession to cover the need for a polkit agent). The battery manufacturer recommends fully charging and discharging the battery a few times after installing it. The question is how do I get the system to shut down safely when the battery’s about to die?

I’m guessing this will involve a systemd hook or something, but I haven’t been able to find anything that’s not DE-specific. Please feel free to just point me to a wiki page or whatever.

Leave it running in the BIOS/UEFI or GRUB boot loader screen. Nothing to break at that point, and it ensures the battery is fully drained.


What type of battery is it?
NiMH, Lithium, or something else?

Even when using a Li-Ion battery, the manufacturer recommends that you sometimes discharge the battery to reset the controller.
I do this about once a year, leaving the laptop running on battery power on the BIOS screen.


Li-Ion. It’s a 10-yo Acer laptop that I’ve recently dropped an SSD in, maxed out the RAM (8GB!), etc.

I haven’t fully discharged (i.e. on purpose! :wink: ) a Li-Ion battery ever, and they all have been working well. Instructions that I’ve heard (I’m no battery expert myself) are to keep a Li-Ion battery mostly between 50%-80% of charge. Also they’ve said that do not discharge fully.

NiMH batteries have been a different story.

Also I’ve kept the Li-Ion batteries fully disconnected from the laptops always when possible.


Thanks, that works great as a solution to the immediate problem, but is there a way to tell the system to shut down when the battery hits a certain point?

Normally something like:


If you’re after something like a specific value (e.g. “power off at 25%”) then it should be possible, but I don’t know without looking… :thinking:

1 Like

Thanks. My issue was finding a DE-less solution, but the archwiki pointed me to powerkit, which seems to be exactly what I needed. It’s DE-independent and, among other things, it lets you specify a percentage at which to shut down (or hibernate or whatever).


Woah! That’s pretty cool! :+1: