[TRACKING] Linux battery life tuning

I’m seeing the same. On my system (i5-1135g7, 32GB, 2x USB-C and 2 slots empty, Fedora 36 with kernel 5.17.11-300) with s2idle and nvme.noacpi=1, I saw a drop of 20% over 28 hours… so roughly 0.71%/hr.

1 Like

Is there a way to monitor one’s battery level and get a graph of battery charge level over time?

I have been wanting this for a while. I have not been able to find it. It would help to answer questions like “when is my battery level going down faster than I think?” and “is my battery too old and not holding a charge?” and many others.

Any suggestions?

Just a PSA, I get very different standby consumption values if I do “sudo systemctl suspend” from command line versus selecting suspend from KDE GUI. The former is the ~.8% per hour that others are reporting, the latter results in somewhere between twice and three times as much. Using s2idle in both cases.

Either way, one my EndeavourOS install, the keyboard backlight gets left on when entering suspend, which I would not consider to be a desirable behavior. I have not spent much time to troubleshoot this, though, as I do not use suspend very often in my daily workloads.

So I think we should standardize on command-line initiated, manually verified keyboard backlight off before lid close when trying to compare suspend power draws.

There used to be something like that for gnome, but I wasn’t able to find something that was distributed as a standard. So I use a script:

#!/usr/bin/env python3
from datetime import datetime
from time import sleep
import argparse

def logpow(n):
    d_old = None
    c_old = None
    while True:
        d = datetime.now()
        D = d.strftime("%Y-%m-%d %H:%M:%S")
        with open('/sys/class/power_supply/BAT1/charge_now','r') as F:
            C = F.read().strip()
        c = int(C)
        if c_old is not None:
            p = (c-c_old)/((d-d_old).total_seconds())*3600*1.54e-5
            print("{}, {}, {:.2f}W".format(D,C,p), flush=True)
            print("{}, {}".format(D,C), flush=True)
        d_old = d
        c_old = c
parser = argparse.ArgumentParser(description="log battery charge at regular time intervals")
parser.add_argument("-i","--interval", type=float, default=60, help="log interval in seconds (default 60)")
args = parser.parse_args()

and redirect the output to a file. You can parse that file and make a graph. It also prints the average power use between two samples, which with 1 minute gaps is pretty reliable. Most of the time, that’s sufficient info for me.

On Fedora 35 with Gnome, the keyboard backlight goes off, as far as I can tell. I usually don’t use the CLI or menu options to suspend though: I usually close the lid or press the power button (briefly).

1 Like

Gnome power statistics, I use it with Fedora 35.

1 Like

For folks who are seeing improvements in battery life during standby after setting the “nvme.noacpi=1” kernel parameter, could you share what SSD you are using and if possible, what version of firmware is running on it?

We’ve worked with Western Digital and found that SN750 with 111110WD and older firmware needs that workaround, but updating to 111130WD and newer does not.

Edit: Also, for folks who are not seeing improvements with “nvme.noacpi=1”, could you also share your SSD and the firmware version on it?

1 Like

I have the SN750 running 111130WD. Now I’m curious to see what I’ll get if I remove the “nvme.noacpi=1” and leave it in s2idle overnight again.

By the way, you commented in September about working to resolve the drain by USB-A and HDMI cards. Will the 3.08 BIOS finally do that?

Tagging along…Does the 12th gen board have the same issue, or is it fixed?

Samsung 980 Pro 1TB
Firmware 3B2QGXA7 (not latest, 5B2QGXA7)

WDC PC SN730 SDBPNTY-512G (11140000)

I’m pretty sure nvme.noacpi=1 made a huge difference for me.

Oh thanks! That’s what I used before. I don’t know how I missed it still exists. One draw-back is in the “rate” tab it’s rather difficult to see the actual discharge rate over suspended periods.

1 Like

Guys, if you want to know your BIOS firmware version, you will find the way at BIOS guide - #118 by Simon_Brand .

@junaruga I think there’s a little misunderstanding here: Nirav most probably meant the SSD firmware version, not the BIOS firmware version.

1 Like

Oh I didn’t know that the SSD has the firmware. Thanks for explaining it to me.

My experiment last night showed a significant difference despite having the newer SN750 firmware…

s2idle without the “nvme.noacpi=1” parameter: 4%/hour

s2idle with the “nvme.noacpi=1” parameter: 2.7%/hour

deep sleep: 2.7%/hour

The s2idle tests were running the Linux 5.17.9 kernel, and I had three USB-A cards and one USB-C card installed. The deep sleep test was running the Linux 5.14.10 kernel.

I can get it with “inxi -Da | grep rev” on my system.

I had to run this as root using sudo.

SK Hynix P31

inxi - Da output:

model: SHGP31-500GM-2

serial: CJ09N90041050A*** (user redacted)
rev: 41060C20

I assume rev is the firmware revision, but I don’t know for sure.

I did not take awesome metrics with and without nvme.acpi, but I believe having this on cuts s2idle standby drain by 60-80%. I’ll try to get to doing some more specific metrics.

On Slackware Linux here with powertop (i5 11th gen, 32GB RAM). I have 2 USB-C and 2 USB-A currently installed, and 4.5 hrs to 7.5 hrs (I am yet to test the full 10 hours 20 minutes that it shows me).

However I only see a marginal/negligble increase in battery life on stand by with “nvme.noacpi=1”.

model: WDS100T1X0E-00AFY0
rev: 614900WD

I’m using “Vitals” Gnome extension, resuming from s2idle I can briefly see the drain rate during that time (above the dropdown box in the panel) but I calculate it from the total “Energy (now)” before sleep and after.


SSD: SN850 1TB
SSD firmware version: 614900WD
Framework laptop BIOS version: 3.07
OS: Ubuntu 22.04 LTS
Kernel version: 5.15.0-35-generic
Kernel command line: quiet splash nvme.noacpi=1
Sleep / suspend method: systemctl suspend
Sleep / suspend duration: 8 hours
Battery charge lost / drained: 33%

1 Like