[TRACKING] Linux battery life tuning

Yes, I get back to pc8. I’ve never hit pc10, still need to work on that one.

Elevated Systems just posted a review of various Linux distros running on the Framework laptop. He did this in “beginner mode” so he avoided any complicated tweaks to improve performance.

At the end he shows a graph that says across the board the framework laptop in linux, per hour, loses about 30% while active and has a few chrome tabs open, 5% during sleep. in windows he saw 16% active 1.5% sleep.

How does this compare to the experience when the power usage tweaks discussed in this thread are applied?

2 Likes

Not sure why Elevated Systems is getting these results but Ubuntu 20.04.3 does closer to 3.5% during suspend by default, no tweaks. That is using S2 suspend and not the more power efficient S3. S3 gives 1.6%/hr with 32GB of RAM, likely less with 16. Also as a side note distro hopping, hoping to find one that works well out of the box for certain hardware is a fool’s errand. The time spent doing that would likely be better invested in learning how to get a distro work well on that hardware. Sadly I didn’t get that when I started using Linux 15 years ago either. :sweat_smile:

I agree, but someone else distro hoping and sharing results saves me time :slightly_smiling_face:.
I’ll stick with distros I’m comfortable with, though. Saves me time searching for solutions in the long run.

True. I guess my point is that what distro just so happens to work on certain hardware configuration is not a great merit of a distro. I can see how it could be for a complete novice. But once you go just a smidge over the initial noviceness, then other merits become much more important. For example documentation (docs, wikis, community sources like SO, AskUbuntu, forums), size of software package collection, testing quality of that package collection, stability of those packages, timely application of security patches to packages in that collection, ability to install and manage proprietary software, being supported by open-source and proprietary vendors. For example being able to go to a project’s web site and always finding it’s packaged for your distro along with installation instructions is indispensable.

And this is a really important merit I skipped above since you mentioned it specifically. Proficiency and therefore comfort with a particular distro. That’s actually partially the result of the documentation merit. I do believe that the successful, productive and fun use of Linux is best achieved by picking a distro that scores high on those merits and then spending the time to learn how to use and manipulate the OS, this achieving proficiency and comfort with it. Something wrong with audio? Oh, I know, let me look at the PulseAudio config and logs. I know where my distro stores that and so I know where to look.

1 Like

Another data point on power loss during suspend:

Setup: i7-1185g7, 32 GB RAM, 1 TB NVME, 2 USB-C port, 1 USB-A port, 1 mini SD expansion, Fedora 35 beta, using “Power Saver” profile in default power manager

Outcome: 11 hrs suspend, battery went from 89% to 60% = 2.6%/hr

1 Like

I received my Framework in the mail yesterday, and while I’ve been using Linux on a desktop for years, this is my first experience using it with a laptop. I using Arch + Plasma, with most settings kept roughly as default, and was rather shocked at battery loss when sleeping. I went to bed last night with ~35% power and awoke this morning to a completely dead machine. I began by running powertop's configuration tool and set pretty much everything to ‘Good’, and activated its service as well. Are there any other recommendations? Is hibernation something worth looking into?

Yes. You can enable suspend to RAM which will lower your suspend power usage to under 2%/hr but that’s still going to drain your battery if you leave the machine for extended period of time. Also it’s not clear how reliable it is due to Intel basically not supporting it on this hardware. This is why you should enable either hybrid sleep or suspend-then-hibernate. The latter is likely the best compromise. Especially if you tend to close the lid and leave the laptop for a few days on occasion. Hibernation works reliably.

I’m even using a expansion module drive as my swap partition specifically for the purposes of hibernating Ubuntu. It is not nearly as fast as Windows on the NVME, but it works and is reliable.

I am so used to suspend to RAM and being able to just lift the lid and continue working, that the S0 of Windows sleep and then hibernate was really annoying. It felt like I was FOREVER just pushing the power button to resume. That I can just suspend on Linux is one of the primary reasons I’m back on Linux.

Should the standby situation improve (and I have no reason to believe they wont) I might move back. The joys of dual booting. You get to have your cake and eat it as well.

1 Like

@2disbetter - THANK YOU!!!

I have my system set up to boot Pop!_OS on the nvme and windows on an expansion module. I set up the nvme with encryption and didn’t size the swap properly for hibernation. I haven’t had a lot of success testing it on another machine, either. I saw your post about using the expansion module and figured it wouldn’t hurt to try. Lo and behold, it worked. I hadn’t been keeping the module installed as it is a bit of a power draw, but since I’m plugged in most of the time anyway it doesn’t really matter.

Anyway, just wanted to drop a note saying thank you for noting that. Hopefully it will work consistently.

1 Like

