Remix.run Logo
rubymamis 17 hours ago

Did someone do a deep dive on why battery life is so awful on Linux? Or is it some Ashai's driver's inefficiencies that causing this?

izacus 16 hours ago | parent | next [-]

Each controller and subcomponent on the motherboard needs a driver that correctly puts it into low power and sleep states to get battery savings.

Most of those components are proprietary and don't use the standard drivers available in Linux kernel.

So someone needs to go and reverse engineer them, upstream the drivers and pray that Apple doesn't change them in next revision (which they did) or the whole process needs to start again.

In other words: get an actually Linux supported laptop for Linux.

ellieh 15 hours ago | parent | next [-]

> In other words: get an actually Linux supported laptop for Linux.

40% battery for 4hrs of real work is better than pretty much any linux supported laptop I've ever used

nextos 14 hours ago | parent | next [-]

One of my favorite machines was the MacBook Air 11 (2012). This was a pure Intel machine, except for a mediocre Broadcom wireless card. With a few udev rules, I squeezed out the same battery performance from Linux I got from OS X, down to a few minutes of advantage in favor of Linux. And all this despite Safari being a marvel of energy efficiency.

The problem with Linux performance on laptops boils down to i) no energy tweaks by default and ii) poor device drivers due to the lack of manufacturer cooperation. If you pick a machine with well supported hardware and you are diligent with some udev rules, which are quite trivial to write thanks to powertop suggestions, performance can be very good.

I am getting a bit more than 10 hours from a cheap ThinkPad E14 Gen7, with a 64 Wh battery, and light coding use. That's less than a MacBook Air, where I would be getting around 13-14 hours, but it's not bad at all. The difference comes mainly from the cheap screen that is more power consuming and ARMs superior efficiency when idling.

But I prefer not to trade the convenience and openness of x86_64 plus NixOS for a bit more battery range. IMHO, the gap is not sufficiently wide to make a big difference in most usage scenarios.

cosmic_cheese 14 hours ago | parent [-]

The need to tweak that deeply just to get “baseline” performance really stings, though, particularly if you’re not already accustomed to having to do that kind of thing.

It’d be a gargantuan project, but there should probably be some kind of centralized, cross-distro repository for power configuration profiles that allows users to rate them with their hardware. Once a profile has been sufficiently user-verified and is well rated, distro installers could then automatically fetch and install the profile as a post-install step, making for a much more seamless and less fiddly experience for users.

ffsm8 13 hours ago | parent | next [-]

Not trying to discredit your idea, but I feel like you're misrepresenting the amount of optimization apple does by calling it baseline.

It's generally the most optimized system down to the fact that Apple controls everything about it's platform.

If that's considered baseline, then nothing but full vertical integration can compete

cosmic_cheese 13 hours ago | parent [-]

For some laptops, this applies in comparison to Windows, too though (see elsewhere in thread for examples).

nextos 12 hours ago | parent | prev [-]

The advantage of Apple is that they deal with a tiny amount of hardware. Vertical integration enables aggressive optimizations.

I agree that in case of Linux, a udev rule generator would be a fantastic step ahead in terms of usability.

overfeed 13 hours ago | parent | prev | next [-]

> 40% battery for 4hrs of real work is better than pretty much any linux supported laptop I've ever used

Not sure what "real work" is for you, but I regularly get more than 12 hours of battery life on an old Chromebook running a Linux and the usual IDEs/dev tooling (in a Crostini VM). All the drivers just work, sleep has no detectable battery drain. It's not a workstation by any means, but dual core Intel's are great for Python/Go/TypeScript

trinix912 11 hours ago | parent [-]

Out of curiosity, does Google contribute the drivers for Chromebook hardware to Linux upstream or do they keep it for themselves? Could it be that they just choose the hardware that works very well out of box with Linux?

overfeed 4 hours ago | parent [-]

I have no idea if there's upstreaming, but the Chomium OS repo is open source so you could check.

I don't know if that would help the wider Linux laptop community, because Chromebook OEMs can only select from a small list of CPU & chipset hardware combinations blessed by Google

ryukoposting 12 hours ago | parent | prev | next [-]

What's the bar here? My Thinkpad X270 gets about 16 hours under Ubuntu with swaywm.

If we really want to get pedantic, its internal battery means the external pack is hot-swappable, so I can actually get several days on a "single charge." Good machine for camping trips.

izacus 13 hours ago | parent | prev [-]

[flagged]

dang 13 hours ago | parent [-]

Please don't cross into personal attack, name-calling, or cross-examination. This is in the site guidelines: https://news.ycombinator.com/newsguidelines.html.

I see how the GP comment could be provocative, but on this site we want responses that dampen provocation, not amplify it.

Forgeties79 16 hours ago | parent | prev [-]

>In other words: get an actually Linux supported laptop for Linux.

For a lot of people the point is to extend the life of their already-purchased hardware.

happymellon 16 hours ago | parent | next [-]

Linux might work with your hardware, but it might not work well.

If your vendor is hostile like Apple, it will be hard to make it keep on working.

izacus 13 hours ago | parent | prev | next [-]

Noone is doing that with ARM MacBooks.

Forgeties79 13 hours ago | parent [-]

Yet. Plenty of people have with Intel ones - I’m one of them. My first experience with Linux was on a 2016 MBpro. And inevitably people will do the same with the silicon Macs, likely using Asahi it seems.

Why are some of y'all so hostile to this idea?

bigyabai 11 hours ago | parent [-]

It's not inevitable. That's not what that word means.

Intel Macs supported Linux because they used Intel's Linux drivers and supported bog-standard UEFI. There are no preexisting drivers or DeviceTree files published by Apple for Linux. There is no UEFI implimentation, just a proprietary bootloader that can be updated post-hoc to deny booting into third-party OSes.

> Why are some of y'all so hostile to this idea?

I would love for Linux to support as many ARM devices as possible. Unfortunately, it requires continuous effort from the OEM to be viable. I've bought Qualcomm, Rockchip and Broadcom boards before, none of them have been supported for half as long as my x86 machines are. Nevermind how fast ARM architectures become obsolete.

It feels like Apple is really the only hostile party here, and they coincidentally decide whether or not you get to use third-party OSes.

Forgeties79 11 hours ago | parent [-]

It is inevitable. I guarantee you there will be people who run Linux on their silicon Macs. I don’t know how you could possibly hold a stance that no one ever will.

Apple is very hostile to it. It won’t stop everyone though. It’ll continue to be niche but it’s happening.

bigyabai 10 hours ago | parent [-]

It's not inevitable. It's fragile. Go boot up your old iPad; that should be well-studied, right? We ought to know how to boot into Linux on an ARM machine that old, it's only fair.

Except, you can't. The bootloader is the same iBoot process that your Apple Silicon machine uses, with mitigations to prevent unsigned OSes or persistent coldboot. All the Cydia exploits in the world won't put Linux back on the menu for iPhone or iPad users. And the same thing could happen to your Mac with an OTA update.

It is entirely possible for Apple to lock down the devices further. There's no guarantee they won't.

musictubes 7 hours ago | parent | next [-]

Sigh.

Apple cannot lockdown the Mac. You can’t have a development machine that is incapable of running arbitrary code. Back when they still did WWDC live they said that software development was the biggest professional bloc of Mac users. I’m certain that these days development is the biggest driver of the expensive Macs. No one has ever made a decent argument as to why Apple would lock down the Mac that would also explain why they haven’t done it yet.

Passivity isn’t hostility. There isn’t any evidence that Apple is considering locking down the Mac. They could have easily done that with the transition to their own silicon but they didn’t despite the endless conspiracy theories.

Forgeties79 7 hours ago | parent | prev [-]

We have been talking about laptops from the very beginning. I don’t know why you keep talking about iPads.

kelnos 16 hours ago | parent | prev | next [-]

That's an admirable goal, but, depending on the hardware, it can run into that pesky thing called reality.

It's getting very tiresome to hear complaints about things that don't work on Linux, only to find that they're trying to run it on hardware that's poorly supported, and that's something they could have figured out by doing a little research beforehand.

Sometimes old hardware just isn't going to be well-supported by any OS. (Though, of course, with Linux, older hardware is more likely to be supported than bleeding-edge kit.)

mystifyingpoi 16 hours ago | parent [-]

> It's getting very tiresome to hear complaints

This is very true. I've been asked by lots of people "how do I start with Linux" and, despite being 99.9% Linux user for everything everyday, my advice was always:

1. Use VirtualBox. Seriously, it won't look cool, but it will 100% work after maybe 5 mins mucking around with installing guest additions. Also snapshots. Also no messing with WiFi drivers or graphics card drivers or such.

2. Get a used beaten down old Thinkpad that people on Reddit confirm to be working with Linux without any drivers. Then play there. If it breaks, reinstall.

3. If the above didn't make you yet disinterested, THEN dual boot.

Also, if you don't care about GUI, then use the best blessing Microsoft ever created - WSL, and look no further.

opan 14 hours ago | parent | next [-]

I've never gotten along too well with virtualization, but would second the ThinkPad idea, or something similar. Old/cheap machine for tinkering is a good way to ease in, and I think bare metal feels more friendly.

I'd probably recommend against dual booting, but I understand it's controversial. I like to equate it to having two computers, but having to fully power one off to do anything* on the other one. Torrents stop, music collection may be inaccessible depending on how you stored it, familiar programs may not be around anymore. I dual booted for a few years in the past and I found it miserable. People who expected me to reboot to play a game with them didn't seem to understand how big of an ask that really was. Eventually things boiled over and I took the Windows HDD out of that PC entirely. Much more peaceful. (Proton solves that particular issue these days also)

That being said, I've had at least two friends who had a dual boot due to my influence (pushing GNU/Linux) who ended up with some sort of broken Windows install later on and were happy to already have Ubuntu as an emergency backup to keep the machine usable.

*Too old might be a problem these days with major distros not having 32bit ISOs anymore

charcircuit 15 hours ago | parent | prev [-]

WSL supports GUI apps now. They open up just like any other GUI app on Windows.

mystifyingpoi 14 hours ago | parent [-]

I've tried this once for IntelliJ to work around slow WSL access for Git repos. Was greeted by missing fonts and broken scaling on the intro screen. Oops. But probably I was just unlucky, it might work well for most.

bigyabai 16 hours ago | parent | prev [-]

1. Linux isn't a panacea for depreciated hardware, and it never will be.

2. If your priority is system lifespan, you are already using OEM macOS.

yjftsjthsd-h 12 hours ago | parent | next [-]

1. I dunno about a panacea, but it's pretty great for old hardware. My 2011 desktop still runs Alpine Linux just fine.

2. By all means start with macOS, but eventually Apple will stop supporting your machine. And y'know what will still work and get updates then? Linux.

bigyabai 12 hours ago | parent [-]

> but it's pretty great for old hardware

Which old hardware? You're circling around to the grandparent's point again; Linux support is hardware dependent.

> And y'know what will still work and get updates then?

No, I don't. Depreciated iPads lay dead in piles, and they don't run Linux for shit. You want me to believe the M4 will graduate to the big leagues?

Forgeties79 15 hours ago | parent | prev [-]

Never said it was “panacea for depreciated hardware.” I’m saying it’s a common use case.

Every thread about Linux inevitably someone says “it gave new life to my [older computer model].” We’ve all seen it countless times.

Forgeties79 11 hours ago | parent [-]

And there it is: https://news.ycombinator.com/item?id=46387364

bigyabai 8 hours ago | parent [-]

It's a common use-case for x86 machines that implement UEFI. Taking the iPhone and iPad into account, it is a nonexistent use-case for mobile ARM chipset owners.

Forgeties79 6 hours ago | parent [-]

