Install Debian On Thinkpad X40


I recently updated my notebook to a IBM Thinkpad X40 (ModelNumber)
There are plenty of Install How-Tos available (see below), however all of them leave at least some questions open. So here is my quick sum-up and reference of my install procedure and issues with Debian/GNU Linux 3.1 (Sarge)

In short: The X40 runs Linux sweet like sugar for me now ....

If you indent to use this as a guide, note that it already asumes you are quite familiar with Debian/GNU Linux and the compilation of kernel and modules with make-kpkg

Table of Content

On this page...

Debian Sarge - Basic Installation

The X40 doesn't have a built-in optical drive, luckily I also got the Ultrabase, so I started with the Debian netinstall CD (rc2) and a very basic system. Immedeiatly afterwards I updated to kernel 2.6.8 (forgot to do the right from the start) and installed the "x-windows-system" afterwards.

The Basic System installed flawlessly: network card, soundcard, Xfree86 including external USB-mouse and direct rendering infrastructure got correctly installed and autoconfigured.

Kernel Configuration

Right after having a working X-windows system I downloaded the 2.6.9 kernel and compiled it myself. (It seems that software suspend and cpu frequency scaling are not enabled in the debian default kernel - If you don't need this you might be lucky with the Debian stock kernel as well)

Here's the kernel-config file I am currently using:

WLAN (a/b/g with Atheron-Chipset)

Unfortunatley WLAN is not working out of the box. I got a Atheron-chipset based card with following "lspci" output:

  0000:02:02.0 Ethernet controller: Atheros Communications, Inc.
  AR5212 802.11abg NIC (rev 01)

This card is supported by the Madwifi-driver ... and works - however you have to compile this modules by hand.

Debian source packages for the madwifi drivers are available here:

Download it manually or add to your "/etc/apt/sources.list":

  deb sarge madwifi


  apt-get install madwifi-source
  apt-get install wireless-tools

compile the modules..

Some issues popped up when dealing with 128-bit encryption. I had to manually set
"iwpriv ath0 authmode 2"
and any other options via "iwconfig" (key freq, ap,..) do get the card correctly assoisiated and connected.

ALSA - Sound

ALSA sound works out of the Box, but it may happen that your card don 't want to function and your dmesg shows:

  ALSA ../alsa-kernel/pci/intel8x0m.c:400: codec_semaphore: semaphore is not ready [0x1][0x700300]
  ALSA ../alsa-kernel/pci/.c:415: codec_write 1: semaphore is not ready for register 0x54

This means that "snd-intel8x0m" (an ALSA Modem driver) has registerd as first soundcard. The real soundcard should still be available as second card.

I do not really know what this driver is up to, but as I currently don't need the modem anyway I just put the "snd-intel8x0m" onto the "/etc/hotplug/blacklist"

Power Management


Kernel-ACPI with Powerbutton and Suspending works out of the box (as of Kernel 2.6.9). However you have to add following line to the boot commandline to be able to wake your thinkpad up again:


You might also be interested in the:

Thinkpad-related Functions (IBM-ACPI)

a nice kernel module especially for IBM Thinkpads
it implements an ACPI interface to the various FN-Key combinations: sleep, monitor, un/dock, light ..

IBM-ACPI is included in kernel 2.6.10!

Debian source and tool packages of IBM-ACPI can be found at:


  deb-src sarge ibm-acpi


  apt-get install ibm-acpi ibm-acpi-source

and compile the module..

This install reasonable working events and actions in "/etc/acpi".
Not all of them are enabled by default.
You need to change the mask in "/etc/init.d/ibm-acpi" if you also want the suspend, bluetooth and dock buttons working via ACPI-events.

When activating IBM-ACPI hotkeys for all possible events, you have to take care of the events yourself which is also true for the Bluetooth and Monitor-Button. They won't function anymore without defining an appropriate action.

I wrote my own actions and linked them to accordingly to the "/etc/acpi/ibm-*" action.

Sleep (Suspend to RAM)

For Suspend to RAM, I defined:

~$ cat /etc/acpi/my-actions/

  echo "mem" > /sys/power/state
  hwclock --hctosys

Hibernate (Suspend to Disk)

suspend to disk also seems to work fine using the kernel's swsusend. (you have to activate it in the kernel config, it is marked as experimental)

Note: the USB-subsystem renders unusable and hangs after wakeup. I solved this by stopping hotplug before suspending and starting again afterwards.

Here is the script:

~$ cat /etc/acpi/my-actions/


  /etc/init.d/hotplug stop
  echo "disk" > /sys/power/state
  hwclock --hctosys
  /etc/init.d/hotplug start

Dock & Undock

Undocking and Docking into the X4 Ultrabase works using
with IBM-ACPI's events and interface. For example:

  echo "undock" > /proc/acpi/ibm/dock

IMPORTANT! you have to take care of unregistering the IDE device in the bay yourself. The examples provided by ibm-acpi package use "idectl" for this purpose (you find idectl it in the package of hdparm in "/usr/share/doc/hdparm/contrib"). Anyway it seems to not work properly in sarge.
I used "hotswap" instead. It is in the Debian-Repository, seems to work well and also has a GUI Interface (if really needed)..

Following scripts take care of my docking and un-docking (linked to "" resp. "")

~$ cat /etc/acpi/my-actions/


  status=`/usr/bin/awk '/^status:/ { print $2 }' /proc/acpi/ibm/dock`

  if [ "$status" == "docked" ]; then

        # make sure the bay's cdrom is unmounted
        umount /cdrom

        #idectl not working properly on Debian sarge at the moment.
        #/usr/local/sbin/idectl 1 off
        #so use hotswap:

        #unregister ide1
        hotswap -c 1 unregister-ide

        if [ -L /proc/ide/hdc ]; then
                exit 1
        echo undock > /proc/acpi/ibm/dock

and docking:

~$ cat /etc/acpi/my-actions/


  status=`/usr/bin/awk '/^status:/ { print $2 }' /proc/acpi/ibm/dock`

  echo dock > /proc/acpi/ibm/dock

  # if ide1 (cdrom) is already there exit
  if [ -L /proc/ide/hdc ]; then
        exit 1
  # else register it
  sleep 1
  hotswap -c 1 rescan-ide

I get some screen garbage when the screen blanks after docking and undocking. A not perfect workaround to get rid of it is to switch to a text-console and back to X again.

CPU Frequency Scaling

Seems to work fine (If activated in the kernel !!)


  apt-get install cpufreqd


Build-in Bluetooth works out of the box ... at least I could backup a phonebook using multisync without a problem.

  apt-get install bluez-utils bluez-pin


works out of the box (tested with an IEEE1394 / Fireware card)

  apt-get install pcmcia-cs


I did not configure and use it up to now.
But there are module sources and utils in Debian Sarge:

  apt-get install sl-modem-source sl-modem-daemon

Other Debian/Linux Howtos for the Thinkpad X40

Other useful ThinkPad resources: