viernes, febrero 22, 2008

Power management on linux

One of the biggest issues on linux is the power management, especially if you have laptop (that probably didn't came with linux preinstalled).

I always recommended the suspend2.net patch for the kernel, the patch now is called tuxonice, this comes with a pretty good set of scripts to interact with this (apt-cache search tuxonice), but the ugly part of this solution is that you must recompile a clean kernel, with clean i mean the kernel.org official release, because if you try to use the sources provided by your distribution you will have troubles applying the patch (offset isues) and it will be necessary that you change the source code manually, so this is a looong way, but i strong believe that the tuxonice is pretty good for strange hardware. But some days ago i recompiled the v2.6.24 kernel + tuxonice patch, it took me a few hours of cpu, and the result was a fully functional kernel, but with a very pour hard disk I/O performance:
v2.6.23-1-686:

# hdparm -t /dev/hda 
/dev/hda:
Timing buffered disk reads: 110 MB in 3.02 seconds = 36.37 MB/sec

v2.6.24tuxonice
# hdparm -t /dev/hda 
/dev/hda:
Timing buffered disk reads: 14 MB in 3.05 seconds = 4.59 MB/sec


so it became pretty useless, that make me dedicate time to make works the uswsusp way (integrated into the kernel.org and obviously present in the the debian kernel package, and probably in almost any distribution).

The simple way of do this in debian is

# apt-get install uswsusp pm-utils

with this we install the uswsusp support and associated tools, then it's necessary configure it with:
#dpkg-reconfigure uswsusp


if you use ndiswrapper for your wireless card, you need to tell to the power-management that unload the ndiswrapper module before it starts the hibernate, you can do this with the following line inside the /etc/pm/config.d/unload_modules file
SUSPEND_MODULES="ndiswrapper"


now you must test the kernel functionality with the following commands 's2disk' and 's2ram' (the first for suspend to disk and the second one for suspend to ram)

if it works, now you mus test the pm-utils with equivalent commands 'pm-hibernate' and 'pm-suspend', these tools are wrappers to the underlying kernel functions, if it worked now the last step is authorize the users to use these shiny new features, for this you just need to add the username to the powerdev group, for example if the user is foobar you must type the following command:
# adduser foobar powerdev


now you restart the session to let changes apply (maybe you will need to reboot your computer to the changes made to the kernel were refreshed) and try to use your {gnome | kde | any-other}-power-manager tool

No hay comentarios.: