Thinkpad x40

Thinkpad x40

268 × 211 × 27 mm, 1.2 kg

"Perhaps one of the best supported notebooks because several developers also use it." - OpenBSD i386 Laptop Status. This laptop replaced my Thinkpad 240 in July 2006. In November 2011 I replaced it with a Thinkpad x120e. Until late 2018 I was still using this 14 year old laptop, running Arch, as a server at a remote weather station. In February 2019 I finally got rid of it.

The CPU, graphics, wireless network, and CF slot no longer work in a standard Ubuntu install. But with a little work, persistence, and luck you can still get it running.

In early 2010 I replaced the battery, upgraded the memory to the maximum 1280 MiB, and upgraded the SSD (see below) to 16GB for a total of $120. In early 2015 I upgraded the SSD again, to 32GB, and replaced the battery for $60.

Hibernate (suspend to disk) actually works. You will need tphdisk.

I'm put off by a few things. I couldn't figure out how to buy one without also buying Microsoft software I don't need. I'm worried by reports that it doesn't work with most mini-pci 802.11 cards (apparently fixable with the tpwireless command). The Microsoft sticker on the back is hard to remove. And it has no serial port.

The two keys on either side of the up-arrow key are codes 233 and 234, or in more recent versions of xorg, 167 and 166. As suggested by jcs I map them to page-down and page-up:

xmodmap -e "keycode 167 = Page_Down" -e "keycode 166 = Page_Up"

To eliminate those embarassing beeps when you plug in the power adaptor or enter sleep mode, go into BIOS setup, Config->Alarms.

The IBM/Lenovo support web site makes it sound like you need a Microsoft OS installed to update the BIOS, but that's not the case. See BIOS Upgrade.

A great resource for Thinkpad information is ThinkWiki.

Linux/Arch quirks

Arch discontinued support for i386 on 2018 so I depend on the good folks at archlinux32.org to keep me going.

Intel 855GM graphics stopped working after kernel 2.6.31. See below.

Compact Flash (CF) cards (the least compact of the flash cards) connected via pcmcia/cardbus don't work on linux and probably never will. Mark Shuttleworth filed a bug report and if he can't get this fixed I'm sure I can't. They seem to work fine connected directly to the IDE connector (see below).

I use vbetool to turn off the backlight. I can't figure out any other way to do it. It's supposed to be possible to do this by writing to one of the files in /sys/class/backlight but that doesn't work. Vbetool is a horrible hack, and it stopped working in the 4.3 kernel. My x40 runs unattended, is always on, and has an old-fashioned fluorescent backlight, so I need to be able to turn off the backlight. I run a 4.1 kernel so I can use vbetool.

Linux/Ubuntu quirks

As of 12.04 (precise), Ubuntu will no longer install on a non-pae i386 cpu like the Pentium M in the x40, because the install CD has a pae kernel on it. This makes no sense. You don't need pae to install, and after installation you have a non-pae kernel. The solution is to get the non-pae kernel and initrd, from here:

cd /mnt/install/netboot/ubuntu-installer/i386
http://www.us.archive.ubuntu.com/ubuntu/dists/precise/main/installer-i386/current/images/netboot/non-pae/ubuntu-installer/i386/

The install CD does a network install instead of using the packages on the CD. This is apparently by design and is a result of the unetbootin conversion. There must be a better way than downloading a 700MB image then only using 30MB of it, but I haven't figured this one out yet.

If you set DISPLAY to :0 and run emacsclient you'll get strange focus bugs. Set it to :0.0 instead.

Sound won't work? run alsamixer: unmute "master" and "pcm", mute "headphone jack sense" and "line"
Also make sure you're in the "audio" group and restart alsa-utils. Installing the oss-compat package seems to help too.

See ibm-acpi at sourceforge to enable hotkeys, control LEDs, etc.

If firefox crashes on youtube, try setenv XLIB_SKIP_ARGB_VISUALS 1. If running the default Ubuntu gnome desktop you may also need to set system->prefs->appearance->visual effects->none.

Old linux quirks that seem to be fixed

The "forward" and "back" buttons are missing in Firefox. Everything else is fully functional. Turns out you have to install gnome-icon-theme package, installed size 13MB, to get those two icons. The rest of firefox is only 9.4MB.

xpdf is broken again, just like in lucid. The problem seems to be a change in the libpoppler api between the time xpdf was built and when it was released. See Bug #669211. I fixed it by building from source at foolabs.com/xpdf/download.html (get the patches too).

apt-get install libfreetype6-dev lesstif2-dev
./configure --with-t1-library=no --with-freetype2-includes=/usr/include/freetype2 CXXFLAGS=-Wno-write-strings
make xpdf

2.6.38 kernel does not work with pci devices that connect via pcmcia, like my Orinoco wireless card (see below). The pm-suspend process gets a fault in kref_get at resume, followed eventually by an inability to launch any processes. This is unlikely to be a problem for most users. I have a patch. Fixed in later kernels?

The stock Maverick kernel doesn't work for me. Every few seconds it locks up for half a second or so. A kernel I built from source is fine.

VirtualBox 3.2.8 on maverick just crashes for me. I removed it and installed 3.2.10 instead, and it seems to be fine.

Kernels later than about 2.6.30 installed on Ubuntu 9.04 require the nomodeset kernel option due to kernel mode setting (KMS). The kernel that comes with 10.04 lucid is completely broken. See for example Bug #574854. I'm using kernel 2.6.32.10+drm33.1, which seems to be the latest one that works. Oddly enough, starting with Ubuntu 10.04 (lucid), the 2.6.32 kernel requires KMS but has it blacklisted. The fix is to re-enable it:
echo "options i915 modeset=1" >/etc/modprobe.d/i915-kms.conf; update-initramfs -u

Kernels later than 2.6.32-18 have a bug that makes the screen brightness go to its lowest setting. See Kubuntu discussion. This seems to have been fixed around 2.6.34.

Suspend doesn't work with the Ubuntu 8.10 2.6.27 kernel. The Ubuntu 8.04 2.6.24 and Ubuntu 9.04 2.6.28 kernels both seem to be ok.

In /etc/acpi/resume.d/72-acpi-pain.sh, comment out the two "modprobe acpi_sbs" lines.

/etc/default/acpi-support: DOUBLE_CONSOLE_SWITCH=true

If xorg segfaults on resume, see PPA for Intel graphics driver testing and load the backports Intel graphics drivers.

Intel 855GM graphics chip

The Intel 855GM graphics chip is no longer well supported in linux, xorg, or Ubuntu. There used to be a working driver, but it was removed after kernel 2.6.31. Your choices now are the vesa driver, which works ok but doesn't support high resolutions, external monitors, acceleration, or any other advanced features. Or fbdev driver (default), which crashes frequently, or the new intel driver, which crashes frequently. Or take your chances with the latest developer's version of the intel driver. Sometimes it works, usually it doesn't. The problem I'm having most frequently is failure to resume after suspend. You can fetch it from the ppa:
add-apt-repository ppa:glasen/intel-driver

The solution is to use the vesa driver, but in Ubuntu 12.04 (precise) this doesn't work because the kernel device is already bound to some other module. This should be easy to fix.

More info:
[855GM] gtt chipset flush is not cache coherent
Lucidi8xxFreezes
Mavericki8xxStatus
Intel Driver 2.13git
Intel 855GM Woes
GPU hang when an application tries to use XVideo
Backport of the old, working ("legacy") driver

Solid State Disk

My disk drive started failing in May 2008. It's a Hitachi HTC426030G7AT00. I replaced the disk with a 8GB CF card using an Addonics adapter. (You can get adaptors from Hong Kong on eBay now for $3). The CF is faster, cheaper, quieter, and draws less power than the disk. 8GB is plenty since I don't run anything from Microsoft. You do have to tweak Ubuntu a bit to get decent performance with flash. In 2010 I replaced the 8GB with a 16GB that was noticeably faster, and in 2015 I replaced that with a 32GB.

Disable scrollkeeper:
sudo mv /usr/bin/scrollkeeper-update /usr/bin/scrollkeeper-update-

In firefox you have to disable the disk cache and session store (which worked fine until they broke it in firefox 2.0). Type in "about:config" in the url bar then set browser.cache.disk.enable and browser.sessionstore.enabled to "false".

Linux kernel 2.6.24 puts this "disk" in UDMA/33 mode because it thinks it has a 40 pin cable and can't do any better. There is a patch to fix this. It also seems to be fixed in kernels starting around 2.6.28.

You'll want to remove or rename /etc/acpi/resume.d/90-hdparm.sh.