By the way, I’ve noticed that the PCIe ASPM policy (set, for example, via TLP’s PCIE_ASPM_ON_BAT=powersupersave) is ignored upon waking up from suspend (whether it’s “deep” or “s2idle”). Interestinly, upon wakeup, /sys/module/pcie_aspm/parameters/policy would still show powersupersave as active, but it’s not. A quick way to verify this is looking at powertop's “Idle stats” tab, where you’ll see C10 staying at 0% (whereas it was >0% before the suspend, under the same load).

A workaround is to “flip it”, setting the policy to anything other than “powersupersave” to then immediately switch it back; for example:

$ echo "powersave" | sudo tee /sys/module/pcie_aspm/parameters/policy
$ echo "powersupersave" | sudo tee /sys/module/pcie_aspm/parameters/policy

Right after, powertop's C10 idle stat will start showing values >0%.

Doesn’t work for me. After s2idle it still stays with C6 and higher at 0% even after swapping the policy.

On the other hand, using deep it goes to C10 for me without having to apply any workaround.

1 Like

Has anyone found a workaround to set the battery charge threshold?

The battery care part of TLP’s documentation mentions it, but it isn’t compatible with the current bios version yet.

Note, I’m still new to linux (little over a month so far) and coming from MacOS.

1 Like

My laptop is shipping soon and I plan to install manjaro Gnome (for wayland).

I see a lot of varying or (maybe?) conflicting recommendations in this thread.

Would anyone be willing to put together maybe a github gist or something like that with linux battery tweaking instructions for the framework? Then as new things are figured out people can submit PRs to make it better.

If not, I’ll do what I can as a seasoned linux user but with no experience with this stuff, and post the repo here with an open invitation to add to/change it. With any luck we can even make a script for people who don’t want to get their hands dirty

3 Likes

Pretty sure we have to wait for the UEFI to support it first, then it can probably be exposed through TLP (in addition the UEFI settings).

1 Like

Fresh Fedora 35 KDE install yesterday, manually installed but did not customize tlp, and two scripts to invoke powerprofilesctl on plug in or plug out.

Seeing as little as 2 hours estimated under heavy download, install, high brightness use case. Goes out to 7-9 hour range under medium brightness and light web browsing use case.

I would prefer to see more longevity playing video though. VLC playing 1080p h.264 from a samba share, YouTube 720p, playing a local 1080p copy of Sintel, etc all bring the estimated battery life under 4 hours. That’s a little odd to me after having run 5Y70 and 6Y30 class processors that get 5-7 hours of local or streamed video playback time from even smaller batteries… Good thing I have a 90w USB-PD source to recharge quickly, and the blending battery + weak USB power source thing is nice too.

Overall not too bad for a OOTB+super easy tweak setup.

Wonder if it’s possible to bring the frame rate down from 60 to 30 to increase battery longevity even further…

Sintel@1080p on YouTube, mid brightness, max sound

Idling at r/Framework, mid brightness

Ubuntu 20.04 w/ TLP on Batch 5, i5, 32GB RAM, WD SN550

Only non-default setting in tlp.conf is CPU_ENERGY_PERF_POLICY_ON_BAT=power.

2 Likes

So thing I learned today … TLP and Fedora’s default “power profiles daemon” aka PPD aka powerprofilesctl do not work together. Install and use one or the other, but not both. TLP seems to do a far better job for me in both Fedora and Arch.

Tried the new Endeavor OS iso that was released on 03 Dec (and using it with tlp only), to see if I get any better longevity from my favorite distro family, which is arch.

Further update, I think some of the power difference between Fedora and Endeavour was Bluetooth being off by default in endeavorOS. Adding the necessary packages and enabling it on my framework supplied AX210 (no vpro) has put 1-2W back into the usage reported by powertop, even with tlp correctly setting powersave on the AX210 card. Without power save on that card, usage is more like a constant 3+W regardless of Wifi / BT utilization. Longevities are similar with BT on in Endeavour and Fedora, with a noticable edge towards Endeavour.

Anyone trying to get more battery life should consider temporarily disabling Bluetooth and/or Wifi when possible. The AX210 seems to be a relatively power hungry card compared to the Intel cards I have in my older ultrabooks (8260 IIRC).

6 Likes

Further update:

EndeavourOS didn’t seem to have PSR on by default (C8 was the deepest it would idle OOTB). Adding the cmdline option into grub has definitely turned it on. With it on, I’m seeing true idle power consumption down another ~1-1.5W, CPU now reaching C10 state. However, the output of

cat /sys/kernel/debug/dri/0/i915_edp_psr_status

did not change from before to after the cmdline change.

Using kernel 5.15.6 currently btw.

2 Likes

After installing TLP, I run
systemctl start tlp.service
systemctl enable tlp.service

and then
systemctl status tlp.service
shows that its enabled and running…

reboot

tlp-stat -s still shows output, but

systemctl status tlp.service
shows inactive.

Am I missing something, or is this how TLP functions?? Is this thing on??? :stuck_out_tongue:

Thanks, all.

pAULIE42o
. . . . . . . . .
/s