LMT (“Laptop Mode Tools”) is a set of tools that are designed to enhance battery life in GNU/Linux. It’s actually sort of a front-end as most of those tools are embedded into the Kernel and LMT lets you tweak them with ease. But for various reasons, most GNU/Linux distributions don’t enable some of them by default. This is also the case with Ubuntu (including the latest 11.10 version) as well.
Although according to the LMT’s man page, it primarily relies on another tool called “hdparm” (advanced tool that has the ability to spin down your HDD drives thus saving power consumption). However, LMT uses a lot of other built in tools to apply power saving settings to various hardware devices such as the CPU, Wi-Fi (plus Bluetooth) adapters, HDD, Ethernet cards, USB, DPMS (a display related power saving feature) for reducing power usage.
But, since “fine tuning” these tool manually is really a hectic task, all you gotta do is to install “LMT” and it’ll take care of the rest for you by automatically applying those settings!.
Does it really work?
Heck ya it does! ;-). As you can see from the below 2 screenshots, the first one is my Vostro V131′s power consumption without LMT installed (marked in Red) and the next one is after installing LMT (marked in Blue).
In both occasions, I rebooted the notebook and after login into the desktop, didn’t run any apps (for letting the notebook to come into an idle state) and fired up “powerstat” right away to measure the power consumption and it managed to save me about 2-4 Watts which is pretty impressive!. (And I didn’t manually change any of LMT’s settings either).
I did test it few times and although the numbers could’ve changed here and there, but in general, LMT did improve the power consumption (lowered it :D).
Main features …
*. As said above, it works with your HDD (especially with SATA drives and their advanced power management features), CPU, wireless network adapters, Ethernet cards, sound cards (On-board AC97), USB and other hardware devices to help you enhance the battery life.
*. For most users, it’s better to leave the default settings untouched. However, if you know what you’re doing, then you can manually change settings of LMT with ease by editing its default configuration file (more below).
*. You can also change settings of individual hardware devices such as manually tweaking the CPU based power saving features, Intel HD audio based settings, HDD power saving parameters, adjusting display brightness settings etc from their individual configuration files (again, more below) as well.
You can install “laptop-mode-tools” in Ubuntu 12.04 Precise Pangolin, 11.10 Oneiric Ocelot, 11.04 Natty Narwhal, 10.10 and 10.04 by using the below command in your Terminal window.
sudo apt-get install laptop-mode-tools
Now for changes to take effect, reboot the computer. From now on, “laptop-mode-tools” will automatically start optimizing the power consumption of your Computer. That’s it!.
Optional Tweaks …
Why is it disabled by default ?, are there any drawbacks after enabling it?
Although I cannot be certain why it’s disabled by default. Perhaps it’s because under some hardware LMT might make your system a bit unstable. However it ran quite fine in my Vostro V131, but if you’re having issues after installing it, then please use the below command to remove it, which should solve those issues.
sudo apt-get autoremove laptop-mode-tools
Tweaking the settings …
Note: As mentioned in the beginning, once installed, LMT adjusts the settings automatically thus the user don’t have to do any manual tweaking. However, if you’re a bit of a power user then you can adjust its settings.
But please be very careful while adjusting settings related to HDD (“hdparm” utility) for instance, because if you enable some of the “risky features” (disabled by default), you might end up losing your data. But you can experiment with adjusting settings like the “readahead” settings of your HDD and few other ones, again if you know what you’re doing.
As a safety precaution, enter the below command to backup the LMT’s configuration folder.
cp -r /etc/laptop-mode /home/gayan
Replace “/home/gayan” with your preferred location.
To restore the folder later (if you’ve successfully managed to corrupt it ;-)), use the below command.
sudo cp -r /home/gayan/laptop-mode /etc
Again, replace “/home/gayan” with your location of the backup folder.
To edit the main configuration file, open your Terminal and enter the below command.
sudo gedit /etc/laptop-mode/laptop-mode.conf
This should open it in the Gedit text editor as shown below. Before each command, there’s a simple (but well explained) description. So please read that text before changing the configuration settings.
And after making a change, make sure to click on the “Save” button to save them permanently as well.
For instance, if you want to temporarily disabled LMT (without unistalling it), then scroll down a bit until you see a text field as shown below (you can also copy the below text and search in Gedit, to easily locate it as well).
As you can see from the below screenshot, it’s enabled by default (obviously).
If you want to disable LMT temporarily, then replace “1″ with “0″ and reboot your PC. That should do it. Anytime you want to enable a feature, use the value “1″ and to disable a setting, use the value “0″.
Enabling it even when running using AC power …
Although it doesn’t make a whole lot of sense to enable aggressive power saving features while on AC power (thus slowing down your PC’s performance), but if you want, you can forcefully enable LMT even when your Laptop/Notebook is running on AC power (disabled by default).
To do that, make sure you’ve opened the configuration file and search for the below text.
Now remove the value “0″ and replace it with “1″. That should do it.
Adjusting Hard Disk Drive related settings (again, for most, it’s better to leave these settings alone)…
*. Changing the “readahead” settings.
What the heck is “readahead”?
MS Windows calls it “prefetching” & GNU/Linux calls it “readahead”. Although there could be many technical differences. But they both accomplish the same task of making your urns OS faster by loading the frequently accessed programs and other data into the RAM.
This is a much better way to do it rather than always storing those data in the HDD, which is a hell lot slowish plus makes your PC consume more energy as the HDD has to find files, read them … using its mechanical “head” etc (lot of disk activity in other words).
For example, let’s assume that I was playing a video file with 600MB of size which is about 60 minutes long. Now since loading a 600MB file into your RAM is not practical plus you don’t really need the whole video data at first (unless you’ve figure out a way to watch a movie within few seconds ;-)).
So a better implementation would be to split up the 600MB file into smaller ones (say 30MB ones) and load each one when necessary.
So after loading the first 30MB file (assuming it holds 3 minutes of video content), if there isn’t anything else to do, the HDD can then slow down a bit (until you watch it), then few seconds before the first 3 minutes of video data is about to end, it can re-spin the disk and load the second 30MB file and spin down the disk back again … which helps a lot while preserving energy. As you can see, the disk always reads data slightly ahead of the required amount, and perhaps that’s why it’s called “read-ahead” (not sure about that one though).
Now this is just an example of the process and the actual disk caching (readahead) values are configured by the OS for optimal performance and power saving. However, LMT lets us manually change the “readahead” values too.
The values are in Kilobytes and please don’t add huge readahead values, but if you want to experiment a bit, then you can do so by searching for the below term (or scroll down through the configuration settings file) in Gedit.
And replace the default value of 3072 (in Kilobytes, about 3MB) with your preferred value (make sure to save the changes).
If you want to completely disable LMT trying to manipulate the “readahead”, then again search for the below term and replace the default value of “1″ with “0″ and save.
HDD idle timeout settings …
A HDD idle timeout is the waiting seconds before the HDD goes into a low power mode (due to HDD inactivity). For example, a HDD idle timeout value of “20 seconds” means that, after 20 seconds of non HDD activity, the HDD will be slowed down in order to preserve power consumption
It’s better to leave these settings alone. However, if you want to, you can change those settings as well. Again, search for the below text first.
Then replace the default value (20) with your experimental ones (eh! ;-)).
If you scroll down below, you’ll see a lot of some other experimental feature such as HDD write-cache (disabled by default, don’t enable it unless you know what you’re doing as it can sometimes result in data loss!) etc as well.
As you can see, the default configuration file mostly consists of HDD based power saving features more than anything. But if interested, you can change CPU, Display, AC 97 Audio, USB devices etc and their individual settings too. For that please go to the below location in Nautilus and double click on the each file to edit (while editing, you’ll need “sudo” privileges).
Anyhow, since the article is awfully long, I’ll stop here.
But as an ending note, please don’t expect it to do “miracles”, but as said before, after installing it and without doing any manual tweaking, LMT was able to save me about 2-4Watts which is a pretty decent value concerning the general power consumption of a typical Laptop/Notebook!. So if you want to try to enhance the battery life in Ubuntu (or GNU/Linux in general), then LMT is a tool that’s worth trying.
If anything happens, use the backup file to restore the original settings OR, you can completely remove it from your system. And just in case, please use it with our own risk ;-), good luck.