Make your Linux netbook battery last longer

The Moblin distribution has been designed by Intel to give excellent netbook performance, but there's still room for improvement

All laptop users have something in common: we want our device's batteries to last longer. Whether it's for the daily commute or a long flight, an extra 30 minutes of power means an extra 30 minutes of entertainment.

If you're running a Linux-based distribution on your netbook, there's a lot you can do to squeeze every last negatively charged ion from your power source. Here we're going to cover the best techniques that we've discovered.

Don't worry if you're not a netbook user, as much of this information can be used on Linux laptops too. However, we've specifically tailored our advice for netbooks as these seldom include full-blown distros (and hence any easy way of compiling and installing new software).

We're going to focus on Intel's Moblin and Canonical's UNR (Ubuntu Netbook Remix), two of the most popular Linux distributions for netbooks, but there's absolutely no reason why you can't use a full-fat distribution on your device and make the same changes to its power management.

Netbook Linux is still in its infancy. This means that there's still a great deal that can be done to make these devices more power efficient, and each release of distributions like Moblin or UNR gets better at it. But it also means that hardware compatibility and power saving is experimental for each distribution, especially when you've installed it yourself.

Until netbook distributions are built for specific netbooks, though, there's always something you can change in a generic installation to make it work better on your own machine. We're not talking about massive improvements, but each incremental change may stretch your battery life by around five per cent.

Even if just one or two of them work out, you'll see some extra life from your machine. Like most things to do with Linux, it just takes a little trial and error.

1. The easy targets

Sometimes it's the most predictable power saving options that can reap the biggest benefits. Wireless and Bluetooth are our first targets. Even when you're not using these connections, the radio device tucked away within your machine is still expending energy, either keeping a connection in contention or looking for new networks and devices for you to connect to.

Both Moblin and UNR allow you to disable these devices from the desktop, but these options won't necessarily completely disable the radio.

The best option is to use a hotkey combination that's dedicated to your devices. These are usually labelled in blue across the laptop's keyboard, and typically involve you having to press the [Fn] key in conjunction with a number.

Step 1

The number key will normally feature a somewhat ambiguous icon that you'll need to decode in order to figure out which number is the correct one. If you're lucky, you'll also see an on-screen message updating you on any progress once you've pressed the key.

However, some netbooks don't have function keys to disable the wireless or Bluetooth radios, and you can't take any chances with the software disable function. Samsung's popular NC10 is one example of a machine that doesn't have a keypress option.

In these cases, your only course of action is to change a setting in your netbook's BIOS – a setting that will stay fixed until you restart your machine and manually undo the change.

Like many desktop machines, you can normally enter your netbook's BIOS by quickly pressing [F2], although like the hotkeys, this is dependent on your manufacturer (as is what you can and can't turn off within the BIOS).

With the NC10, for instance, you can switch your wireless devices to 'Always Off' from the Boot menu within the BIOS. While you're there, you might also want to disable the 'Internal LAN' setting in the Advanced menu, as the Ethernet port can steal power even while not being used. You should also make sure that any power saving modes for your device are enabled.

2. Screen brightness

Dimming the screen is a great way of saving some power, but this can sometimes be problematic with certain netbooks running a Linux distribution. This is because the hotkey combination may not work from the desktop, and the software isn't always capable of changing brightness either.

The Linux kernel needs to have support for your specific device. If it does, the distribution you use also needs to use the correct version of the kernel and provide a means of changing the brightness.

If this isn't the case, you might still be able to adjust the brightness of your screen from the command line. The trick is to use a special kind of file that accesses your display hardware. As with most devices, this can be found by typing ls /sys/class/backlight/.

If you've not encountered the '/sys' series of directories before, it contains dozens of folders and files that refer to each of the devices on your system. Rather than representing the files and folders on a storage device, this structure is a portal for configuring any plug-and-play hardware discovered on your system, and that includes devices like your netbook's screen, CPU and drive.

Step 2

To change values in the /sys tree, you will need to switch to the administrator's account on your machine. Ubuntu users won't be able to use sudo in the way they might be used to because the command to change values is really two commands, one piping output to another. The sudo privileges will only apply to the first and won't stretch to allow you to change the parameter in the second.

You can get around this by launching a new bash session using sudo, which will start a pseudo-administrator mode where every subsequent command is executed with root privileges. Moblin users just need to type su followed by their root password to get the same thing.

The contents of '/sys/class/ backlight/' should look something like 'acpi_video0', but this is dependent on the kernel driver for your hardware. Beneath this directory, you'll find a special type of file called 'brightness'.

If you probe the value of this file by typing cat acpi_video0/ brightness, for instance, you'll see the current brightness setting for your screen. This is usually within the range of 0 to 100, and may jump up in steps that are defined by your hardware's capabilities. The converse of this probe operation is to pass a value to this special file, hopefully changing your screen brightness in the process.

Typing echo 100 > acpi_video0/brightness, for example, will configure maximum brightness, while a value in the region of 15 should be close to your screen's minimum.