posted by D. W. Price on Tue 12th Apr 2005 16:55 UTC
IconAt university, I didn't lift weights to keep in shape. I carried my textbooks in one arm and lugged a 12-pound laptop in the other. That heavy beast never lived up to its promise of freedom but my T20 running Debian Linux has. A modern notebook is compact and portable, runs its quiet fan only when necessary, uses less power than a desktop, and offers instant access to running applications by opening the lid.

Weight Training

Let me share some of the tips I've discovered to maximize the Linux notebook experience. REMEMBER THAT ANYTHING YOU TRY IS AT YOUR OWN RISK AND MAY CAUSE DATA LOSS OR DAMAGE TO YOUR SYSTEM. This article focuses on Debian Linux. Familiarize yourself with applicable documentation before using a utility or changing a configuration.

Buying Smart

I recommend refurbished notebooks. You can scan Google to see how well Linux works on them and you benefit from the progress made since the machine was first sold. You can buy a sturdy, lightweight, professional-class machine for a fraction of its original price and use your savings to maximize the system memory and purchase accessories. You'll also feel more relaxed taking a refurbished notebook traveling. Check the manufacturer's web page to see if any revisions are available for your notebook BIOS. Newer versions of a BIOS may provide fixes and performance improvements.

My current notebook is an IBM Thinkpad T20 with a 700 Mhz processor, 256MB of RAM and a 20GB hard drive. I run Debian Unstable with the 2.6.8 kernel, Gnome 2.8,, Thunderbird, and Firefox. I typically keep these applications open on separate virtual desktops. Any deficiency in the notebook's loading speed is off-set by the instant-on and instant-off of opening and closing the lid. I have not re-flashed the BIOS on my T20.

Pinching Power

Power-saving features are essential for adventures away from electrical outlets. If you use a desktop environment like Gnome, you can add a battery status indicator to the panel. Two systems allow power-saving in Linux: apm and ACPI. Older machines don't work properly with ACPI. You can try updating your BIOS or you can add acpi=off to the end of the kernel line in your grub or lilo configuration file. If you use apm, you need to add the apm module to your /etc/modules list and install the apmd daemon.

Apm will allow you to suspend your computer by closing the lid and re-awaken it by lifting the lid. Not all notebook hardware operates properly in Linux, however. If you experience intermittent freezing, you may need to disable power management services in your notebook BIOS (see your notebook manual) and replace the hardware features with Linux equivalents.

Linux's own services may also conflict with power management. First, use lsmod to check that your apm module is loaded and then use ps aux | grep apm to check that your apmd daemon is running. Services in Debian are controlled by using files that live in /etc/init.d like this: /etc/init.d/./pcmcia stop. You can stop services until closing your lid allows your machine to suspend. On my system, pcmcia services prevent apm from suspending the computer. I've created a simple script to turn these services off when I suspend the computer and turn them on when I lift the lid again. In /etc/apm/, you'll find scripts in suspend.d and resume.d that tell Linux what to do when it is suspending or resuming. In suspend.d, I copied an existing script to the name 80pcmcia and edited the script to replace the existing service name with /etc/init.d/pcmcia. I used the commands "stop" and "start" instead of "suspend" and "resume". To ensure there was a script for when the system awakened again, I copied /etc/apm/suspend.d/80pcmcia to /etc/apm/resume.d/20pcmcia. Depending on your notebook and the Linux kernel you're using, you may also need to remove and re-probe modules using similar scripts with the commands /sbin/rmmod module_name and /sbin/modprobe module_name instead.

Once you can put your notebook to sleep, you can move on to saving power when it's awake. Your backlight, your spinning hard drive and your CPU all consume power. You can control these devices with the speedstep function and utilities such as cpufreqd, and hdparm. If your notebook supports speedstep, you'll need to add speedstep modules such as speedstep-ich and speedstep-lib and performance governors such as cpufreq_powersave and cpufreq_userspace to /etc/modules. Find the available modules with find /lib/modules/ | grep cpufreq. If you use a desktop environment, you can install an applet such as gnome-cpufreq-applet to display CPU speed and control it manually. As non-root users couldn't adjust the CPU speed with the applet, I took the security risk of providing the applet with root capabilities by chmod +s /usr/bin/cpufreq-selector.

I installed laptop-mode-tools to control all of these features easily and automatically. When I unplug power, my screen dims, my hard drive spins down every few seconds after activity, and my CPU slows to its lowest setting. You can adjust the settings including a toggle to allow slowing the CPU in /etc/laptop-mode/laptop-mode.conf. When I plug power in again, the system resumes its original performance.

You should install and configure hdparm to ensure you're getting the maximum performance from your hard drive and CD/DVD. You can run hdparm -iI /dev/hda to examine the capabilities of your device and in Debian, you configure hdparm at the bottom of /etc/hdparm.conf. Be careful. Common enhancements include enabling 32-bit IO, DMA, interrupt unmasking and multi-sector IO which should result in faster transfers and stutter-free DVD movies. You may also wish to enable write-caching on your hard disk if you're comfortable with the potential for data loss if your system dies before the drive can flush its cache.

Spinning Down

Why spin down the hard drive if programs spin it back up again every minute or so? To some extent, laptop-mode-tools addresses this issue by caching writes. You can further reduce writes to the hard drive by re-routing your system messages to a virtual console instead of logs. I edited /etc/syslog.conf to comment out the parts that write to logfiles and to route all messages to tty8. You can read tty8 by press CTRL-ALT-F8 and return to X with CTRL-ALT-F7. Note that disabling written logs makes it difficult to track problems and hacking attempts on your system.

You can also reduce disk writes by reducing the number of running programs on your system and freeing up system memory. You can see which programs are running by using ps aux, top or something like gnome-system-monitor and adjusting it to show all processes. You might ask yourself why you would run a mail server like exim if you download all of your mail from a pop3 server. You can disable exim by running /etc/init.d/./exim4 stop and then mv /etc/init.d/exim4 /etc/init.d/DISABLED_exim4 so it won't launch again. You can do the same for other services that you don't need on a notebook including inetd. If you use the X-Window system, you can increase memory available for other programs by editing /etc/inittab to comment out all but one or two virtual consoles.

Nodding Off

You can install sleepd to put your system to sleep if there is no keyboard or mouse activity for a given amount of time. You can temporarily disable sleepd with sleepctl. For instance, you can write a script that calls sleepctl off; xine; sleepctl on to ensure that whenever you play DVDs, your system won't doze off. You can do the same for other programs that run unattended. Note that sleepd is designed to work with PS/2 mice and using a USB mouse may result in your system dozing off while you're surfing the web.

Table of contents
  1. "Laptop, Page 1/2"
  2. "Laptop, Page 2/2"
e p (0)    35 Comment(s)

Technology White Papers

See More