Tuesday, July 12, 2011

Linux kernel 2.38 and Ubuntu Natty: The devourer of laptops

Some of you have undoubtedly installed a Linux distribution featuring the kernel 2.38 (or a latter version). This kernel comes with Ubuntu 11.4 Natty Narwhal but also in Fedora 15 and some rolling release distributions like Arch or LMDE.

While installing a new fancy distro carries the advantage of bringing you with the latest packages including the new fool-proof desktop environments that have been recently in the spotlight (unity and gnome 3) it will also bring you to one of the most annoying bugs that I have dealt with.

All the Linux kernel versions starting with 2.38 made changes to the Active-State Power Management (ASPM) that have resulted in a dramatic power consumption increase. This might be not so evident for a desktop computer but can easily trounce the charge duration of a laptop by a third, not to mention the fact that it turns it into a portable pan.

To fix this we need to enable the pcie_aspm=force option. The downside is that this might turn some systems unstable or even prevent them from booting. Use this at your own risk.

A simple way to see if this fix will work for your recently turned into pan laptop is to enable this option for a single boot. In Ubuntu you need to select your Ubuntu system and press e in the menu that allows you to choose an operating system just after turning on your computer. This allows you to edit the boot options for this session. Locate something looking like quiet splash and add pcie_aspm=force inmediately next to it, separated by a space. If your computer boots and remains stable you will notice that it will heat considerably less and that  battery life is extended.

Now, to make this change permanent we need to edit the bootloader. Open a terminal and enter:

gksu gedit /etc/default/grub

which will ask you for privileges escalation (the password of the administrator). Then, look for this line
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

and change it to

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pcie_aspm=force"

Make sure that this is indeed how the line looks like, we don't want to screw the bootup. After that we need to update the bootloader:

sudo update-grub

And that's it, you have rescued your laptop from becoming your next broiler. Just reboot and the change must be there permanently.

0 comments: