Battery Life on Thinkpad x220 (i7) running Ubuntu 11.10

Estimated reading time: 3 minutes

To get the same battery life running Linux and Windows is still a challenge. Especially for ThinkPads, as Lenovo Engineers seems to magically tweak the drivers to use less power in Windows and get a fantastic battery life(Windows only). For Linux users, power usage has never been excellent out of the box and extra tuning is necessary to double the out-of-the-box battery life. I get more than 12 hours for Ubuntu 11.10 with the 9-cell battery, the power usage in Idle State is around 7.5W.

Installation of Ubuntu on my new Thinkpad x220 i7 was a no brainer, as we know it from Ubuntu and it seems that installing an OS has never been so easy and fast. Every thing seems to be working out of the box, but looking closer there are some things that needs to be tweaked. As notes to myself, I am writing about how I fixed these problems in a series of posts.

The first thing that needs to be tuned is battery life. Under Windows7 I get with pre-installed settings about 10-11 hours of runtime. The conditions were brightness set to 20% with ethernet in use. Under Ubuntu 11.10 out of the box I got around 4-5 hours, and that is quite a difference with some room to optimization.

To get started I installed powertop, a command line tool to show which part drains the battery. To install just call in command line:

user@computer:$ sudo apt-get install powertop

and then run it from command line with

user@computer:$ sudo powertop

You have 5 tabs (change with direction keys).

powertop tunables

On the overview tab you see how many Watts are being used now. My goal here is to go below 9W for light work and 7.5W for idling. Change to the tab Tunables, where you see everything that powertop thinks can be tuned (tagged with BAD). Use the direction keys to select those and with Enter-key toggle them, so they say GOOD. For me powertop was not able to scroll so you should make your terminal size to full-screen to see all available options.

On the overview tab of powertop you can observe which hard- or software parts are draining your energy. As usual the rule is turn off everything that you don’t need.

Then there has been a problem with recent Linux kernels with modern processors. For my Thinkpad x220 I added the following boot parameters to grub

pcie_aspm=force i915.i915_enable_rc6=1 i915.lvds_downclock=1 i915.i915_enable_fbc=1

Test them first by adding them on a normal boot process in grub (press e to edit boot parameters, see here). If this works for you then add them permanently to grub, by editing /etc/default/grub. (after editing you have to call update-grub once).

Finally I get idling around 7W usage and working on ethernet (wireless should be about the same) 9-10W. This gives me a battery life time of 10

Comments

  1. Robert says

    Can you please post your first lines of powertop energy consumption? I have a x220 i7 using a very recent linux and get:

    The battery reports a discharge rate of 23.4 W
    System baseline power is estimated at 2.00 W
    Power est. 	Usage 	Device name
    15.8 W 	3513 rpm 	Laptop fan
    1.89 W 	6,6% 	CPU use
    0 mW 	91,0 ops/s 	GPU
    

    The fan needs way to much energy.

  2. says

    nice share. I’ve just would like to install Ubuntu 12.10 desktop on my Thinkpad T61 but still worry about the battery life. At the moment, I’ve just using the Ubuntu Live. Thanks.

  3. Bruce says

    I just ordered an x220, and so am wondering if you have any updates on this issue? Have, for example, more recent kernel and OS updates fixed this problem, or are these sorts of tweaks still necessary?

    • says

      Sorry I didn’t have the chance to upgrade to the latest version of Ubuntu, so I cannot give any news. Here. I will try to get it updated soon. Or if somebody knows please to reply

  4. Rafi says

    A recent (3.3 or 3.4 I think) patch changed the way the kernel deals with bios’ aspm settings. With that patch, I find it works best without the force option. I have version 1.29 of the x220 (tablet) bios and aspm enabled in bios.

    Power top only seems to get the first sata link. Perhaps, I’m just being silly, but I like to set them all to min_power. If you’re not using bluetooth, you can turn that off via the thinkpad acpi proc stuff.
    > echo disable | sudo tee /proc/acpi/ibm/bluetooth
    > echo min_power | sudo tee /sys/class/scsi_host/host*/link*

    Also, I find that when I want really long battery life I am not doing things that will benefit from occasional jumps in cpu speed (or don’t care about a little latency). So I use the powersave governor instead of ondemand.
    > echo powersave | sudo tee /sys/devices/system/cpu/*/*/scaling_governor

    I think screen brightness (from min to max) accounts for about 1 watt, with the largest differences being in the brightest few settings.

    All in all, I’ve seen powertop report as little as 5.6 watts. Mostly, it idles at 6-7 watts. Fwiw, this is an i7 with 8G of ram, two SSDs, and no wimax/celluar radios.

    It does seem to consume more power than I’d expect when suspended. I haven’t really looked into that yet, but I suspect usb charging port and finger print reader might be at least partially responsible. Suspend and the normal battery life work well enough for me that I almost never use hibernate (it does work well). Also my boot time is down to ~15-20 seconds (mostly bios, the os boots in ~6 seconds), so hibernate would only be interesting for keeping a persistent session over days without charging, or when I run down the battery before I realise I’m going to actually need a little more juice for later.

    I’m looking forward to seeing what the x230 can do.

    • Rafi says

      On a side note, I haven’t touched the i915 settings yet. It looks like rc6 is enabled by default, but not the deeper modes. Downclock and fbc are not enabled.

      I wonder if those will be enough to get me down to 5 watts :)

  5. Marcus says

    Ubuntu 12.04 that is coming out in a few days is said to deal with the bad battery performance in the previous Ubuntu releases. Would be great with a new blog post with a review how well they done about that =)

    I thinking about buying a X220 so I would appreciate a battery performance review very much ;)

  6. Mikey says

    Looks like in 3.4 kernel there will be some more options for i915_enable_rc6:
    From: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=83b7f9ac9126f0532ca34c14e4f0582c565c6b0d

    “Enable power-saving render C-state 6. ”
    “Different stages can be selected via bitmask values ”
    “(0 = disable; 1 = enable rc6; 2 = enable deep rc6; 4 = enable deepest rc6). ”
    “For example, 3 would enable rc6 and deep rc6, and 7 would enable everything. ”
    “default: -1 (use per-chip default)”);

    Reading the check-in comment, we should probably avoid 7 and only set to 3.

  7. Frederik says

    These hints are really useful regarding power usage. Thank you.
    BUT: My laptop freezes once in a while using them. Not too often but about every 48 hours at least.
    This is annoying enough not to go with your kernel parameters.

    Anyone else experiencing this?
    Old syslog and dmesg files give no useful clue.

  8. sbnwl says

    I got one more thing to manage power consumption.
    Thanks to https://wiki.ubuntu.com/Bumblebee

    For my ASUS K53SV netbook, (NVIDIA GT540M) it is a great power saving too. With default Ubuntu 11.10 installation, my power consumption was nearly 30 W. I managed to cut it down to 22 W with some kernel options before boot using this (http://www.phoronix.com/scan.php?pag…15_power&num=1)

    But Still the battery was lasting only for 2hr and 50 minutes at 20% screen brightness.

    I installed today Bumblebee 3.0, (had never tried it in past, nor did for Ironhide). After installation and reboot it came to 12W consumption. Battery is now reading 4 hr and 40 minutes, and mind that the display brightness is at 50%.

    ONLY Bumblebee has managed to calm down my discrete NVIDIA card, which was by default always ON in my default Ubuntu 11.10 installation, and was consuming alone 10 W of power, cutting my battery down by 2 hours.

  9. raphael says

    On my X220 with i5 i have less than 4 hours use and consume 14W when idling, with brightness to 40% and the MJG ASPM Bug fix and Kernel 3.1 installed. How did you get to 7W?
    That would be so great! Also Fan is always on, a bugger!

  10. Mitchell says

    I have an x220 i7. I have noticed that while I can get around 10 hours of usage, I cannot store the computer in booted state with the screen closed for a day or two. I guess this is hibernation.

    It always drains the battery before 24 hours are up.

    However on a 2004 ibook running debian with standard install which must include some battery conservation optimization for the ibook done by, it is pretty conservative in usage of the battery and it can stay for days in hibernation and then starts up fine.

    what do i need to do to make the x220 hibernate better so i can pick it up and then close it and pick it up the next day or two later and run with it?

    Also what is necessary to store the bad->good transition with powertop so that after sleep or hibernate it comes back up with the same settings.

    • says

      Hi Mitchell,

      my x220 stays in suspend mode for 1-2 weeks without any problem. When closing the lid, does on the outside the moon light show up? (or does the power button pulse?

      Maybe your computer is not going into suspend mode when closing the lid?

      To make the settings from powertop always turn to good on battery, you would need to create a script performing those actions when on Battery power. (However are you sure you always want those settings. They often include USB power modes so that some usb devices are not functioning under the power saving mode)

      • Mitchell says

        I still have not determined what to set. I am a little naive in the powersaving configuration issues. I guess I am lucky that my old ibook g4 running debian just comes with amazing power settings in some internal script package that automatically sets up the hibernation/sleepings in a nice draconian way :). I can walk away for 24 hours and get only minimal power drop, while the x220 loses 40% of the power overnight (acpi -b run before and after), while the cover is closed.
        If you could share your scripts and we can make them generally available I would be very very grateful!
        Thanks again.

        • Mark says

          it is the difference between hibernate and suspend. Hibernate wrights a save state file, and then shuts down. My friend has a notepad that does the same. even tho u tell it to hibernate, it only suspends.
          If in hibernate u can power back up after years if u chose. :)

  11. NightOwl says

    Farrukh,

    HP laptops have a knack for overheating, be Elites or Pavilions. Their heat sinks could be more efficient at transfering heat and exhaust fan assemblies [much] better designed. Hate to tell you, one of the solutions for you is to have the innards of your Elite, heat sink/exhaust fan layout cleaned up/updated. If you are brave enough, there are a couple of websites offering plenty of guidance on how to go about it – yes, I did it so I can tell you it is not that difficult. It does take quite some time, though. Or, you can have it professionally cleaned! The issue with diy is that a few fixes can be incorporated like adding some additional heat-dissipating plates – I purchased 1/2″ copper couplings, splitted and flattened them and cut to size – using better thermoconducting paste and poking 1/16th ~ 3/16th inch holes for additional air flow following a thorough claening. Did I mention plenty of patience?! Word of extra advice: when drilling/melting out the holes, do so on the stripped out bottom carcass and work from the outside in.

    That said, I’ve been scouring the internet for good advice on tweaks here and there to have my laptops run as cool and, squeeze as much battery time, as possible. The end result has been quite notable: the running temperatures on them went down at least 15 degrees C with the corresponding idling down of the fan and almost doubling battery life!

    Give it a try! Best of lucks!

  12. sbnwl says

    Sorry, I made a mistake.’
    It is still at 22 W even powertop is being invoked to do ‘Good’, toggling ‘Bad’.

  13. sbnwl says

    This works a lot!

    1. Power consumption with fresh install of Ubuntu 11.10 (Installed Gnome 3 instead of Unity) on Brand new ASUS K53S series laptop with core i7 2670QM,2.2 GHz , NVIDIA GT540M was at 35 W.
    The 6 cell battery drained to 0% within 1 hr and 30 minutes. (I set the screen brightness to 20%).

    2. Now after adding the following kernel boot arguments to the file /etc/default/grub, the power consumption comes down to 22 W.
    (GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash pcie_aspm=force acpi_osi=Linux acpi_backlight=vendor i915.lvds_downclock=1 i915.i915_enable_fbc=1 i915.i915_enable_rc6=1″)

    3. Installing and using the ‘powertop’ utility in the manner (Tune ‘Bad’ things to ‘Good’ by toggling by hitting Enter key) mentioned above still cuts the power consumption down to 12.6 W.

    What a charm!
    Linux kernel >3.2 will perhaps handle those issues automatically, hope so.

  14. Elliot says

    Hi and thanks for the info, just got a x220 myself. However I’m a little confused as to what you achieved.

    First you say you get “more than 12 hours for Ubuntu 11.10 with the 9-cell battery”. And “Under Windows7 I get with pre-installed settings about 10-11 hours of runtime”. Is that using the 9-cell as well? So you save more power in linux?

    Then “Finally (…) this gives me a battery life time of 10″. Is that 10 hours in Linux? Using a 6-cell or is it a deviation from the first report in the 9-cell?

    Lol just want to know what I can achieve with linux, given a bad rep for power savings :).

    • says

      12 hours is what I can get if i turn on every powersaving available, using no network connection, dimming display, and closing all applications.

      Real working conditions gives me 10 hours of battery life. This means battery life is almost the same for Linux and Windows. (But I never could get 12 hours estimation under windows 7, even though I tried real hard)

      I am sorry that my post is a little confusing :) But hope this clarifies the situation.

  15. Peter Kolloch says

    Thanks a lot. The kernel parameters made a huge difference on my x220 with an i5 CPU.

    I would love to make the powertop tunables permanent without having to search through module parameters or sysfs tunables.

  16. says

    It’s a shame there’s still so many problems, a while ago I had enough and just started using Debian in a virtual machine – that way you get all the benefits of proper hardware support..it’s a bit weird but it works damn it.

  17. Farrukh says

    I am really struggling with battery issues on my HP ProBook 4530s (i7).. The battery life that it shows is only about an hour and the PC heats up like hell, I don’t know how to fix this, trying your solution may help, but let’s see because I don’t want to run any risk for data loss, as I have many important files in there

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre user="" computer="" escaped="">