Monster battery life with Linux

Discussion in 'MacBook Air' started by Roman2K~, Nov 3, 2011.

  1. Roman2K~, Nov 3, 2011
    Last edited: Nov 6, 2011

    Roman2K~ macrumors 6502a

    Mar 11, 2011
    Hopefully that will motivate more people to install Linux* on their MBA. Such good hardware deserves an even better and fully tunable OS ;).

    Idle - Linux
    X was running with XMonad (1 workspace and 2 tiles), urxvt, Chromium (1 tab), Wi-Fi

    • Display on: 12 .. 13 hours
    • Display off: 16 hours
    Linux VT1, Linux VT7:
    [​IMG] [​IMG]

    Idle - Mac OS X (Lion)
    No applications launched, Wi-Fi

    • Display on: 11 hours

    720p - Linux
    x264 video, MKV container, muted, from SSD (ext4 on LVM), Wi-Fi

    • VLC, HW accel off: ~3h45 (there must be room for improvement as the video was choppy, surprising for VLC)
    • mplayer2, HW accel off: ~4h45
    • mplayer2, HW accel on: ~6h35
    Linux VLC SW, mplayer2 SW, mplayer2 HW:
    [​IMG] [​IMG] [​IMG]

    720p - Mac OS X
    Same, from SSD (HFS+), Wi-Fi

    • VLC, HW accel incompatible: 4h38

    Result on 720p playback: +1h57 or +42% battery life.

    That's on an MBA 3,2 (late 2010, 13", 2.13 GHz). I'm currently trying my hands on it before doing the same on a 4,2 (mid 2011, 13", i5).

    In this post, I won't go into details about power saving optimisation and what's left to do (there's still room for improvement), but I'm so pleased with the current result that I thought I would share it with other MBA enthusiasts. 12 hours is better than the highest estimate I got in OS X (11 hours). Combine that with hardware accelerated H.264 decoding that you don't get in OS X (in both mplayer2 and VLC), CPU voltage control (Core 2 Duo only), and you get monster battery life out of such a small machine. I love it :cool:.

    * Gentoo Linux, hand-configured kernel v3.0.6

    P.S.: I'm planning on writing a guide on installing a clean, lean Gentoo Linux on a MacBook Air (both 3,2 and 4,2). In the meantime, if anyone needs instructions during their installation, I can help.
  2. nexsta, Nov 3, 2011
    Last edited: Nov 3, 2011

    nexsta macrumors 6502

    Jul 21, 2007
    Who cares about the battery life in idle?
    Test this on web surfing or video playback and then lets see the difference between osx and linux.
  3. calvol macrumors 6502a

    Feb 3, 2011
    Roman, I would be interested in knowing more about this. I run Ubuntu on a Dell laptop, and wondered how it would do on my 2010 Air 13. Can a dual-boot configuration with Linux/OSX be installed?
  4. eric/ Guest


    Sep 19, 2011
    Ohio, United States
    I get 6-7 hours of battery life using the Air on OSX.
  5. baude macrumors newbie

    Feb 23, 2011
    I'd really appreciate if u could make that guide and show it to us!

    Thanks for the information!
  6. NutsNGum macrumors 68030


    Jul 30, 2010
    Glasgow, Scotland
    Dear Lord.

    Buy this beautiful computer and then install an OS that looks like a 13 year old XP beta.

    No thanks.
  7. old-wiz macrumors G3

    Mar 26, 2008
    West Suburban Boston Ma
    I thought it looked more like DOS 3.1
  8. Roman2K~, Nov 3, 2011
    Last edited: Nov 3, 2011

    Roman2K~ thread starter macrumors 6502a

    Mar 11, 2011
    Yep, I'm planning to. I didn't have time yesterday but I'll perform those tests soon and report back.

    Good to know there's interest :). And yes, you can dual boot Linux and OS X (and more, even Windows). I'll document the steps as soon as I have a fully working configuration.

    Is that idle or during regular usage?

    Haha! :D I knew someone would say that. In the picture, it's only one of the virtual terminals, that does indeed "look like DOS", but that's the one running as root with PowerTOP (excellent power-usage profiling tool from Intel) which is what I wanted to show as an illustration.

    There's actually a full graphical tiling window manager running in one of the other virtual terminals (hidden) at native resolution, and Chromium and a terminal emulator (urxvt) each in its own tile. The window manager in question is XMonad (not shown here, but there's plenty of screenshots around) but you have the option to install Enlightenment, Gnome, Unity, KDE or any other window manager you like.
  9. KnightWRX macrumors Pentium


    Jan 28, 2009
    Quebec, Canada
    What's "beautiful" about a slab of aluminum with some plastic and glass ? :rolleyes:
  10. NutsNGum macrumors 68030


    Jul 30, 2010
    Glasgow, Scotland
    Cheer up, Knight! Everyone else around here manages to crack a wee smile now and then.

    Old-Wiz - I was referring to Gentoo itself, rather than the screen in the pic.
  11. mark28 macrumors 68000

    Jan 29, 2010
    If you don't like the GUI, change it. It's not like you are stuck with the GUI like a closed system like OS X.

    And besides, Linux is#1 for serious performance. It's not about making pretty GUI's.
  12. NutsNGum macrumors 68030


    Jul 30, 2010
    Glasgow, Scotland
    Sorry, I wasn't aware I'd entered the Linux cheerleading area.
  13. Xikum macrumors 6502

    Oct 19, 2011
    Do you disregard everything that isnt made by Apple?
  14. orfeas0 macrumors 6502a

    Aug 21, 2010
    Athens, Greece
    If you have no interest in linux, let people who do talk about it, and not act like a dictator/troll and flame linux and the ones who use it.

    @OP, how much do you think the battery will drain if you use a GUI like gnome/unity instead of just terminals?
  15. NutsNGum, Nov 4, 2011
    Last edited: Nov 4, 2011

    NutsNGum macrumors 68030


    Jul 30, 2010
    Glasgow, Scotland
    Hmm, no.

    orfeas0 - For you to call someone a troll, they must be doing something right, as you evidently wrote the handbook. Also, I find it hilarious that you would call me a dictator, whilst more or less telling me not to post in the thread. That's called irony.
  16. canesalato macrumors 6502a


    Jan 31, 2010
    Imho A 12 hour idle time doesn't mean much if we don't know:
    - Screen brightness
    - Bluetooth status (on/off)
    -composite manager is on or off?
    And i think it would be more fair to try with something like kde/gnome/unity...
    even then a web oriented test would be more useful...i found linux to often be pretty good when idle and pretty bad when browsing the web or doing something more intensive...but I'm talking about ubuntu, suse and fedora, it's been a lot since I stopped using gentoo...about 8 years or more :)

    Btw: macbook air 2011 13" i5: wifi on osX 10.7.2, safari open, wifi on, bt off, 50% brightness: 9h:28
  17. Xikum macrumors 6502

    Oct 19, 2011
    All you have done in this thread is put down OP's work. Why? Because it isnt pretty! Oh no!

    You are the kind of person who gives Mac users their pretentious image.

    OP posted an example of his interesting work with Gentoo, and we are interested in how he did it/a walkthrough for it. If you aren't interested, then leave; we dont need your crappy comments which do noting but put down OPs work.

    @OP; are you definitely going to write a guide for this? I'd be interested in trying out some Linux-based OS, particularly something like Gentoo.
  18. NutsNGum macrumors 68030


    Jul 30, 2010
    Glasgow, Scotland
    Actually, if you read what I said, I didn't put down his work. I said it wasn't for me. And to be honest, the OP seemed to take it in relatively good humour in his post that addressed it.

    I wasn't counting on Captain Linux stopping by to hammer home how brilliant command-line interfaces are.
  19. KnightWRX macrumors Pentium


    Jan 28, 2009
    Quebec, Canada
    They're not just brilliant, they are beautiful and graceful in their power and flexibility. ;) <-- there's your smile.

    I work with bash all day long, nothing better than piping a stuff through sed/awk/grep/xargs/tc/tee/paste/wc/cut and tons of other very simple and elegant utilities that all work together so seamlessly and perfectly.

    Text based UIs are just magical. X11 is just a better conduit to running many terminals at once. Or just use screen if you're bold enough.

    I love when my MacBook Air is displaying Terminal in fullscreen.
  20. 3dflyboy1 macrumors 6502

    Jun 27, 2011
    California, USA
    Great!! I might install Fedora on my MBA soon. Gentoo isn't really my thing.
  21. crewkid89 macrumors regular


    Jun 16, 2011
    United States
    Please don't feed the trolls, it only makes them multiply.
  22. bill-p macrumors 68000

    Jul 23, 2011
    Well, in terms of battery life, I can get 12 - 15 hours on idle with OSX using Coolbook... or 10 hours of continuous use just typing texts.

    So I'm not sure what to make of this...
  23. Abstract macrumors Penryn


    Dec 27, 2002
    Location Location Location

    But the products Apple made with those materials are quite nice.
  24. gpat macrumors 6502a

    Mar 1, 2011
    To be honest, I always got pretty low battery life on my PCs under Linux, compared to OS X or Windows. But I always used heavy distros like Ubuntu, so I don't know if it depends on that. But I think Linux isn't really optimized for low power usage on x86.
  25. Roman2K~, Nov 5, 2011
    Last edited: Nov 5, 2011

    Roman2K~ thread starter macrumors 6502a

    Mar 11, 2011
    Hey everybody,

    I'm so glad there's this much activity in this thread. Even though I haven't gone into specifics yet, mentioning Linux as an alternative (especially with a virtual terminal in the picture) has sparked reactions are about GUI vs. console. I don't think any of it is trolling. In fact, I think it's good to have this kind of debate from people with different tastes regarding GUI vs. console. Hopefully this will get people thinking about OS X being taken for granted on these nice machines.

    No idea about Gnome or Unity. So far, XMonad only. This is a GUI, though one of the lightest around (simple but highly configurable tiling window manager, no bells or whistles by default), and the "12 hours idle" was actually with it running (in the background). I'll perform tests when I'll have all drivers configured.

    • Screen brightness was about the equivalent of 2 bars.
    • The Bluetooth driver (USB HCI) was loaded so I guess it was on, but no process was using it.
    • A window manager was started: XMonad (tiling, not compositing)

    I agree. Idle estimates aren't that useful compared to web usage ones, but that's all I have for now. I will perform more tests once the drivers part is all worked out. See below for details.

    Now that I know there's interest, I'm definitely going to write a guide. I have taken notes of the steps I have taken so far and am keeping this up as I'm configuring drivers. Once I have a configuration I'm happy with (especially: slim kernel, low power consumption on battery, performance on AC, suspend to RAM and suspend to disk), I'll make a guide out of the notes.

    Well, Fedora is roughly just a default kernel / modules, default set of installed packages and respective configurations. You could build a custom OS tailored to your particular computer and tastes with Arch or Gentoo.

    If you take a big generic blob like Ubuntu, surely it won't be optimized for low power on your particular computer. If you compile everything, you can optimize the resulting binaries for your particular processor model, hand-pick drivers for the rest of the components, and configure low power mode (when on battery). People have seen respectable battery life gains with just this script. That should give you an idea of just how much of a difference you can make with little work, by not relying on defaults from generic Linux distributions.

    Same feelings here. Console based work has grown on me tremendously over the past few months. Seeing my MBA displaying this fullscreen terminal with super sharp text on deep blacks, I couldn't help but smile (with a proper framebuffer driver, that is... as opposed to what's on the picture above :D).

    Speaking of that, the only FB driver that supported the full 1440x900 was nouveaufb (instant VT switching, too). Only, it's incompatible with the proprietary nvidia X11 driver so I tried:
    • vga16fb: max = 640x480, sharpness = so-so, VT switching = fast
    • vesafb: not working, no trace in dmesg
    • uvesafb: max = 1280x800, sharpness = bad, VT switching = slow
    I would love to use the open-source driver nouveau but it adds 7Wh over the proprietary blob (!). That was with kernel v3.0.6. I'm about to experiment with the latest stable (from git, v3.1.0+), that gives control over perflvl and core, memory and shader clocks and voltage. UPDATE: just tried, no control_* for the 320M. Now trying nouveau/linux-2.6, just in case.

Share This Page