I was able to reduce my file system usage by half by doing a cli install from the alternate CD and just installing the packages I need.

802.11 Wireless

The BIOS has a whitelist of IBM (Lenovo) branded wireless cards, and the x40 won't boot if you install any other card. On later Thinkpads the only way to fix this is by installing a patched BIOS, but on the x40 (and earlier Thinkpads) it's easy to patch the BIOS in place with the tpwireless command.

I was unable to get the Intel PRO/Wireless 2200BG 802.11 card that came with my x40 to work on OpenBSD. After installing the firmware it almost works, but if I try to change the WEP key the firmware apparently crashes. I tried the iwi_stop() patch from rev 1.67 of if_iwi.c but that didn't help. I tried the 3.0 firmware with the driver from OpenBSD 4.0 in a 3.9 kernel but it doesn't work.

I bought a card based on the Ralink 2560 chip for $18 to replace the useless Intel card. After running tpwireless it seems to work fine with the OpenBSD ral(4) driver. It has a few quirks, which I can live with: The wireless indicator light at the bottom of the lcd screen doesn't work; I lose connectivity in monitor mode; kismet can't see the nework I'm associated with; and sometimes I have to unset the channel number to get it working (ifconfig -chan).

Unfortunately Ralink doesn't work on Ubuntu after 8.10, in spite of it being the one that Ubuntu recommends, because the working ("legacy") driver was removed and replaced with a non-working one. There is rumored to be a working driver available but so far I've been unable to get it to build in the jaunty kernel. More detail in ubuntu forums 373338.

I gave up on the Ralink and bought an Atheros with the AR5213A chip on eBay for $15. Promiscuous and ad-hoc modes seem to be broken. I got ad-hoc to work by upgrading to the Ubuntu version of the 2.6.30 kernel, but it's got other problems, in particular the ath5k driver has to be reloaded each time the interface is configured. The Atheros driver doesn't work in the 2.6.31 kernel. I switched to the 2.6.32 kernel. More detail in lkml/2009/9/24/72 and kernel bug 14267.

In March 2010 the Atheros started going flakey and I replaced it with a Orinoco I found on eBay for $6. It works ok after installing firmware (agere_sta_fw.bin), but is slow, around 3 Mbps. It takes an extra 12 seconds to resume from sleep mode while the firmware reloads. This was fixed in Ubuntu 10.04, but scanning broke, then was fixed in Ubuntu 10.10. Kernels after 2.6.32 don't work with this card in the x40 because of the peculiar way the device is attached via the pcmcia bus. On resume after suspend dpm_complete() sometimes gets confused about the device kref count and panics.

After a year of working around the Orinoco problems with various kernel patches I got sick of this and went back to the original Intel 2200BG, which works well on linux.

Battery

In June 2009 my battery was down to less than half its original capacity, and I replaced it with a $35 third party battery I found on Amazon. That battery quit after a few months. I attempted a cell transplant from the failed pack to the original IBM pack but that didn't work, possibly due to clumsiness on my part. To open the pack, use a knife to open up the seam in the ridge at the upper rear edge then pry the two halves apart. There are four cells with a connection to each plus a temperature sensor. The bumpout where the connector is has the circuit board inside it.

In 2015 I replaced the battery again, but since these are all new old stock by now, it didn't last long. I now go without a battery and use a UPS.

Linux Kernel Config

tpx40.config and dmesg
There isn't really any good reason to build a special kernel but here is the config I use.

OpenBSD 4.3 Patches

nfs-port
Don't insist on a reserved port for nfs mounts.

nfs
Become root in nfs_connect. Needed for tcp mounts against Netapp (for example).

ukbd
Fix the keysym for the Backspace key on usb keyboards (see wscons above).

vfs
Don't panic on dangling inodes. Only needed for afs. Possibly dangerous, not recommended.

wdc
After boot, always use 10 second timeout in wdcwait(). Try this if your disk fails to work after having been spun down.

OpenBSD 4.3 Configuration Files

kernel config (dmassaged) and dmesg

OpenBSD 4.1 Configuration Files

kernel config (dmassaged) and dmesg
xorg.conf

OpenBSD 4.0 Configuration Files

kernel config (dmassaged) and dmesg

OpenBSD 3.9 Configuration Files

kernel config (dmassaged) and dmesg
XF86Config

Jim Rees