Running Linux on a Thinkpad X40

written by: Stephan Müller; mailto: smueller (at) chronox (dot) de

WARNING: The descriptions here are brief notes based on my personal experiences setting up the system with Debian. This is not a step-by-step guide. DO NOT attempt anything similar to the steps described here unless you completely understand what you're doing. You risk losing all your data and may even destroy your notebook if something goes wrong during installation. I'm hoping that this information will help experienced users in getting started, and maybe someone who has more free time than I do will be able to provide more detailed instructions.

Working hardware with kernel 2.6

The following hardware is working on my system with kernel 2.6.15 and additional patches (see

Untested/not working hardware with 2.6

With the above mentioned kernel, the following hardware is either untested by me or does not work (in case you have additional information how to get the stuff working, let me know). I will update the documentation as new information turns up.

Installation party

First steps after unpacking

After I brought my new X40 home an unpacked it, the first and most important step was the removal of the Windows XP sticker! :-)

Prevent Windows XP partition to convert to NTFS

The X40 comes with a Windows XP preinstalled. If you want to keep it and access it from Linux, you should NOT turn on your system prior you have read the following information!

The WinXP is installed on a FAT32 system. But during the first startup, the file system is converted to NTFS automatically. You have to prevent it the following way:

Note: I got a number of complaints that this does not work. At first, it also did not work for me. I reinstalled Windows from the rescue partition and immediately afterwards I renamed the convert.exe. This helped to block the conversion.

Boot a Knoppix

I consider the Knoppix CD as a Swiss Knife for everything regarding system rescue. Unfortunately, up to Knoppix 3.3, it does not support to be booted from a USB connected CD drive. Starting with version 3.4, it is supported.

Glad to have a Thinkpad, since it supports PXE to boot off another system in case you cannot boot from a CD drive. So I started the Knoppix on another system, started the Knoppix terminal server from Knoppix 3.3 (when booted into KDE, look in the K-Menu for the link to the terminal server setup).

I booted into the X40 into the BIOS and made the booting from the network the first boot option. Now when rebooting the system (that of course is connected to the same network as the terminal server), it boots from the Knoppix terminal server - yes, it is that easy! :-)

Save Rescue partition

The contents of the rescue partition can be saved to CD-R in case you do not want to get rescue CDs from IBM.

According to Stephen J. Hegner, the following is possible:

To make recovery CDs, just boot into Windows, press the "Access IBM" button, select "Protect Computer Data" from the menu, and then "Create Product Recovery disks". Unfortunately, it seems necessary to burn actual physical disks. There does not seem to be an easy way to get ISO images instead.

It is to be noted that when trying to repeat this process, a window came up which informing that there was already a set of recovery disks created, and that the license only allows for one set!

Shrink Windows XP partition - Rescue partition

I used qtparted to shrink my WinXP Fat32 partition to 15GB. When doing this, you also see the rescue partition, unless you configured the BIOS to hide it. Since I ordered the Rescue CDs from IBM free of charge (according to them this is only possible within the guarantee period), I removed this partition. Take care, you will not be able to recover your Windows in case of an emergency without the rescue CDs.

Before you remove the rescue partition, check that your Windows XP system still works!

Now partition the rest of the system.

Installing Linux

Here I made my life easy with just copying an existing Linux installation to my X40 (just tarring each partition separately including storing of the numeric user and group IDs - KNOPPIX has another /etc/passwd that mess the the owners of files other that root when only saving the default of the UID/GID names during tarring).

I of course had to change the fstab on the hardware to reflect the proper values of he new system.

As a last step I had to configure and install grub, the bootloader.

Configuration party

As I am only sporadically update this page, please also refer to for updated information.

Configuring the Kernel

To fully enable the DMA on the block devices, the kernel needs to be configured with Intel PIIXn chipsets support (CONFIG_BLK_DEV_PIIX).

To access the USB DVD burner, of course you have to enable USB support (UHCI for USB1 and EHCI for USB2 support) and USB mass storage. When hooking up the burner, you can access it on /dev/scd0.

In case you use udev, the USB DVD burner is accessible with the device /dev/sr0.

