Linux on the IBM Thinkpad T40
This document details installing and configuring Ubuntu Linux 6.06 LTS (Dapper Drake) on my IBM Thinkpad T40, persephone. Information on older versions of Linux is elsewhere.
This information is now hideously obsolete (just like the T40 itself) and is not maintained; it is left up in the hopes that someone might find it useful.
Table of Contents
- The Hardware
- Suggested BIOS Tweaking
This is an IBM Thinkpad T40, model 2379-D5U. The base configuration is:
- Intel Pentium-M 1.6GHz, 1MB L2 cache, 400MHz FSB
- 512MB PC2100 DDR SDRAM (266MHz), max 2GB
- ATI Mobility Radeon 9000, 32MB RAM, AGP 4x
- 14.1" TFT at 1400x1050 resolution, true color
- 80GB 4200rpm ATA100 IDE hard drive
- SoundMax Integrated Digital Audio chipset
- Intel PRO/1000 Gigabit Ethernet
- IBM 802.11a/b wireless (Atheros AR5211)
- 56Kbps modem (Agere AC'97)
- CD-RW/DVD in drive bay
- Parallel, IrDA, VGA-out, SVid-out, 2x USB 2.0, 2x PCMCIA, Bluetooth
- about 4.9 pounds
It's a pretty sweet machine. Rather expensive at the time, though, and not so sweet compared to new machines today, but still perfectly serviceable nonetheless.
This machine does not qualify for the Intel Centrino label as it does not use the Intel wireless card. Instead, it has a dual-band card (802.11a/b) from Atheros, which is a nicer card anyway. Other T40 models may use the Centrino component. Centrino on Linux is now supported by Intel, or so the rumor goes, and it also works with a Windows device driver wrapper like ndiswrapper.
IBM (and most other companies) usually ships their Thinkpads without a set of OS CDs or even recovery CDs. Instead, there is a "Predesktop Area" reserved on the hard drive that contains a complete disk image of the factory installation state. The predesktop area is not a separate partition; the BIOS simply hides the last couple gigs from the operating system. This can actually cause problems for some installers that aren't fooled by the BIOS and see the entire disk; the installer writes a bootloader with a geometry that disagrees with what Windows sees and all kinds of bad stuff happens. Since I don't dual-boot my machine, I haven't had to deal with this problem.
Naturally, there's no sense in letting perfectly good hard drive space go to waste, so I'm going to blow away the predesktop area. You need to disable the predesktop area in the BIOS. Go to Security and set the IBM Predesktop Area to disabled.
Blowing away the predesktop area prevents the hard drive based recovery system from working, so you cannot restore the machine from the hard drive. This isn't really an issue because you can get recovery CDs from IBM that do the same thing without occupying several gigs of your hard drive. To get a set of recovery CDs, call IBM Technical Support. If you bought the machine within the last 30 days, they will send you the CDs free of charge; otherwise, you may have to pay for it (I was quoted $35). If you just bought the machine, you should get the CDs regardless of whether you intend to install Linux, because it's free and you never know when you might want them. They're very nice about it; I got mine next business day.
Other people have instructions for going through the appropriate hoops to keep the predesktop area and XP (for dual-boot) happy. See the links at the end of this document.
You should also go to the IBM website and download a copy of the Hardware Maintenance Manual for your model. This is an excruciatingly detailed guide to every nut and bolt (literally!) in your machine; it's the same book their field service reps use. Pages and pages of diagnostic codes and other goodies and complete diagrams explaining how to disassemble your Thinkpad into its component atoms. You might not want to print it out, however, as it is a couple hundred pages long.
Suggested BIOS Tweaking
These are some suggested changes you should make in the BIOS.
- Spread the IRQs around a bit (Config/PCI). This is probably totally optional.
- Disable anything you are not using, such as the serial port that isn't physically there (unless you have the dock).
- Disable the predesktop area (Security/IBM Predesktop Area). This lets you use your full hard drive but you lose the hard-drive restore capability. This is a non-issue if you have the recovery CDs.
- Set the boot display to VGA+LCD (Config/Display). That way, if you ever break the LCD panel, it'll use an external monitor on boot.
- I'm really not sure what the point of Legacy Floppy Support is when IBM doesn't even make a floppy for the drive bay.
My BIOS is revision 1RET85WW, dated 12/15/2003, although it probably doesn't matter.
This goes pretty much like any standard Ubuntu install. The installer doesn't ask you for much of anything anyway, and it almost gets everything right. You'll get a functioning desktop system, but suspend isn't quite working as expected and the video settings, while functional, are less than optimal.
I think it goes without saying that you should enable all the repositories: non-free, universe, multiverse, the whole kitchen sink. Virtually everything you need is already in a package if you enable all the repositories. I did not have to compile a single thing to get the system working as below.
I liked Austin Murphy's nice overview chart so much that I decided it'll be a nice thing to have. There's a lot of green, which means pretty much everything works. See individual sections for details.
|Video - X||16 Jun 2006||Use radeon driver|
|Video - DRI and 3D||16 Jun 2006||Use radeon driver|
|Video - External Displays||18 Jun 2006||pending|
|Keyboard||16 Jun 2006||Optional: Xmodmap your Fwd/Back keys|
|Trackpoint/Touchpad||16 Jun 2006||Use native Xorg Synaptics driver|
|Ethernet||16 Jun 2006||Use e1000|
|Modem||21 Jun 2006||Driver loads, probably works for data|
|Wireless LAN||16 Jun 2006||Works out of the box|
|Sound||16 Jun 2006||Use ALSA|
|PCMCIA||22 Jun 2006||Works with pcmcia-cs/pccardctl|
|Hard Drive||22 Jun 2006||DMA enabled. Optional: enable 32bit IO|
|DVD/CD-RW||16 Jun 2006||Works out of the box|
|Power - Basic Status||16 Jun 2006||Use acpi|
|Power - Suspend/Resume||16 Jun 2006||Use acpid, not gnome-power-manager|
|Power - Frequency Scaling||16 Jun 2006||Use speedstep-centrino and cpufreqd, not powernowd|
|Bluetooth||20 Jun 2006||Module loads; haven't tried|
|USB||16 Jun 2006||Just works, hotplug included|
|TCPA Chip||22 Feb 2004||GPL driver exists, haven't tried|
|Special Buttons||16 Jun 2006||Use tpb|
- Complete functionality. Everything works and functions completely to my satisfaction.
- Partial functionality. Important aspects are working, but functionality is very incomplete.
- Driver exists. I did not personally test, but it may work.
- Not supported. Does not work with acceptable functionality.
Video and X Windows
The Ubuntu installer sets us up with the
ati driver and
correctly detects our funny resolution of 1400x1050. Everything seems
to be working if you use it like a desktop, including DPMS. However,
we can do significantly better, especially with regards to 3D
acceleration and power management.
Section "Device" Identifier "ATI Radeon" Driver "radeon" Option "DynamicClocks" "on" Option "AGPMode" "4" Option "RenderAccel" "on" Option "EnablePageFlip" "on" Option "BIOSHotkeys" "on" BusID "PCI:1:0:0" EndSection
First, we switch to the
radeon driver. The
EnablePageFlip options improve 3D performance.
BIOSHotkeys option enables the various Fn-keypresses.
Fn-F3 will blank the screen until another key is pressed. Fn-F7 is
supposed to toggle the external display, but this doesn't seem to
actually work and my external display is always on. Finally, the
Fn-Space screen zoom is implemented in software and so it doesn't
actually do anything by default on Linux (however, it can be
addressed; see the keyboard section).
Finally, there is a known
issue with Radeon chips consuming unreasonable amounts of power
while suspended. To fix this, we added the
option above. We also need to add the
radeonfb module to
/etc/modules; you don't have to pass any special options
or do your own custom initrd like some websites tell you. On Ubuntu,
merely having this module loaded ensures that it enters D2-sleep
appropriately. The difference is quite dramatic; the system lasts
three times longer in suspend with these fixes.
There are a few options that I have not included that you might want to play with:
There is the
MergedFB option that allows you to do
Xinerama-like (dual head) stuff natively. I've heard good things
about it and seen it in action on a T43, but haven't bothered to try
it on mine.
AccelMethod option to EXA instead of the
default XAA supposedly makes the Composite extension go faster.
TODO: check if dynamicclocks is preserved across hibernate
You will want to install
radeontool, which allows
you to blank the display in software. This is used by the suspend
scripts and Ubuntu should have installed it by default.
If you want to play with over/underclocking your Radeon, you can try
utility. I haven't played with this as I have no need for it, but it
External display (VGA) does work (in clone mode), just plug it in.
Even video playback seems to work. Since 1400x1050 is
not a standard resolution, it will look odd and cut off, and the
refresh rate may be less than desired. The resolution switcher applet
resapplet) in Gnome can switch to 1024x768 (for most
projectors) just fine. Ideally we'd be able to drive the external
display at a more reasonable resolution, but for presentation use it
works well enough out of the box.
I do not know if TV-out works.
More information is available at:
ThinkWiki: Graphics Power Management
ThinkWiki: Radeon driver options
It's a keyboard, what about it wouldn't work?
There are the various Fn-key combinations that do things. Let's go over some of them:
Screen Blank (Fn-F3) is taken care of if you enable the
BIOSHotkeys option in X as described
The Wireless Toggle (Fn-F5) works and is discussed under Bluetooth.
The screen brightness controls (Fn-Home and Fn-End) are hardware
controls and work independent of the OS. If you want an on-screen
display to reflect these changes, the
discussed later does this.
The ThinkLight toggle (Fn-PgUp) works independent of the OS. If you
want to flash a status message when this happens,
also takes care of that.
Screen Zoom (Fn-Space) is implemented in software under Windows and
consequently does nothing under Linux. However,
give you a callback for this event and you can use it to call your
favorite Linux screen magnification tool if you want to make it work.
Alternatively, you can use it for whatever toggle you want.
The suspend and hibernate keys (Fn-F4 and Fn-F12) generate ACPI button
events and can be dealt with by
acpid. See the power management section.
There are two extra keys on the keyboard right by the arrow keys:
Forward and Back. You can use Xmodmap to give them some keysyms. The
keycodes are 234 and 233. For example, you can put the following in
keycode 234 = F21 keycode 233 = F22
This assigns Back and Forward to F21 and F22. Now add something like
xmodmap $HOME/.Xmodmap to your session and you're good to
go. If you intend to use them only within Gnome (say, for switching
workspaces), you don't even need that as Gnome is happy with raw
keycodes in the Keyboard Shortcut app.
If you want Forward/Back to behave like Forward/Back under Firefox,
you'll need to tell Firefox about it. Go to your Firefox chrome
directory (something like
unzip. Now edit
content/browser/browser.xul. Go hunt for the bit with
keyset id="mainKeyset" and stick in these two lines:
<key id="goBackTP" keycode="VK_F21" command="Browser:Back"/> <key id="goForwardTP" keycode="VK_F22" command="Browser:Forward" />
zip -rD0 browser.jar
content/browser/ and restart Firefox.
Ubuntu sets you up with the Touchpad and Trackpoint all ready to go. There isn't that much to do.
The relevant section of my
xorg.conf looks like:
Section "InputDevice" Identifier "Configured Mouse" Driver "mouse" Option "CorePointer" Option "Device" "/dev/input/mice" Option "Protocol" "ExplorerPS/2" Option "ZAxisMapping" "4 5" # Option "Emulate3Buttons" "true" EndSection Section "InputDevice" Identifier "Synaptics Touchpad" Driver "synaptics" Option "SendCoreEvents" "true" Option "Device" "/dev/psaux" Option "Protocol" "auto-dev" Option "HorizScrollDelta" "0" EndSection
Note that this is very slightly different from the default Ubuntu setup. I want a proper middle mouse button and don't care much for middle-button-scroll (the default behavior in Windows).
Since there are technically two mice at play here, the trackpoint and the touchpad, we need to tell the server layout to use both of them
Section "ServerLayout" Identifier "Default Layout" Screen "Default Screen" InputDevice "Generic Keyboard" InputDevice "Configured Mouse" InputDevice "stylus" "SendCoreEvents" InputDevice "cursor" "SendCoreEvents" InputDevice "eraser" "SendCoreEvents" InputDevice "Synaptics Touchpad" EndSection
For more options for the touchpad, do
If you want, you can use the
qsynaptics tool to
configure your touchpad settings. Ubuntu already
has a package for this.
It works and even survives a suspend/resume cycle correctly. Use the
The onboard modem is a part of the sound card and the ALSA drivers are
already there but not loaded by default. You want to load the
snd_intel8x0m driver (via
usual). You also want to install the
package to actually create the modem device and manage it. Once you
have both of these things, you can test the modem with:
slmodemd --alsa --country=USA hw:1
This creates the modem device, which you can then use with your
favorite dialer. Obviously, if you don't live in the United States,
you should change the country to match. If it works, you should
/etc/defaults/sl-modem-daemon to include:
sl-modem-daemon service (invoked from
/etc/init.d) is set up with your settings. Run the
service to enable the modem.
The Gnome network stuff will autodetect the modem if
slmodemd is running correctly. I haven't tested PPP
dialing because I have no PPP service to dial, but I have no reason to
believe it will fail.
Finally, I should point out that this driver only supports basic
dialing. If you want features like voice dialing you'll need to
sl-modem-source and play with it.
For more information, the main resource is the Linmodems page, which includes the latest drivers and lots of useful utilities.
The IBM Dual-Band a/b card is actually an Atheros AR5211 and it is supported under Linux. I chose this card specifically because it is not the Intel PRO/2100 Centrino, which lacked native Linux support at the time I purchased the machine (that has since changed). We should vote with our dollars.
This works straight out of the box with the
madwifi restricted driver. If
you are not so fortunate to be using a distribution that supports it
out of the box, you should download and build these drivers yourself.
The onboard sound chip claims to be a SoundMAX. ALSA sound seems to
work. The installer sets it up with the
driver. I have yet to find any issues with it. It survives
suspend/resume cycles without problems.
What's more, it comes all set up out of the box with hardware mixing
working. No more of this "sound server" nonsense; multiple
applications can use sound simultaneously and behave as expected. In
fact, I recommend you disable the sound server (ESD) in Gnome and
alsa-oss package instead.
Works out of the box; tested with an ancient 14.4 XJack modem. Ubuntu
sets you up with
pcmcia-cs and the more recent
pccardctl from the
This is all standard stuff that any distribution should have.
It works fine, obviously, or we would be this far. DMA is on by
default in Ubuntu. If you want to enable 32 bit IO, edit
/etc/hdparm.conf and uncomment the appropriate line.
My machine came with a Toshiba SD-R9012 DVD/CD-RW in the drive bay. Ubuntu picks it up just fine. It can read DVDs and burn CDs without problems.
I have never attempted to hot-swap the drive as I have nothing to swap it with. Other people have tried this sort of thing before, though. See the ThinkWiki page on hotswapping for details.
For fun details on how to set up actual DVD playing in software, see my Ubuntu setup page.
Power management is almost but not quite working out of the box. I suspect the first kernel update (2.6.15-25) broke something, as lots of other laptop users on the forums have reported similar problems. We need to do several things.
First off, suspend in X is rather unstable un the default
configuration. We need to add one kernel parameter to fix this. Edit
/boot/grub/menu.lst and look for the like that starts
# kopt=root=/dev/hda5 ro acpi_sleep=s3_bios vga=normal
vga=normal bit disables graphical boot, which is a
personal preference. You don't need to include that. Obviously, the
root should point to whatever your root actually is.
sudo update-grub to update the bootloader. The
changes will take effect upon reboot.
The Gnome power management stuff does not work out of the box. I tried for a little bit to get HAL/DBus to do the right thing, but concluded it would be easier to just go to my old setup with custom scripts.
acpid to fix our problem. The actual setup is
pretty easy; in
/etc/acpid/events there are a bunch of
files that represent various ACPI events. You change these to point
to the scripts you want. The main ones of interest are
lidbtn (lid open/close),
ibm-hibernatebtn (Fn-F12). It's easy to
make them point at a custom script; for example, my
lidbtn looks something like:
# /etc/acpi/events/lidbtn # Called when the user closes or opens the lid event=button[ /]lid action=/root/custom-suspend.sh
That points to a custom suspend script, which looks like:
#!/bin/bash CONSOLE=`fgconsole` radeontool light off chvt 12 # make the suspend call echo mem > /sys/power/state radeontool light on chvt $CONSOLE chvt 12 chvt $CONSOLE
To make a hibernate script (using software-suspend), just change the
disk in the suspend call. Naturally,
if you want to suspend/hibernate from software, you just have to call
The calls to
radeontool toggle the backlight and all
chvt calls deal with the fact that the display is
kind of funny when resuming. Swiching to a virtual console and back
again corrects this, so the script does it automatically.
By the way, there are already pre-existing ACPI scripts provided by Ubuntu, but they don't work as nicely and are significantly more complex.
Finally, we'd like to set the system to throttle the CPU down when
running on battery power. Ubuntu tries to set us up with
powernowd which definitely does some sort of frequency
throttling, but I'm not familiar with configuring it and so I replaced
it with what I do know:
Install all the
cpufreq related utilities from the
configuration file is self explanatory and the default is pretty
reasonable (full speed on AC, drop down to low power after a few
minutes on battery).
If you want the Gnome CPU Frequency Scaling applet to give you the
option to manually set speed,
needs to be setuid.
There's a parallel port on the back. I set it to ECP. Linux sees it just fine, but since I don't have anything to plug into it, I can't test if it works. It really should, though; this isn't rocket science.
Serial and IrDA
There is no actual old-school 9-pin serial port on the machine. The circuitry is all there, but the connector is not. I suspect the dock or port replicator might have it. Since I have neither of these things, I simply disabled the serial port.
IrDA might work, but I don't have any IrDA devices to test it with, so I really can't say. Other people have gotten it to work.
Press Fn-F5 to turn on the Bluetooth radio, which is apparently
connected via an internal USB port. It loads
bluetooth driver. Everything seems happy, but since I don't
have any Bluetooth devices, I have no idea if it really works. It
One thing to note: if you press Fn-F5 again, it turns off both
Bluetooth and Wifi. Pressing it again activates both of them. If you
want to have Wifi on without Bluetooth, you need to remove
ath_hal, and reload
ath_pci. Then mark the
interface up with
ifconfig ath0 up. After this you can
use WiFi as normal without Bluetooth. This is the fault of the
default ACPI scripts (
/etc/acpi/wireless.sh); if you want to spend the time to
do so, it wouldn't be that hard to make it cycle through
Wifi/Both/Bluetooth/None. I haven't bothered because I never use
Ubuntu sets up USB for you (
usbcore). It works with all of my
toys. The USB subsystem does survive a suspend/resume cycle, so you
don't need to do any monkeying around. Things get automounted and
automagically recognized, so there is little work to do here.
Special Buttons and Gadgets
You can get all kinds of cool Thinkpad-related stuff to appear in
/proc/acpi/ibm by loading the
module. You should definitely do this. Ubuntu does this by default.
There are four special buttons above the keyboard: AccessIBM, VolDown, VolUp, and Mute. These are not conventional keys and generate no scancodes.
The volume control functionality is implemented in hardware and works independently of the operating system. The Multimedia Key stuff in Ubuntu's Gnome configuration actually notices the hardware volume changes and displays it onscreen. However, it is not enough to enable the AccessIBM button. What we want is software that can handle both.
Fortunately, such software exists. Grab the Ubuntu
package, or install it by hand from source. Download Markus Braun's tpb program to
enable the use of the AccessIBM button and on-screen display. You can
assign an arbitrary shell command to the button (such as opening a
terminal), and if you build it with on-screen display support
libxosd and related packages), you
get on-screen displays for volume changes and various other messages.
Very cool. Instructions for setting this up are included in the
$HOME/.tpbrc looks like:
THINKPAD /usr/bin/gnome-terminal --working-directory=/home/walter/ APM ON OSD ON OSDFONT -*-helvetica-medium-r-*-*-25-*-*-*-*-*-*-* OSDCOLOR Green OSDTIMEOUT 3 OSDVERTICAL 50 OSDHORIZONTAL 25 OSDPOS BOTTOM OSDALIGN LEFT
This makes AccessIBM launch the Gnome Terminal and enables a nice and large on-screen display for volume/brightness meters and message notifications.
The ThinkLight, which is a keyboard light mounted on the screen, works
automagically with Fn-PgUp. The screen brightness controls (Fn-Home,
Fn-End) are hardware controls and work independently of the
operating system. If you have
tpb installed, you can
have it display messages on-screen when status changes.
For additional fun with the ThinkLight, install
a plugin for Gaim that blinks the light whenever you receive a
message. You need
ibm_acpi loaded and install the
provided suid thinklight command-line executable. Ubuntu already has
a package for this.
There also exist Thinkpad
Configuration Tools for Linux. These tools provide most of the
functionality of the PS2.EXE DOS-based configuration tool and its
various Windows-based descendants. This will let you change things
like the behavior on lid-close on the fly, without rebooting into the
BIOS. Before we go on, however, I'd like to point out that most of the
functionality here has been superceded by ACPI support, so you
probably don't want to bother with this unless you have a specific
need in mind. I install them but have never had to use them in daily
work. There are Ubuntu packages available (
The primary tool is
can be used at the command line. The project has also recently
released a GTK2-based graphical configuration tool that duplicates the
same functionality; it is probably preferable if you use X regularly.
tpctl usable by non-root, you need to make sure
you have permissions. I suggest creating a thinkpad group, adding
yourself to it, and then changing permissions on
/dev/thinkpad to give the group write access.
TCPA Chip (IBM Embedded Security Subsystem 2.0)
The T40 comes with a TCPA chip which isn't terribly useful. IBM Research provides an open-source Linux driver along with white papers and example code. I haven't felt the need to actually play with it. The readings available there are actually pretty interesting and informative, and are well worth a read before you dig out the torches and pitchforks.
Come to think of it, this is the only thing that Ubuntu does not provide a package for.
Other Optional Stuff
Since Ubuntu aims for maximum out of box compatibility, it loads a lot of modules that aren't necessary. What would we possibly do with the Panasonic hotkeys module? So let's remove some modules that we don't need.
The module blacklist is (for whatever reason) enough, so we will make
the modules go away by aliasing them to nothing. Create a file
/etc/modprobe.d/bad-modules (you can actually name it
whatever you want as long as it is in that directory) containing the
# Get rid of modules we don't like alias sony_acpi off alias pcc_acpi off alias tsdev off alias tc1100_wmi off
Several pages from other people were valuable in researching solutions for this laptop. They are provided below as references and should be useful if your hardware and software configuration does not match mine.
- ThinkWiki - THE place for Linux on Thinkpad
- IBM Personal Computing Support - Linux: Linux for IBM Personal Systems
- Bill Wohler's Debian on an IBM Thinkpad T40p
- Theodore Ts'o's Linux on T40p
- Klaus Widener's (dead link) http://www.w-m-p.com/linux-on-t40.html (Running Debian Linux on an IBM Thinkpad T40)
- Fabrice Bellet's Linux on the Thinkpad T40
- Austin Murphy's Linux on the IBM T40
- Valient Gough's (dead link) http://arg0.net/users/vgough/suse-t40p.html (SuSE 8.2 on an IBM Thinkpad T40p)
- Carlo Hamalainen's (dead link) http://www.maths.uq.edu.au/~carloh/t40/ (Linux on an IBM T40 1.3Ghz laptop)
- Geekster.org: (dead link) http://www.geekster.org/ibmt41/ibmt41.php (Mandrake 9.2 on IBM T41)