94
submitted 7 months ago by mfat to c/linux@lemmy.ml

I've installed TLP on my Lenovo ThinkBook laptop and was wondering if there are additional steps I can take to extend the battery life when using the laptop unplugged.

Could you please share more tips and tricks for maximizing battery life on Linux laptops?

you are viewing a single comment's thread
view the rest of the comments
[-] enviousCardinal@lemmy.world 7 points 7 months ago* (last edited 7 months ago)

it is insanely cumbersome to achieve this, but it is doable and once set up, it runs like a dream. I've got it on a T480s (F40), T420s (Arch), MBP 2010 (Debian 12) and MBPr 2012 (F39), all with encrypted LVM + btrfs, some with a swap subvolume, some with a separate swap partition outside of LVM (waaay faster boot, no decrypt prompt - dreamboat!)

basically you have to allocate a swap file, subvolume, or partition that's RAM * 1.5 (on account of zram) but don't add it to fstab. then you have to dick around with systemd scripts that turn off zram and activate swap on suspend and do the reverse on resume. then, dracut or mkinitcpio have to be set up to use the resume funcionality (when coldbooting it looks for the resume swap file and if present restores this instead of booting). also, there's adding kernel switches to systemd-boot or GRUB to utilise resume.

edit: oh yeah, also taming selinux to allow you to write to said swap.

now that would be just enabling hibernation, but I don't like explicitly activating suspend or hibernate, I wan't it to hibernate after I've left it in suspend for a while; I've set it to 60 mins. that way I don't have to think about it, just use my laptop like it's actually 2024.

also, since you're now coldbooting several times per day, it's essential that this process is as fast and jerkless as possible, hence systemd-boot with all pauses and timeouts set to zero.

the steps involved depend on your distro, I've made it work with Fedora, Arch and Debian. Here's a good primer so take it from there and use the arch wiki and experiment.

[-] Elkenders@feddit.uk 3 points 7 months ago

I'm moderately capable but a bit of a noob and oddly enough have a t480 with Debian and been trying to get hibernate to work. Did you figure this out yourself or was there a guide you followed that you might be able to point me to?

[-] enviousCardinal@lemmy.world 3 points 7 months ago

I've outlined the steps you have to take in my 1st post. basically, add swap, add resume to loader, rebuild initramfs, selinux policies, trick systemd to ignore absent swap (it gets activated on suspend) and that's pretty much it. then once systemctl hibernate works, switch suspend with suspend-then-resume system wide; optional, if you don't want that (spoiler: you do want that).

first made it work on fedora (linked post in my previous reply) and then recreated it in Arch with copious help from the wiki; not much different except mkinitcpio instead of dracut. then redid it in debian first with GRUB and then replaced it with systemd-boot.

maybe do a step-by-step writeup one of these days if I find the time.

this post was submitted on 28 Mar 2024
94 points (98.0% liked)

Linux

48007 readers
872 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS