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?

  • mlfh@lemmy.ml
    link
    fedilink
    arrow-up
    31
    ·
    7 months ago

    powertop is a cool tool that can analyze your machine and provide a list of suggested power optimizations

  • enviousCardinal@lemmy.world
    link
    fedilink
    arrow-up
    22
    ·
    edit-2
    7 months ago

    not related to longer battery life per se, but suspend-then-hibernate is the number one improvement to my daily use. the laptop suspends normally and if not woken in an hour, it suspends to disk. upon wake it restores from the swap file/partition. zero battery drain when off, resume from hibernate is faster than cold boot. I can go days without a charger; the other day I’ve “woken” it after like 10 days and did a full system upgrade - the battery and everything else was how I left it. after I was done, just closed it and left it.

    my laptop is my secondary workstation and it’s not rare that I don’t touch it for days. it sucks major balls when I have to urgently leave and find out it’s depleted.

    with systemd-boot and a fast and seamless boot process, this is as close as it gets to stuff Macbooks had more than 10 years ago.

    • mFat@lemdro.idOP
      link
      fedilink
      English
      arrow-up
      3
      ·
      7 months ago

      I’ve never had a laptop that hibernates correctly with Linux. Is it something I can achieve with more research or some laptops won’t hibernate anyway? I routinely have that shitty experience when I pick up my laptop to see it has no juice left although I didn’t use it and it was apparently asleep.

      • enviousCardinal@lemmy.world
        link
        fedilink
        arrow-up
        7
        ·
        edit-2
        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
          link
          fedilink
          arrow-up
          3
          ·
          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
            link
            fedilink
            arrow-up
            3
            ·
            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.

  • just_another_person@lemmy.world
    link
    fedilink
    arrow-up
    21
    ·
    7 months ago

    If you’re running AMD, TLP won’t help as much as running a 6.6+ kernel with the proper amd-pstate kernel module running. 6.8 takes it even further.

    • JustEnoughDucks@feddit.nl
      link
      fedilink
      arrow-up
      2
      ·
      7 months ago

      Damn, I looked at this thread hoping to optimize my server idle power draw.

      AMD 2700X, and Debian Bookworm kernel back ports just got to 6.6. Hopefully this doesn’t break my ZFS 😅

        • JustEnoughDucks@feddit.nl
          link
          fedilink
          arrow-up
          1
          ·
          7 months ago

          To be fair, of you just wait until the ZFS package is released with the corresponding kernel, everything works great. Just no unattended upgrades to the kernel on the back ports channel and you are golden!

  • 柊 つかさ@lemmy.world
    link
    fedilink
    arrow-up
    20
    arrow-down
    1
    ·
    7 months ago

    I once just needed to take notes in a lecture so I didn’t start my X server and just wrote in vim in TTY.

  • cmnybo@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    14
    ·
    7 months ago

    For more power savings, you can undervolt your CPU if it supports it. On some CPUs, it can result in significant power savings.

    Undervolting requires a lot of testing to make sure each core is stable under all conditions. There is no guarantee that a CPU will undervolt well though. Two identical CPUs can have significantly different results.

    • umbrella@lemmy.ml
      link
      fedilink
      arrow-up
      4
      ·
      7 months ago

      undervolting can also improve performance, depending on boost behaviour. it feels like you got a better binned chip.

    • Atemu@lemmy.ml
      link
      fedilink
      arrow-up
      1
      arrow-down
      2
      ·
      7 months ago

      I don’t see how undervolting would result in power savings on modern CPUs if you’re not up against clock limits as the CPU would simply boost higher.

  • terminhell@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    11
    ·
    7 months ago

    Lowering screen brightness, turn off keyboard back lighting.

    But thing is, on some devices, certain power states just may not work.

  • fuckwit_mcbumcrumble@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    11
    arrow-down
    1
    ·
    7 months ago

    On modern CPUs they’re designed to “race to idle”. Consequently when they’re not idle they’re not very efficient. The biggest change that improves my battery life is adjusting how I do certain things. Instead of trying to slow things down even more to save power I just try to get them to finish quicker so my CPU can get back to idle (and efficient) faster.

    Intel is really awful with this. AMD is better but slowly getting to Intel levels. E cores might change things up a bit, but I don’t have experience with them yet.

    • Goun@lemmy.ml
      link
      fedilink
      arrow-up
      3
      ·
      7 months ago

      Intel is really awful with this. AMD is better but slowly getting to Intel levels.

      I don’t follow, I thought AMD was less efficient. You say it’s the other way around but it’s getting worse? Or I’m reading it wrong?

      • TheGrandNagus@lemmy.world
        link
        fedilink
        English
        arrow-up
        4
        ·
        7 months ago

        I don’t follow, I thought AMD was less efficient.

        Hasn’t been the case since Zen launched in 2017.

        Although it took them 2-3 more years on laptop to overtake intel in efficiency, because of less sophisticated sleep stuff.

  • vbatts@lemmy.ml
    link
    fedilink
    arrow-up
    7
    ·
    7 months ago

    In the bios of many thinkpads there are options about powering USB ports while the machine is suspended or powered off. I disable that, because I want battery life even when suspended. Also an option about some windows suspend or S3 suspend, I chose S3 suspend, but don’t have clear evidence this choice makes a difference.

    • rotopenguin@infosec.pub
      link
      fedilink
      English
      arrow-up
      5
      ·
      edit-2
      7 months ago

      I don’t think that you’re losing any power with the “usb ports powered” option on. It’s just there if you want to use your (sleeping) laptop as a $1000 power bank to charge your phone.

      Personally, I turn it off just because I would rather use a $20 battery pack instead of wearing out my laptop.

      • vbatts@lemmy.ml
        link
        fedilink
        arrow-up
        1
        ·
        7 months ago

        yeah, ok. So I just went back to test the S3 Sleep power state option, and switched it to the Windows’y one, which the BIOS says Linux supports and it does, but now the machine seems to still burn battery when it’s suspended … So, I have found the larger culprit.

        • rotopenguin@infosec.pub
          link
          fedilink
          English
          arrow-up
          1
          ·
          7 months ago

          We are well into the age of “OEMs dgaf if S3 works”. Windows has not used it since sometime around 7, so it’s been bitrotting in every vendor’s firmware. With some models, you may have S3 working on day one, but a firmware update kills it and that’s too bad.

          S0ix idle is actually quite nice when you get it working, but when it is not the tools to diagnose it are terrible. The terminology around sleep states are also terrible, (what’s a package or core or platform C state? Could one of them find a different letter?). I have gone over the arch wiki, and DELETED Intel documents so many times…

  • catloaf@lemm.ee
    link
    fedilink
    English
    arrow-up
    6
    ·
    edit-2
    7 months ago

    Turn off radios (Bluetooth, wifi bands) that you aren’t using.

    Also GPUs, if you have more than one.

  • WereCat@lemmy.world
    link
    fedilink
    arrow-up
    6
    ·
    7 months ago

    I’m just using the Balanced power mode in Pop!_OS. I get around 6h of watching videos with 7540U on a 1200p OLED screen (400nit) at roughly 50% brightness. (65Wh battery).

    I don’t have any reference to battery life on Windows as I did not install it on my laptop but I suppose it should be a bit better.

    • mFat@lemdro.idOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      7 months ago

      Just checked out its github page. seems very interesting

    • yo_scottie_oh@lemmy.ml
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      7 months ago

      Jury’s out on disabling Javascript unless you only visit the same sites again and again. Since installing NoScript, I have to load and reload every site multiple times while I guess which domains to allow in order for the site to actually work. I’ve white listed the bare minimum on web sites I use frequently, but it’s still a daily occurrence that I visit a site I haven’t been to before.

  • Veraxis@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    7 months ago

    I am not sure what graphics you have, but I have an older-ish laptop with hybrid 10-series Nvidia graphics which do not fully power down even with TLP installed. I was finding that it continued to draw a continuous 7W even in an idle state. I installed envycontrol so that I can manually turn off/on hybrid graphics or force the use of integrated graphics. I noticed my battery life jumped from 2-3 hours to 4-5 hours after I did this, and unless I am gaming (which I rarely do on this laptop) I hardly ever need the dgpu in this.

    I also use TLP. I have tried auto-cpufreq and powertop, and I found TLP offered the most granular control and worked the best for my system/needs.

    • mFat@lemdro.idOP
      link
      fedilink
      English
      arrow-up
      3
      ·
      7 months ago

      My laptop has Intel UHD graphics. Things are slightly better since I enabled TLP.

    • loutr@sh.itjust.works
      link
      fedilink
      arrow-up
      3
      ·
      7 months ago

      Do you know if blacklisting nouveau actually disables the dGPU? It’s a work laptop so the iGPU is more than enough so I figured I wouldn’t bother with bumblebee or whatnot, but the battery life is shit :'(

      • Veraxis@lemmy.world
        link
        fedilink
        English
        arrow-up
        2
        ·
        7 months ago

        Sorry for the late reply. It sounds like it could be due to the dGPU if your battery life is terrible. I don’t know if that method would work or not. I had to try a couple different things before I eventually settled on envycontrol.

  • Sina@beehaw.org
    link
    fedilink
    arrow-up
    4
    arrow-down
    1
    ·
    edit-2
    7 months ago

    if battery is the priority the single biggest gain I can recommend is to use xorg with compositing off. (Gnome cannot do this, KDE can, if you use a WM then don’t use Picom etc)

    If you can tolerate screen tearing you can save a significant amount of power while web browsing.