Attached there is my kernel configuration (see for reference.

Most of the drivers are compiled as modules. They mostly are loaded through hotplug, including the e1000 driver for the Ethernet card. However, since it is loaded very late in the boot cycle that causes some trouble with my automatically started firewall, I added the module to /etc/modules to have it started earlier.

Also, consider to compile the Thinkpad kernel modules to access the BIOS from Linux. Debian already provides the kernel module sources, just compile it with make-kpkg. You also have to load it with /etc/modules (by simply placing 'thinkpad' to the file), or add an alias for /dev/thinkpad to this module.

Configuring network

Although configuring the network can be done normally with /etc/network/interface, I would suggest using the laptop-net package. This package enables the automatic starting of DHCP when a network cable is attached. Upon detach of the cable, the interface is shut down.

The laptop net package does not need to be specifically configured. However you have to answer the initial question for MII with yes.

Configuring the WLAN card

The card I have is a Atheros a/b/g card. I used the driver from and it works well. In addition, there is a full open source driver at - this driver however is not yet (Feb 2006) mature that I would recommend using it.

With recent CVS versions, the WLAN card has a number of /proc switches. They can be found in /proc/sys/dev/ath0 and /proc/sys/dev/ath.

The module has to be loaded with

        modprobe ath_pci

This loads three modules: ath_hal, wlan and ath_pci.

To start it automatically, you either have to add the module name to /etc/modules or to a dedicated file in /etc/modprobe.d/ with the line

        alias ath0 ath_pci

Keep in mind that the interface for the card is ath0. Therefore, iptraf may not work out of the box (see the madwifi FAQ for details).

To run it with kismet, you have to get kismet 4 (kismet 3 does not have support for the madwifi card).

Now you can configure the interface using /etc/network/interfaces. Here is a snippet from my configuration file:

        iface ath0 inet dhcp
                wireless_mode managed
                wlan_ng_authtype sharedkey
                # Enabling the WEP encryption
                wireless_enc on
                # The WEP key
                wireless_key xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
                # The WLAN Name
                wireless_essid WLANSSID

In case you have a Centrino WLAN card, check out for a Linux driver.


The gpm is easy to configure, just start it with the following configuration (on Debian, add this to /etc/gpm.conf):


It works well together with X.

Configuring XFree86

See my attached XFree86 configuration (see You see, that I included support for any USB mouse that might be attached to the laptop. Since I use the /dev/input/mice device for the touchpad and the USB mouse, any USB mouse can even be attached and will recognized after X is started (thanks to kernel 2.6.0)!

This config automatically uses the Thinkpad stick.

In case you need a fonts server, add the following lines to the XFree configuration file:

        FontPath    "/tmp/.font-unix/fs7100"
        FontPath    "/tmp/.font-unix/fs7110"

If you want to use your middle mouse button for scrolling instead of using it for copy&paste, add the following configuration to XFree:

        Section "InputDevice"
            Identifier  "Configured Mouse"
            Driver      "mouse"
            Option      "CorePointer"
            Option      "Device"          "/dev/psaux"  # or /dev/input/mice
            Option      "Protocol"        "ImPS/2"
            Option      "ZAxisMapping"    "4 5"
            Option      "Emulate3Buttons" "on"
            Option      "EmulateWheel"    "on"   
            Option      "EmulateWheelButton" "2"

Since you have compiled in the kernel support for AGP and DRI for the Intel chips (see the configuration above), you automatically have hardware accelerated graphics support. Glxgears with the standard Debian X11 4.3 packages shows me about 430 fps.

There are dri-trunk modules with updates to the Debian provided modules at deb ./ (you only need the mesa library) - this gives me about 1450 fps with 16 bit (with kernel

Using an external Monitor with XFree86

The external video outlet does not work out of the box with the XFree driver. However there is a nice user space tool i855crt to be found at

This tool can be used as follows to display a copy of the local display on the external monitor. Execute as root (maybe you want to use sudo):

        i855crt on 1024x768@60

Use the resolution as needed (see the configuration file i855crt.conf for all configured modes or add your own modes).

To disable the external output again, execute as root:

        i855crt off

To display XVideo output (used for application such as DVD watching), you have to select to which display you want to route the video stream to. Per default, the local LCD display is used. But if you want to display your DVD on the external monitor, execute as root:

        i855crt overlaycrt on 1024x768@60

I have created some icons on my desktop to call the i855crt tool for an easy enabling or disabling of the external monitor. :-)

Keep in mind that on the external monitor there is only a copy of the X11 display shown, which means that if you choose a larger/smaller resolution that X11 is configured to display, your resulting display has is not either too large or too small.

Configuring X.Org

Since currently it seems that XFree86 is going to be replaced with X.Org, here are some instructions to get X.Org configured on your system.

It is to be noted that there are no Debian packages available and therefore you have to do everything manually. However, it is worth, because you get a dual head driver for the graphics card! In case you are interested in the new eye candy, you can give it a try. But beware, this is really CPU-demanding!

Follow the instructions provided at For securing your old XFree86 binaries (you cannot remove the Debian packages, because a large number of other packages depend on them), I just moved /usr/X11R6 to /usr/X11R6.old and created the symlink from /usr/X11R6 to my X.Org binary directory. Remember not to update/add/remove any of the XFree86 packages, as it will mess up your X.Org installation. When you want to revert back to the old XFree86 or change the XFree86 installation, simply remove the symlink to the X.Org directory and move the old XFree86 directory to its original place,

To get DRI working, you have to compile the i915 kernel module. This module is not yet in, so you have to pull bk-drm.patch and compile this new module instead of the old i830 kernel module (the i830 is only for XFree86 version 4.3 or X.Org 6.7, whereas i915 is to be used for XFree86 4.4 or X.Org 6.8). With this DRI driver, I get 1270 FPS out of the box with glxgears.

Dual Head configuration with X.Org

For enabling Dual Head, I configured /etc/X11/xorg.conf with two device sections.

X.Org is told to use pipe B (the default for the internal flatscreen) and pipe A (external CRT) with the MonitorLayout option. In addition, to allow attaching a monitor after X has started, DevicePresence is enabled.

See my configuration file for a working example. After restarting X, you have a second monitor at the external VGA port.

Take care, activating Xinerama disables DRI support.

I have created a wrapper script that allows displaying the second head's contents on the first head. I use this when giving presentations to avoid turning my back to the audience to check the contents of the display. In addition, this script allows resizing the resolution of the second head on the fly without restarting X. Using this feature, you can adopt the settings to fit your beamer or external monitor. The script also scales the display of the second head to the size of the first head (in case the resolutions differ).

The script is available at See h2 -h for usage. This script needs x11vnc and a VNC viewer. Take care to use x11vnc 0.62 or above, because older versions do not convert the mouse pointer position correctly when scaling the display.

Configuring CPU Frequency scaling

CPUFreq is the utilization of the SpeedStep technology from Intel. It basically supports manipulation of the processor cycles. It helps greatly in enhancing your battery life without you would notice it! In case the processor has nothing to do, the cpufreqd throttles the processor to 600 MHz. If there are tasks to perform, it immediately switches back to 1200 MHz.

For using CPUFreq, you have to enable the kernel driver and run the cpudynd or cpufreqd (see attached kernel configuration). Use one of the two daemons to suit your needs.


When configuring APM in the kernel - it works out of the box. Closing the lid suspends the system.

All kernels up to 2.6.5 locked up the system upon resume and attaching a new USB device. Starting with 2.6.6 the lockup is gone, so you do not need to unload the USB drivers.

The WLAN LED stays dark after a resume. But upon the first wireless packet sent, the LED resumes normal operation.

When using the default Debian X11 4.3 packages, the graphics is screwed sometimes. It works, but some colors are wrong and sometimes there are no colors, but the background is shown instead. According to Adam Goode, the dri-trunk X11 driver (see the X11 section) does not have this odd behavior. However, you have to use 16 bit color depth, otherwise you will get artefacts on the virtual console.


Finally, ACPI starts working. You have to use an 2.6.8 kernel and stable patch from which must be at least dated from 20040715.

In order to get your VGA card reseted after a resume, you have to supply acpi_sleep=s3_bios as kernel parameter during boot.

When I tested it, I always hat to unload the ehci_hcd driver.

There exists a kernel module that supports the various Fn-N combinations with ACPI at The readme file that is distributed along with the driver explains the use and provides some scripts for the acpid daemon.

However, I dropped ACPI support, since it does not work completely for me. For instance you always have to remove the USB2 driver, cpufreqd is resynced with a bad frequency, and the APM password securing does not work any more.

Configuring Sound

Sound is fairly easy to configure: Just enable the kernel configuration option CONFIG_SND_INTEL8X0 in conjunction with generic ALSA drivers (such as OSS API emulation). My /etc/modprobe.d/alsa file contains for enabling sound the following entries (keep in mind to add these lines to /etc/modprobe.d/alsa and stop using /etc/modprobe.conf, as all files in /etc/modprobe.d are now sourced automatically by modprobe):

        alias char-major-116 snd
        alias char-major-14 soundcore
        options snd major=116 cards_limit=4
        alias sound-service-0-0 snd-mixer-oss
        alias sound-service-0-1 snd-seq-oss
        alias sound-service-0-3 snd-pcm-oss
        alias sound-service-0-8 snd-seq-oss
        alias sound-service-0-12 snd-pcm-oss
        alias snd-card-0 snd-intel8x0
        alias sound-slot-0 snd-card-0
        alias sound-slot-1 snd-card-1
        alias sound-slot-2 snd-card-2
        alias sound-slot-3 snd-card-3

Configuring the Modem

There are two drivers applicable in general, but it seems that the SLMDM driver does not apply to the X40. The only driver that was working for me (PCI ID of the modem card: 8086:24c6) is the HSF Conexant driver from Linuxant.

Based on email notifications, both drivers are working for different folks, but for me, the SLMDM driver does not work.

Connexiant HSFmodem Linux driver

Download the driver from Compile it and start it.

The modem device is /dev/ttySHSF0. The init2 string is

        ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0

The modem device file is /dev/ttySHSF0. When using udev, this file will be created automatically.

SLMDM driver

Just to be complete, here is my information about the SLMDM driver, that does not work for me (neither the proprietary SLMDM nor the AC97 sound modem driver from the kernel).

There is a slmdm driver for 2.6 (to be found at You have to use version 2.9.x for getting it to compile properly under kernel 2.6. Just follow the install instructions.

Debian now provides packages for the kernel module (see sl-modem-daemon for the user space daemon and sl-modem-source for the kernel driver sources). The kernel source must be compiled with make-kpkg.

The pseudo TTY access rights to the modem device file is set to 660 with user root and group dialout. So if you want to access the modem device /dev/ttySL0, your user ID has to be assigned to the group dialout.

Instead of using the proprietary slamr.ko kernel module, you can configure a recent kernel (later than 2.6.4) with the kernel option CONFIG_SND_INTEL8X0M in the ALSA pci drivers section. After compiling, load the module snd_intel8x0m.ko. However, this module loads but gives the following error:

        MC'97 1 converters and GPIO not ready (0xff00)

and when dialing the following errors (setting the option SLMODEMD_DEVICE in file /etc/default/sl-modem-daemon to auto, causing the link /proc/asound/Modem to be evaluated for the device as hw:LINKDESTINATION - for me hw:1):

        codec_semaphore: semaphore is not ready [0x1][0x700300]
        codec_write 1: semaphore is not ready for register 0x54

This means, the ALSA driver does not work.

IrDA configuration

The IrDA seems to work after a BIOS update to version 1.21 (see You have to enable the IrDA port in the BIOS. When enabling it with IRQ 4 and IO port 3F8, the IrDA port is to be reachable at COM1/ttyS0. Hence my /etc/irda.conf contains


(this may be a Debian specific configuration file, but the first options apply to the tool irattach).

However, no connection could be established to remote devices. This was confirmed by Paul Ortyl. So, I would conclude, IRDA is not working.

Bluetooth configuration

The Bluetooth configuration is straight forward. Compile the kernel modules, install the bluez applications and start it. The default configuration of the Debian package worked for me. I tried it with a USB Bluetooth dongle.

Paul Ortyl reported that the build-in Bluetooth of the X40 works as well.

Drawbacks: After a suspend/resume cycle, the Bluetooth stack oopses with Kernel 2.6.6. Not sure what the cause of this is.

Docking Station

The docking station and its outlets is working out of the box.

According to Paul Ortyl, the test with a parallel port printer works flawlessly.

The attaching and detaching the laptop while Linux is running seems not to work flawlessly. Check for more details. In addition, might also allow you to use your docking station efficiently and can give you some additional hints.

Power consumption

Many thanks to Paul Ortyl for the following information on power.

AC-connected without Battery

The following measurements are done at the AC power outlet.

Some hints to energy savings --- I have measured energy consumption with
a wattmeter borrowed from local electrity provider.  Measurements
with battery unconnected.
mains adapter without load (unconnected) 2.0 +-0.2W
maximal encountered consumption < 25W
system not loaded, LCD brightness max 17.0 +-1W
system not loaded, LCD brightness min 12.3 +-0.5W
system not loaded, LCD OFF 10.5 +-0.5W
(error values as interval of seen measured values)
conclusion: the long (advertised) battery operation is possible only
with the lowest brightness -- read: work at night and not when the sun
is shining :)

AC-disconnected Battery info

The following information are presented by ACPI from the Linux kernel.

For my 8-Cell Battery
present:                 yes
design capacity:         61920 mWh
last full capacity:      62870 mWh
battery technology:      rechargeable
design voltage:          14400 mV
design capacity warning: 3096 mWh
design capacity low:     619 mWh
capacity granularity 1:  1 mWh
capacity granularity 2:  1 mWh
model number:            IBM-92P1002
serial number:             286
battery type:            LION
OEM info:                SANYO
present:                 yes
capacity state:          ok
charging state:          discharging
present rate:            13458 mW
remaining capacity:      14020 mWh
present voltage:         14904 mV
For my 4-Cell Battery
present:                 yes
design capacity:         27360 mWh
last full capacity:      27620 mWh
battery technology:      rechargeable
design voltage:          14400 mV
design capacity warning: 1368 mWh
design capacity low:     273 mWh
capacity granularity 1:  1 mWh
capacity granularity 2:  1 mWh
model number:            IBM-92P0998
serial number:            1160
battery type:            LION
OEM info:                SANYO
present:                 yes
capacity state:          ok
charging state:          discharging
present rate:            10796 mW
remaining capacity:      26750 mWh
present voltage:         16284 mV
present:                 yes
capacity state:          ok
charging state:          discharging
present rate:            10796 mW
remaining capacity:      26750 mWh
present voltage:         16284 mV


2006-02-24 - now working: SD card reader, IrDA (incl. FIR), hard disk active protection system, TCPA chip, link to more complete site about hardware configuration, Open Source driver for Atheros WLAN card available

2005-01-08 - New modem driver that makes the modem working, many thanks to Roberto Lumbreras who reported this

2004-11-24 - Fixed ACPI kernel parameter as outlined by Andreas V. Meier

2004-10-05 - Wrapper script for accessing second head provided; instructions for modprobe.conf changed

2004-09-29 - Only MESA lib is needed to have fast 3D, added X.Org details

2004-09-02 - Instructions on loading the rescue partition to CDs

2004-09-01 - Modem does not work at all, docking station problems; ACPI works now

2004-08-05 - Description of external monitor support added, Docking station information added (thanks to Paul Ortyl)

2004-08-01 - Added new hints for XFree configuration (scrolling and fonts server) - thanks to Volker Gropp; added new infos for the modem

2004-06-23 - New FPS record with 2.6.7 and dri-trunk module

2004-06-11 - Mark IRDA as not functional (confirmation from Paul Ortyl), added power information (thanks to Paul Ortyl)

2004-06-03 - All USB drawbacks are solved, IrDA is working, power consumption information from Paul Ortyl, Bluetooth information with help from Paul Ortyl

2004-04-17 - Update of the WLAN configuration to make it work, the slmodem driver is now included into Debian

2004-03-27 - New information for Active Protection System; new 3-D XFree86 support (thanks to Adam Goode), WLAN LED support

2004-03-27 - initial presentation


(stupid stuff, but needed)

Copyright (C) 2006 Stephan Müller - smueller (at) chronox (dot) de

$Id: linux_on_x40.pod 309 2005-02-02 03:28:47Z smueller $


Hey! The above document had some coding errors, which are explained below:

Around line 3:

Non-ASCII character seen before =encoding in 'Müller;'. Assuming ISO8859-1