>taking the iPhone and iPad into account

This post is about the MacBook Air M2. The discussion has been about silicon MacBooks - laptops - from the start.

dllu 14 hours ago | parent | prev | next [-]

Apple does tons of optimizations for every component to improve battery life. Asahi Linux, which is reverse engineered, doesn't have the resources to figure out each of those tricks, especially for undocumented proprietary hardware, so it's a "death by a thousand cuts" as each of the various components is always drawing a couple of milliwatts more than on macOS.

paddim8 15 hours ago | parent | prev | next [-]

It absolutely is not awful. You are doing something wrong then. It's not as good as on macOS of course but it's still great. I get 8-10 hours.

mort96 14 hours ago | parent | next [-]

Eh it's pretty awful. I get 8 hours, yes, but in Linux, those 8 hours are ticking whether my laptop is sleeping in my bag or on my desk with the lid closed or I'm actively using it. 8 hours of active use is pretty good, but 8 hours in sleep is absolutely dreadful.

imiric 15 hours ago | parent | prev [-]

Exactly. This myth keeps being perpetuated, for some reason.

I'm typing this from a ThinkPad X1 Carbon Gen 13 running Void Linux, and UPower is reporting 99% battery with ~15h left. I do have TLP installed and running, which is supposed to help. Realistically, I won't get around 15h with my usage patterns, but I do get around 10-12 hours. It's a new laptop with a fresh battery, so that plays a big role as well.

This might not be as good as the battery life on a Macbook, but it's pretty acceptable to me. The upcoming Intel chips also promise to be more power efficient, which should help even more.

bjackman 13 hours ago | parent | prev | next [-]

For optimal battery life you need to tweak the whole OS stack for the hardware. You need to make sure all the peripherals are set up right to go into the right idle states without causing user-visible latency on wake-up. (Note that often just one peripheral being out of tune here can mess up the whole system's power performance. Also the correct settings here depend on your software stack). You need to make sure that cpufreq and cpuidle governors work nicely with the particular foibles of your platform's CPUs. Ditto for the task scheduler. Then, ditto for a bunch of random userspace code (audio + rendering pipeline for example). The list goes on and on. This work gets done in Android and ChromeOS.

CamouflagedKiwi 12 hours ago | parent | prev | next [-]

Asahi doesn't yet support all the CPU power states etc. This is a known limitation, not sure how easy it is to reverse engineer though.

temp0826 16 hours ago | parent | prev [-]

This is the case with most (all?) laptops running Linux regardless of hardware unfortunately.

fsh 16 hours ago | parent [-]

This doesn't match my experience. My previous three laptops (two AMD Lenovo Thinkpads, one Intel Sony VAIO) had essentially the same battery life running Linux as running Windows.

functionmouse 15 hours ago | parent | next [-]

You're lucky, my thinkpad x13 gen 2 AMD gets 5 hours on modern Fedora vs. 9 or 10 on Windows.

maxhille 2 hours ago | parent [-]

I also have an X13 Gen2 AMD. My idle power consumption is 2.5W to 4W depending on brightness. This ends up in 12h-15h (machine/battery ist 2y old I think).

I think you can improve your power settings.

sincerely 15 hours ago | parent | prev | next [-]

I have an AMD thinkpad and get maybe 1/4 the battery life on Linux as I do when I boot inti Windows, did you have to do any tweaking to achieve that?

fsh 15 hours ago | parent [-]

I typically install and enable tlp [1], but that's it. Some distros/DEs might have it out of the box, but on Arch I had to do it myself.

[1] https://wiki.archlinux.org/title/TLP

martini333 16 hours ago | parent | prev [-]

I think MacOS was implied...

olyjohn 16 hours ago | parent [-]

Have you ever put MacOS on a PC laptop? Terrible hardware support and the worst battery life of any OS.

functionmouse 15 hours ago | parent [-]

I used to hackintosh every laptop I could get my hands on that could do it, and always saw better battery life on OS X vs. Windows.