Why Is Linux Notebook Battery Life Still Poor?
Ganty writes "I recently purchased a Lenovo W500 notebook, and after 'downgrading' to XP and creating a dual partition, I found that I had a battery life of nearly three hours using the long-life battery, at this point I was a happy camper because it means that I can watch a DVD during a flight. I then tried various Linux distributions and found the battery life under FOS to be very disappointing, with an average of 45 minutes before a warning message. After settling on Ubuntu I then spent three days trying various hardware tweaks but I only managed to increase the battery life to one and a half hours. Unwanted services have been disabled, laptop mode has been enabled, the dual core CPU reduces speed when idle and the hard drive spins down when not needed. Obviously Apple with their X86 hardware and BSD based OS have got it right because the MacBooks last for hours, and a stock install of MS Windows XP gives me three hours of life. Why is battery life on notebooks so poor when using Linux? Some have suggested disabling various hardware items such as bluetooth and running the screen at half brightness but XP doesn't require me to do this and still gives a reasonable battery life."
I may sound like a jerkwad here, but why waste all that battery power watching a dvd when you could watch the divx version off local storage?
I don't know how you can expect us to fix your problems when you won't even take the time to read the documentation provided with the release.
In order to solve your problem, you need to set the RANDOMLY_DISCHARGE_BATTERY flag in the kernel source to "0" at compile time. Ubuntu, as well as other "desktop" distributions, set this flag to "1" by default for some reason, but simply installing the source packages and recompiling your kernel will fix the issue.
Honestly, a simple well-tailored Google search and a few measly days of sifting through the docs would have given you this answer without having to waste everyone else's time.
I was able to get my X41 tablet to have good battery life (a bit better than windows actually), but it took some doing. Powertop is a godsend, it pointed me to the i915 intel drivers as the culprit. Disabling DRI made a huge difference.
If you're running on an Intel platform, try running powertop. I can easily gain over an hour of battery life by disabling the services it recommends and reducing the screen brightness.
And I have plenty of anecdotal evidence that power management works really well with whatever OS the computer was intended to run, and is alright-to-crappy with any other OS.
My MacBook Pro runs decently in OSX, and drains quickly in WinXP.
My HP Compaq laptop runs really long in Vista, though its still alright in Linux. (haven't done a comparison, though... But Linux still whines when battery #1 is almost dead, even if I have battery #2 available, installed, and at 100%)
The crux of the problem is that Linux is *rarely* the "intended OS" for any of these platforms, so the hardware manufacturer never invests any effort to make sure Linux power management drivers work correctly on them.
Linux is a popular choice for netbooks, where battery life is paramount.
You mean "was", until Microsoft decided to keep Windows XP alive in the North American market for a few more years at bargain-basement prices per copy.
This really is an issue, and hardware support varies. Your notebook seems to include an ATI graphics card. That's probably your problem. Last I looked neither the open source, nor the ATI graphics drivers supported power savings on the ATI cards. I have an Asus F8Sv, which actually gets longer battery life in Linux, about 10 minutes, even though when running Linux, I have an external hard drive connected. It's got an Nvidia Geforce 8600 graphics card, with Nvidia's drivers. (Mind you, this is with OpenGL composting enabled, under Kubuntu (both 9.04 and 9.10) The other big one is Intel cards, which are supported for most of their power management features under the driver Intel helped write.
Is the kernel compiled to be tickless? http://kerneltrap.org/node/6750
kernel developers are smarter than that, and know that would be impossible to support. The real flag is PSEUDO_RANDOMLY_DISCHARGE_BATTERY.
"National Security is the chief cause of national insecurity." - Celine's First Law
We need a -1 TrollFeeder option
"A person is smart. People are dumb, panicky dangerous animals and you know it." - K
And people expect an average computer user to want to use Linux when they have to make sure their kernel is compiled right to do basic power management?
While I can't say that my Dell laptop's power management has been piss-poor under Windows (I can't really say that I used Windows on THIS particular computer that much, but I did on previous Dell models) and the power management was pretty excellent especially when the Intel speedstep software was running. If it helps, I run Fedora and Fedora and Dell laptops have been getting along fabulously for at least the past 6 or 7 version releases.
But one thing about running Windows that has always been a complaint and that's it's estimation for "time remaining." Whether looking at file transfers or remaining battery life, Microsoft ALWAYS seems to over-estimate "time remaining" or has at least reported the most optimistic figure possible. What I'm getting at is that it is QUITE possible that the Windows battery life you are reading is either untrue or unrealistically optimistic.
I know on my Dell Mini 9 running XP and watching video on battery power initially claims I have like 3 or 4 hours battery remaining, but before the two hour movie is complete, it wants to die.
The biggest source of battery drain on my netbook is CPU processing. No doubt with my other notebook, it would be hard drive usage followed closely by processor/gpu usage. This leads me to the next suggestion when using Linux -- use the graphics driver provided by nvidia or ati. They manage power better because they have the "secrets" that the GPL drivers don't have access to. Remember that a GPU is still a processor and eats power when processing.
Power management on laptops is all about paying attention to everything that draws power and being aware of it. For example, if it generates heat, it's using power... usually lots of it and cooling systems draw even more power as a consequence. Dial that speedstep down WAY low when unplugged.
XP's default file system is NTFS, and NTFS is journaled, so I don't think Linux gets an easy out there...
What do you mean? I just turned on my laptop linux and it always lasts ove
It's sadly true that almost all Linux applications / distributions have not taken writing-to-disk into account to reduce power. On the other hand, video / 2G / 3G graphics acceleration in hardware makes a huge difference, which is why I would really like to see more companies offering more in terms of stable hardware acceleration.
I've personally experienced issues with my laptop BIOS. It works properly in Windows, but a lot of the ACPI functions just flat out don't work in Linux. This is due to a compiler that lets the code compile with errors (Mainly functions that don't return a value when they should). This allows the BIOS programmers to be lazy, and write half assed power functions that don't work properly.
You can fix a lot of these issues by following the instructions in one of the links below to decompile that portion of the BIOS, and recompile it using the Intel compiler. It isn't easy, and certainly isn't something an user should ever have to do. It did fix a lot of the power issues with my HP laptop though (Running hot, not booting on battery power unless a key was pressed, hibernation).
See
http://www.osnews.com/thread?230516
http://ubuntuforums.org/showthread.php?t=1036051
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/272247?comments=all
In this instance, you can blame MS's poor compiler for Linux's poor battery life.
Because linux is fucking terrible for desktop use.
The battery life on my desktop is just fine.
Because linux is fucking terrible for desktop use.
The battery life on my desktop is just fine.
Really? Battery life on my desktop sucks. It dies as soon as I remove the power cord.
Ding Ding Ding. We have a winner folks. This is the answer. You need to have a tickless kernel otherwise the tick timer keeps the CPU from ever making it to those deep C states for any decent amount of time. In effect, the kernel keeps asking everything,"got anything for me". The CPU equivalent of "are we there yet" or "can you hear me know".
Who are you? The new #2 Who is #1? You are #617565. I am not a number, I am a free man! Muhahaha.
Well, DUH, it HAS to be perfectly optimized for the hardware.
Battery management requires checking every single pin on your hardware and ensuring that you've set the i/o correctly for sleep mode.
If you have even one pin with a pull-up resistor set as an output, then you'll get lower battery life than the nominal case. If you have just random I/O on unused pins, then you're going to get greater drain than ideal.
I'll qualify that statement by saying I'm an Electrical Engineer with embedded experience. One of the products I worked on was a GPS / VHF tracker with a 12uA standby current. Another was a VHF tracker with an 8uA standby current. Slight modifications to the firmware would bring the standby current up to 50-100 mA. That's more than 1000x more standby current.
My experience dealing with Linux developers (and realistically, software developers in general) is that they're all terrible at determining the link between hardware and software. Look at the derision you get online towards C. Linux devs are worse -- if you're not running their exact hardware on a machine you bought in the last month, then it's your problem, not theirs. "Weird, it works here. Have you tried recompiling the drivers?"
It's fairly easy to map these pins, BTW. All you have to do is set everything to an output, set it to 0, and then turn everything to an input. Everything that's high has a pullup resistor. Do the same with 1 and everything that's low has a pull-down resistor. Now you know which pins must be inputs when you're not using them.
Of course, since you taught yourself programming with Ruby on Rails, you know all this, right? It's not like you'd have to have some low-level knowledge of the hardware in order to effectively make a complete synergistic hardware and software package.~
---
ECHELON is a government program to find words like bomb, jihad, plutonium, assassinate, and anarchy.
This is just the same problem Noted in XKCD.
Good battery life is not cool. Open source software, especially a mutt like linux, is all about cool.
Good battery life requires annoyingly huge amounts of microoptimizations and chipset-dependent tricks. Which is most definatly NOT cool.
Incorrect, at least in this case.
This problem has nothing to do with whether it is cool or not to squeeze and extra hour or two out of your notebook... This problem has to do with hardware support.
Linux developers continue to have trouble getting access to the hardware they need. Hardware developers are frequently unwilling to divulge the necessary secrets for F/OSS developers to write good drivers... And those same hardware developers are frequently unwilling to devote the time/money/effort necessary to write good drivers themselves...
So you wind up with half-crippled hardware under Linux. You get video cards, motherboards, hard drives, motherboards, etc. that won't properly spin down or hibernate or sleep or whatever.
Other folks in this thread have mentioned that this particular notebook ships with an ATI video card. ATI has notoriously crappy Linux support. This is a video card we're talking about... Geeks love video cards. It doesn't get much cooler than 3D graphics - look at all the time and effort going into projects like Compiz.
I can almost guarantee that if ATI would open up their documentation you'd see better battery life just as quickly as folks could code it.
"Work is the curse of the drinking classes." -Oscar Wilde
And people expect an average computer user to want to use Linux when they have to make sure their kernel is compiled right to do basic power management?
No, you expect the average computer user to install the mobile or laptop version on a laptop, which come premade specifically with optimizations like these.
One size does NOT fit all.
- Give a man a fire and he's warm for a day, but set him on fire and he's warm for the rest of his life.
But why should the average user have to worry about tickless
after all other OSs figure out your hardware and install the right options. A distribution could worry about the user experience and take care of this automatically or, at worst, ask you if you are installing on a battery powered system.
There is utility in having one entity responsible for the ease of installation and not punting it to the varying knowledge/skill levels of the user.
If Microsoft and Apple can do it....
A quick Google search shows that the basic kernel for all versions of Ubuntu has been tickless since 7.10. /boot/config-`uname -r`
http://www.ubuntu.com/news/ubuntu-server710
I know my system (karmic) does. You can check with:
$ grep CONFIG_NO_HZ
CONFIG_NO_HZ=y
Why is it so hot? Where am I going? What am I doing in this handbasket?
Would you? Really? Cause I have been using Linux exclusively for my servers, desktops and notebooks for years and I didn't know there was a "laptop" ubuntu. Or suse. Or redhat.
Actually, I still don't know that. But I will take your word for it that something like that exists in some niche under a rock. Everything does. Linux distros are like porn on the net, if you can think of it, someone has done it. And heck, there are probably even supported ones from the three distros above maybe. Just I never heard of them because I haven't cared enough to look.
Which brings us to the odds of "the average computer user" having heard of them: Zero. Zip. None, Nil.
Plus, they have absolutely no conditioning for it, coming from either Mac or Win, where you don't need a magic special install to make your laptop work with your OS. You just do it.
So basically this isn't negating the OP's point, but instead reinforcing it. It is just another reason for people who aren't geeks to say: linux, I tried that but my battery life cut in half, so I put Win back on my machine.
7. What we cannot speak about we must pass over in silence.
I think many of the posters here, who all have great ideas and suggestions, are missing the point of the OP.
Why is an out-of-the-box XP machine performing better than an out-of-the-box Linux machine?
The Linux community shouldn't be saying "try this" or "tweak that" or "install this device driver" or "switch your hardware"... they should be working on building those into the next revs of the OS and making them part of the default configuration (or at least an easy prompt like XP offers).
-David
First, Microsoft doesn't "do it". Without specific drivers provided by the OEM, the power-save functionality doesn't work well on Win either. The fact that all OEMs provide these is simply a matter of scale, Windows is 90% of the market, after all.
Secondly, Apple controls the hardware. They can do what they like and make sure it works because it's a limited subset. You pay extra for that too.
What you're basically asking for is "why can't this free software made by volunteers be as instantly capable with any hardware on the planet as the big corporate monopoly that spends zillions on the same thing"?
Do you now see the idiocy of the question?
Hey, the fact that it works at all is the miracle here. Okay, so you might have to tweak it. Generally speaking, you don't have to, but there's always edge cases.
Also, the existence of differing distributions reflects different needs. There's stuff in any install of Windows that people often don't need. So why install it? Linux being customizable for the task at hand is a feature, not a drawback.
- Give a man a fire and he's warm for a day, but set him on fire and he's warm for the rest of his life.
The last time I installed XP on my laptop I had lost some, but not all, of the OEM-supplied driver disks, and it ended up taking me a total of about eighteen hours of solid graft to get it to work. Incidentally, I grew up on Windows, and have only really gotten into FOSS stuff in the last three or four years, and the last time I installed Ubuntu (which took about twenty minutes) it had already configured my screen to the right resolution, got the wi-fi and bluetooth working, got the frickin' bog standard ethernet adapter working, and suggested that I might want to download the right drivers for my GPU by clicking OK and typing my password.
When people say these things, I always have to wonder whether they have ever actually installed Windows. Maybe it's just me, but it takes longer for XP or Vista to simply copy the base installation to the hard drives than it does for me to set up Ubuntu, and I still have to look up which packages I need to install to listen to MP3s or watch DVDs.
Be smart, help people!
My biggest objection to using Linux (and a major reason why I tell less technical friends/family to avoid Linux) is because of posts exactly like this.
My first Linux install was Slackware (if I remember correctly)...back in 1998. That's 10 years. And for all 10 of those years, my experience with Linux has been like this...
Linux Community: 'This new version of Linux is totally great. Easy to use, great hardware support, best Linux ever. Totally better than Windows!'
Me: "Ummm, that's cool and all - but I have a problem with X"
Linux Community: "*I* don't have a problem with X! I don't even believe you have a problem. Where is your proof? It's totally not a problem with Linux, if it's even a real problem at all."
Me: "Umm...okay. Well...all I want to do is be able to X (where X was get on the internet, hear sound, use a wireless network card, have decent battery life - all of which were or are problems). Here's more information....
Linux Community: "You are using Y? Y is worthless. Everyone knows Y isn't supported in Linux because of XYZ. You either need to write your own driver or get a real Y."
Me: "Can you tell me, specifically, what Y I should buy?"
Linux Community: "*I* have ABC and it works great. But it's more than just what is on the box, it's the chipset and stuff. It's kind of hit or miss.'
Me: 'Wtf? This sucks....I'm going to run Windows'
Linux Community: 'N0ob.'
*six months later*
Linux Community: "Great news! We've totally made it so you can do X"
Me: 'Wait, last time you told me you could do X, and that it was easy, and free, and better than Windows. When I said I had problem doing X, you all told me I was crazy and to RTFM!'
Linux Community: 'Oh well....yeah...in the past, we've had some problems with X. Some users couldn't do X at all, but now we've totally fixed it! Now Linux is is totally great. Easy to use, great hardware support, best Linux ever. Totally better than Windows!''
--------
You get the idea. Months after getting flamed for complaining about how my wireless network adapter doesn't work in Linux, the Linux community raves about how they've improved wireless support.
I've had plenty of problems with Windows....but when I have a problem with Windows, at the very least, people *believe me*.