Slashdot Mirror


Getting Better Battery Life w/ Linux?

Nuclear Elephant asks: "After a little hacking, Linux has been running great on my Thinkpad T30 for about a year now. I can talk to my cellphone and bluetooth devices, do all kinds of neat hacking on wireless, and just about everything you'd expect to be able to do from a Windows machine, except make the battery last. Even after the standard optimizations (like cpufreq, laptop_mode, brightness, turning off useless processes, etc.) my battery still only lasts about an hour running under Linux as opposed to 2 1/2 hours in Windows. Has anybody come up with some innovative battery conservation ideas for Linux? It seems to be the only thing lacking in this fine operating system." What kernel options might one look into, for saving laptop battery power? Also, what desktop settings (both for Gnome and KDE) would work best, for this situation?

33 of 69 comments (clear)

  1. Answered your own question. by yotaku · · Score: 5, Insightful

    "and just about everything you'd expect to be able to do from a Windows machine, except make the battery last."

    Sounds like you basically answered your own question. Use the best tool for the job. If windows allows you to do all that AND make the battery last - then maybe you should just use windows.

    1. Re:Answered your own question. by Skeezix · · Score: 2, Insightful
      Sounds like you basically answered your own question. Use the best tool for the job. If windows allows you to do all that AND make the battery last - then maybe you should just use windows.

      He didn't say that Windows lets you do everything Linux can, he said Linux on his laptop can do just about everything Windows can. Linux can also do things Windows can't. :) And really you're missing the point. Many of us have no desire to run Windows or any proprietary operating system. So we want to get the most of our laptop batteries.

    2. Re:Answered your own question. by RzUpAnmsCwrds · · Score: 4, Insightful

      I always hate this.

      Someone asks, "how can I make my > work better"? Someone replys "get a >". Unless the situation is extreme ("how can I make linux run better on my 286?"), the original poster doesn't *want* information on other products. If they had, they would have asked "what notebook should I get?".

      Macs may be great little UNIX boxes. I personally have a $300 Armada M300 off of eBay. It is 3.2lbs and very small, PIII 600, 384MB SDRAM, ATI GPU (slow 3D, but fine for 2D), 13GB HDD. It runs about 2 1/2 hours (under Windows). Linux is considerably shorter, perhaps because SpeedStep (that throttles down your CPU voltage and clock) isn't working.

      Some people said to turn off graphical effects. This may help, but, in reality, they probably don't make a whole lot of difference.

      Here are some tips:
      - Get your CPU's clock throttling enabled. I believe that "longrun" can do this. Particularly on AMD CPUs (also on Pentium-M) you can choose 4 different clocks. AMD CPUs can also dynamically adjust their clock based on CPU load (they call it "PowerNow!").
      - Decrease your screen brightness. This is a biggie. The backlight sucks a lot of power.
      - Disconnect any optical drives (you probably don't have them connected very often anyway)
      - Set your HDD spin-down options
      - Suspend your computer when you aren't using it
      - Charge your computer whenever you can (the less you drain Li-Ion batteries, the longer they last - there is no "memory effect", so *don't* drain them fully)
      - Get a new battery or replace the cells in your battery. Many batteries use 18650 cells which can be purchased on eBay for around ~$30 for 8.

    3. Re:Answered your own question. by trouser · · Score: 2, Informative

      How would buying a Mac improve the battery life on his Thinkpad? You are a crazy person.

      Incidentally I have an iBook and I get great battery life under Linux (YDL 3.01). Pretty much the same battery life as I used to get under OS X.

      --
      Now wash your hands.
    4. Re:Answered your own question. by The+Bungi · · Score: 2, Insightful
      You will deserve your troll moderations for this false assertion. Everybody knows MacOS is not free to download like a GNU/Linux system, nor is the code available for modification. Just because it doesn't matter to you, doesn't mean it doesn't matter to everyone.

      Well now. Aren't you the miguided zealot. Let's see if I can help you. "Unix" is a class of OS you can buy from SCO, Hewlett-Packard, IBM and even Sun. Linux is an OS that's based on Unix, but it is not Unix. Otherwise the SCO FUD has some basis, mmm? Also, do you remember what "GNU" means?

      The OP compared OS X to Unix. He's right - OS X is derived from the *BSD line, which is in turn also based on Unix, much like Linux is. Do I really have to go through this? Anyway, the fact that you pay for it or that you don't get the source code has no relevance. Indeed, maybe OS X is what Linux wants to be when it grows up.

      But ultimately it is certainly valid to compare Linux and OS X because they're both descendants from the same original Unix.

      I'm sure that it matters to you that you can't "download" OS X or get the code, but from a technical and historical standpoint it's a perfectly valid comparison. Whether that clashes with your "free-as-in-whatever" world view is another matter.

      So next time you plan on calling someone a "troll" think twice before you post. You might end up looking, well, slightly stupid.

    5. Re:Answered your own question. by phorm · · Score: 2, Interesting

      Charge your computer whenever you can (the less you drain Li-Ion batteries, the longer they last - there is no "memory effect", so *don't* drain them fully)

      I'm not sure if it applies to Li+ - I believe it dos - but many rechargable batteries are cycle-limited. That means that the more often you flip them to charge-mode, battery-mode, charge-mode.. the faster you run out of cycles. Eventually, they just don't charge anymore.

      If my previous laptop battery is an example of this, it was charging just fine until one day it just stopped charging/draining at all above about 1-6%

  2. Use less power by redog · · Score: 3, Informative

    If you use and unload kernel modules, wireless NIC, sound card, hotplug, usb etc etc... your laptop should consume a bit less power, also look to see if your laptop supports processor frequency scaleing

  3. the usual... by ajagci · · Score: 3, Informative

    Have the harddisk spin down (e.g., hdparm, noflushd), dim the screen, lower the processor speed (e.g., longrun). In general, it shouldn't take a lot of effort to get similar battery life using Windows and Linux.

    If you buy your machine from a vendor that supports and pre-installs Linux (e.g., emperorlinux.com), they probably will take care of the necessary configuration for you.

    1. Re:the usual... by kevin+lyda · · Score: 2, Informative

      noatime for your fs options would be good too.

      --
      US Citizen living abroad? Register to vote!
    2. Re:the usual... by jovlinger · · Score: 2, Interesting

      perhaps build a root ramdisk with the most commonly used apps? Then you could spin down and unmount your hd partitions. 'course you would lose your data if you unexpectedly kill the laptop.

      It may be the winmodem, or some other win-peripheral (sp?). IIRC, these load the batter a bit, and if they default to on, that would be a problem.

  4. Smller WM by camelrider · · Score: 3, Interesting

    A WindowManager that uses less cup and graphics horsepower may help with your battery life. IceWM is available in many distros and you can run Gnome or KDE from within IceWM when you need to.

  5. Throttling Down? by ABaumann · · Score: 2, Interesting

    Well, your windows machine is probably throttling down the processor when you're unplugged. It's possible that your linux machine doesn't do that.

  6. tpctl for thinkpads by doja · · Score: 5, Informative

    Since you have a Thinkpad, you should download and install tpctl. It comes with a daemon called apmiser that controls power use according to CPU usage.

    1. Re:tpctl for thinkpads by aparrish · · Score: 3, Informative

      Apmiser works really well on my X24. I usually get between three and four hours on a charge, as long as I don't "emerge" and compile any huge Gentoo source packages while it's unplugged.

  7. Graphics card by ballwall · · Score: 3, Interesting

    I've got a T40, probably the same graphics card as the poster (Mobility Radeon 7500) and I can't figure out how to enable the power saving features under Linux. I know when I'm in windows power saving the vid card gives me a huge longetivity boost life.

    Anyone know how to do that with Linux?

    1. Re:Graphics card by PD · · Score: 3, Informative

      Those features are probably not supported. There are people working on them, but at best you'll have to compile your own copy of XFree86. I only know this because I spent a couple hours yesterday getting DRI to work on my T30. I read a lot of docs.

  8. Turn Off Eye Candy by jmt9581 · · Score: 2, Informative
    Definitely try turning off as much eye candy as possible with your WM, whether it's GNOME, KDE, or ratpoison.

    :)

    Visual and audio effects mean processing time, and CPU time uses battery power. Also look into unloading modules that you aren't using, especially wireless network-related modules.

    Alternatively, you could go the way of many /dotters and get a Mac. I'm a Unix geek who just got a used IBook and I love it.

    --

    My blog

    1. Re:Turn Off Eye Candy by ArmorFiend · · Score: 2, Informative

      Visual and audio effects mean processing time, and CPU time uses battery power.

      This is not always correct, it depends on what eye candy operations are implemented efficiently on your hardware. For example, suppose you turn on the nvidia cursor shadow extension. Does it take extra power? No, because the nvidia gpu trivially can compute it in hardware for 1/zillionth of a watt. Now suppose someone does write a non-nvidia X extension that emulates this inelegantly by doing lots of screen blits and software alpha blending: now you're talking power drain. I think another example is apple's eye candy transparent windows and whatnot. Since they're in dedicated hardware, I think they're not a major load.

  9. I know it's not Linux specific but... by Will2k_is_here · · Score: 3, Informative

    Don't forget to decrease the brightness and contrast of your display. I found this can add an extra half an hour or so to your battery life.

    And, as was hinted at by others, take off anything that will cause your processor to do more work than you need. This means removing big GUI's, and use basic software (like anything but Gnome and KDE, Firefox instead of Mozilla Suite, Mutt instead of Evolution, etc.)

  10. thinkpad utils by tellurian · · Score: 5, Informative
    Go get these from Dag's site:
    • kernel-module-thinkpad
    • tpctl
    • configure-thinkpad
  11. HD sleep by trouser · · Score: 2, Informative

    Windows and Mac OS X will stop the HD after a period of inactivity. I've never got this working in Linux. The drive sleeps briefly before spinning up again. Maybe writing log messages or accessing the swap partition. Don't know. Anyway, that's probably a small part of the problem.

    --
    Now wash your hands.
    1. Re:HD sleep by jthj · · Score: 4, Informative

      You could use a loger like metalog which caches writes to reduce the amount of hard drive use. Also setting the noatime option in fstab will reduce writes to do the disk when you are browsing directories. This will not help the fact that the drives always spinning though. To avoid that you would pretty much need to turn of logging which may not be a good idea. Anyway that's just my .02

  12. Read the Mini-Howto -- Esp Syslog section by Snerdley · · Score: 5, Informative

    There is the "Battery Powered Mini-HOWTO" up on the Linux Documentation Project site: http://www.tldp.org/HOWTO/Battery-Powered/index.ht ml

    Of course, you probably looked there first before you asked Slashdot :)

    Seriously, read the section on syslogd(8). In addition to their suggestions, we have also setup a central log server which allows logging to only go over the network, and not to the local disk at all.

    If you are in a LAN (or wireless) environment, you might want to consider that although the wireless might cost you more powering the NIC than it would hitting the disk (after you disabled syncing).

    1. Re:Read the Mini-Howto -- Esp Syslog section by bergeron76 · · Score: 2, Interesting

      Why not kill syslogd entirely? If you don't need it running, kill it. It's not a server, and unless you're experiencing failure of some sort; or some other loss of functionality why run syslogd on a notebook/portable. If nothing else, set your console to be /dev/ttyS0 and set your syslogd/klogd to output to the serial port. At least this way you could debug your machine if it started acting funny.

      I recommend reading up on some of the tricks that embedded people (like me) use. There are a ton of ways to save power and drive-time.

      I've never seen it (in a laptop; but I have it in my car) - it's not hard to replace a hard disk with a CFcard. Use the 2.5" hard disk for media/games/etc... but use a 512 or 1G cfcard for the OS/system. As such you can save a ton of energy by not having drive motors spinning up/down, etc.

      --
      Don't think that a small group of dedicated individuals can't change the world. It's the only thing that ever has.
  13. pcmcia by nri · · Score: 3, Interesting

    service pcmcia stop
    service lpd stop
    hdparm -E 4 /dev/dvd
    hdparm -S 12 /dev/hdaX

    --
    if :w! doesn't work, try :!cvs commit -m""
  14. Tweak your applications by vitroth · · Score: 2, Interesting

    Remember that most applications have no awareness of your desire to conserve battery life. In particular, disabling your web browser's disk cache will prevent your disk from spinning up and staying that way when you web surf. Think about what applications you're using, and how you can modify their behavior.

  15. ACPI by Fluffy+the+Cat · · Score: 4, Informative

    One of the single best things you can do is enable ACPI support, which enables higher levels of CPU power saving when idle. This gives me about half an hour of extra battery power, but suspend support is still somewhat flaky.

  16. Lindows for Laptops by Anonymous Coward · · Score: 2, Informative

    For no-brain hassle of running Linux on a notebook computer, why not try a distro that's designed specifically for mobile computers?

    Such as Lindows for Laptops.

    It has built-in power management features and can even be bought pre-installed on a number of machines.

    Disclaimer: I don't work for Lindows, I run Windows and I don't even have a notebook computer. But this is the one commercial mobile Linux solution that I've heard of.

  17. Inverse results by consolidatedbord · · Score: 3, Interesting

    I currently run Linux on my Dell Inspiron 8200 and get about 1 hour more battery runtime than in Windows XP or 2000. Stock, with OEM Windows XP I would peak at about 2.5 hours of battery time, as opposed to peak of 3 hours running Linux. I have since used the i8k-tools (obviously not for Thinkpad) to control things like temperature thresholds to trigger the fans. Not sure about your laptop, but mine has 2 fans, so spinning those down if possible saves a lot of battery time. With the fans running at about 5k RPM as opposed to 9K RPM (full speed) I easily save 45 minutes, making my top peak with Linux damn near 4 hours. Your best bet to save battery life would have to be to find some thinkpad-specific software to slow the fans down and speed up at given temperatures. (not sure if that tpctl can do that or not)

    --
    while true ; do echo this is my sig; done
  18. buy more ram by Anonymous Coward · · Score: 2, Interesting

    Hard drive usage eats battery faster than your CPU by far. Max out your RAM and use something like noflushd to minimize the number of times your hard drive has to spin up. Those are the easiest ways to increase battery life.

  19. APCI or APM? by ErisCalmsme · · Score: 2, Informative

    You might want to be sure that you have the right power mangament features enabled in your kernel. I had to enable all of the the APCI features myself. You can use dmesg|less to see if your kernel is actually finding the power management feautures that you enabled. But maybe you knew that;) In any event you would see stuff like this:
    ACPI: Battery Slot [BAT0] (battery present)
    ACPI: Battery Slot [BAT1] (battery absent)
    ACPI: Lid Switch [LID]
    ACPI: Power Button (CM) [PBTN]
    ACPI: Sleep Button (CM) [SBTN]
    ACPI: Processor [CPU0] (supports C1 C2 C3, 8 throttling states)

    Alas, my laptop is plugged in 90% of the time and I havent used windows on it for more than the time it took to make a debian cd (which I used to build LFS) so I never had time to notice the difference ;)

    Good luck!

    --
    Chaos is Divine *
  20. Fans are not likely the issue by Andy+Dodd · · Score: 4, Informative

    Given that the default fan thresholds of the 8200 are VERY aggressive w.r.t. power management (i.e. they run the CPU *damn hot* and you should NOT be slowing down the fans compared to the BIOS defaults), I don't think this is the reason for your long battery life with the 8200.

    But I can confirm that my battery life with my I8200 is comparable to, if not better than, under Windows.

    Power management features I use:

    cpufreq (Both speedstep-ich and p4-clockmod as modules - Load speedstep-ich, set the "powersave" governor to step down the voltage/speed, then load p4-clockmod to drop the clock speed even more. I've been running my P4-M 1.7 at 600 MHz lately, it's more than responsive enough for AIM and web browsing.)

    nvclock (Does not support mobile chipsets out of the box, but I disabled the code that causes nvclock to not touch mobile chipsets and it works fine on my GeForce 4 Go 440. I'm assuming the devs of nvclock disabled this because it's an overclocking tool and overclocking mobile GPUs is a bad idea, they forgot that mobile users might actually want to UNDERCLOCK their GPUs...)

    Get LOTS of memory. Enough to allow you to disable swap. If you have swap enabled, it seems that even with an idle machine, it'll page stuff in/out just enough to FUBAR any attempts to make the HD sleep.

    --
    retrorocket.o not found, launch anyway?
  21. Power Management Under Linux by darkmeridian · · Score: 2, Informative

    I have linux and ACPI seems to work pretty well. The largest things are:

    1. The screen. Blank it if possible (edit XF86Config-4) and use the darkest setting you can see with. Redundant, I know. But pay attention and actually do it.
    2. The wireless. The radio sucks up a lot of power. If you are not using the web, turn off the card. (You can use the tx setting for your card to put it into a sleep state.)
    3. The hard drive. Use hdparm to shut it down if no one is using it.
    4. Suspend. Doesn't work on the Latitude D800 yet in KDE. But quit KDE (set session manager to save your settings) and then suspend/hibernate.
    5. Enable Throttle. You have to enable this in the BIOS as well as the kernel. Don't forget to enable the modules you need for your particular laptop and chip/chipset.
    6. Enable auto-throttle. Throttling by itself is useless because you won't do it manually. You have to automate it. Download and compile auto-throttle and start it up on boot. The Pentium-M has eight modes, I believe, and autothrottle moves it up and down really nicely. No lag at all. It must have something to do with the pre-emptible kernel in 2.6.3.
    7. Don't blast music. This takes up a surprising amount of power.
    8. In windows, don't set stuff like anti-viruses and disk defragmenters to automatically start. This isn't really good for your battery life if it starts up.
    9. Don't compile programs while on battery. (Duh, right? Stupid me.)

    I get 3:15 hours of battery life on a D800 with the screen on the brightest setting and the internet. Under Linux! Battery life isn't just for windows, you know? Just word processing and web browsing. Cool, huh?

    --
    A NYC lawyer blogs. http://www.chuangblog.com/