Jens Krämer

Running Ubuntu on an IBM T42

Update (2006-07-31)

My T42 is running Dapper Drake now. Upgrading via apt-get went fine. The biggest improvement I noticed so far: Hibernation is way faster now.

Another configuration change I made a while ago: I now use the ATI fglrx drivers (they finally support Hibernation), and they allow me to use the DVI port of my Port Replicator.

Update (2005-11-01)

Updated the osd section again, this time there’s a more elegant and (maybe?) final solution to the osd problem:

Now there is a script to write the name of the user owning the X server out to /tmp. The osd script then uses this information for doing su - to this user account, in order to be allowed to write to his X display. So no hardcoded username anymore :-)

Update (2005-10-27)

I just upgraded to Ubuntu 5.10 (Breezy Badger). No problems so far, works like a charm. I also updated the OSD/ACPI section with information about TPB. Further a solution to the problem of osd messages only showing up after restarting acpid right after booting was added.

Overview

Linux On Laptops
TuxMobil - Linux on Laptops, Notebooks, PDAs and Mobile Phones

The T42 is a 2373M1G: - 1.8 GHz Pentium M 745 - 1GB RAM (upgraded from 512 MB after purchase) - 80GB 5400rpm HDD - 14.1 SXGA+(1400x1050) TFT LCD, 64MB ATI Radeon 9600 - 24x24x24x/8x CD-RW/DVD - IBM 802.11a/b/g wireless(MPCI), Bluetooth, Infrared port - Modem, 1Gb Ethernet port, Fingerprint Reader

WinXP Pro was pre-installed on the system. I didn’t try out the IRDA port, and the modem is only supported by non-free drivers. Besides these, everything worked out of the box or with very little configuration. I’m running the standard ubuntu 686 kernel: 2.6.10-5-686.

Installation

Worked like a charm. Just boot from the Ubuntu CD (I used the 5.04 ‘Hoary Hedgehog’ release), answer some questions, reboot from disk when asked to do so and wait for the install to finish. Just pay attention to the partitioning and grub installation if you intend to keep the Windows XP and/or IBM rescue partitions.

Partitioning

The great thing about the Ubuntu installer is that it is able to resize NTFS partitions. Just choose the manual partitioning option, select the XP partition and change it’s size. The partition should not be fragmented as this may cause problems during resizing. Doesn’t hurt to run the XP drive defragmentation tool before shrinking the partition this way.

The 80GB disk of my T42 had two partitions on it: - Windows XP taking up around 75 GB - 5GB IBM Rescue system you can boot into by pressing the blue Access IBM key during startup. Interesting thing, seems to contain a complete OS including Opera browser, somehow looks like Win 3.11 or 95.

As the disk is large enough, I decided to keep both systems. I changed the size of the windows partition to around 20 GB and created my new partitions in the now free space between xp and ibm rescue partition:

    Disk /dev/hda: 80.0 GB, 80026361856 bytes
    16 heads, 63 sectors/track, 155061 cylinders
    Units = cylinders of 1008 * 512 = 516096 bytes

       Device Boot      Start         End      Blocks   Id  System
    /dev/hda1   *           1       38760    19535008+   7  HPFS/NTFS
    /dev/hda2          145411      155055     4861080   12  Compaq diagnostics
    /dev/hda3           38761       43127     2200905   82  Linux swap / Solaris
    /dev/hda4           43127      145398    51544552+   5  Extended
    /dev/hda5           43127       81887    19535008+  83  Linux
    /dev/hda6           81887      145398    32009481   83  Linux

hda5 will become the root fs, hda6 my /home partition.

Grub installation

I told the Ubuntu installer to install Grub into the MBR. The following entries in /boot/grub/menu.lst allow to boot Windows and the IBM rescue system:

    # IBM rescue partition on /dev/hda2
    title           IBM Rescue
    root            (hd0,1)
    # savedefault
    makeactive
    chainloader     +1

    # Win XP on /dev/hda1   
    title           Microsoft Windows XP Professional
    root            (hd0,0)
    savedefault
    makeactive
    chainloader     +1

I don’t remember if the installer added those automatically, or if I did so, anymore. Just make sure they are there.

Check if everything works

You should now be able to boot into all three systems without problems.

Networking

Wireless LAN

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

Well supported as expected, I use it with my WPA setup with the following entry in /etc/network/interfaces:

    mapping hotplug
    script grep
    map ath0
    iface ath0 inet dhcp
    pre-up /usr/sbin/wpa_supplicant -B -w -i ath0 -Dmadwifi -c /etc/wpa_supplicant.conf
    post-down pkill -f "wpa_supplicant" || true

wpa_supplicant.conf is just the same as described there.

Built-in soft modem

    0000:00:1f.6 Modem: Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Modem Controller (rev 01)

This modem is supported by the Linuxant HSF drivers. They offer a free (as in beer) version limited to 14kBps, the upgrade to full speed and fax functionality costs $14,95. Not nice but better than not being able to use the modem at all. At least, the installation of the drivers works without problems. Just download the deb archive and install it. You need to have the linux-headers package matching your running kernel installed.

The deb also contains an init script for loading/unloading the driver modules. This comes in handy as it turns out that the modules need to be removed before going into suspend modes. Add hsf (the name of the init script) to the list of services to be stopped before suspend in /etc/default/acpi-support:

    STOP_SERVICES="mysql hsf "

Bluetooth

Can be turned on by doing

    echo enable > /proc/acpi/ibm/bluetooth

as root. See the ACPI section below for how to toggle bluetooth via a hotkey.

X11 Config

I use the radeon driver which is part of x.org. I never tried to install the ATI drivers, don’t intend to play Q3A on this machine and already had my bad experiences with crappy ATI linux drivers on another machine…

Below you find three different configurations for one single and two multiscreen setups.

Standard

Notebook LCD only.

Xinerama

Notebook LCD to the left, CRT monitor to the right, forming one big desktop.

Enabling FVWM Xinerama support

To make FVWM know about Xinerama, it has to be rebuilt from source with Xinerama development files installed. This will give you an FVWM that knows where one monitor ends and the other begins. This knowledge is needed to avoid the annoying placment of windows exactly on the borders of screens.

    apt-get source fvwm
    apt-get install libxinerama-dev
    cd fvwm-x.y.z
    fakeroot dpkg-buildpackage
    sudo dpkg -i fvwm-gnome*.deb

Dual Screen

This is what I use now. No movement of windows between screens (except applications like The Gimp which explicitly allow ‘Send to Screen’ via their own menus), but separated FVWM instances and the ability to assign a different background to each screen. I never managed to find backgrounds fitting the whole Xinerama width, anyway ;-)

Last, but not least, not need to recompile FVWM on every update…

Suspend to RAM and suspend to disk (hibernation)

Suspend to RAM worked out of the box. For hibernation the partition which should be used to store the system state while it is turned off has to be entered as a kernel parameter in /boot/grub/menu.lst:

    ### BEGIN AUTOMAGIC KERNELS LIST
    ## lines between the AUTOMAGIC KERNELS LIST markers will be modified
    ## by the debian update-grub script except for the default optons below

    ## DO NOT UNCOMMENT THEM, Just edit them to your needs
    ## ## Start Default Options ##
    ## default kernel options
    ## default kernel options for automagic boot options
    ## If you want special options for specifiv kernels use kopt_x_y_z
    ## where x.y.z is kernel version. Minor versions can be omitted.
    ## e.g. kopt=root=/dev/hda1 ro
    # kopt=root=/dev/hda5 resume=/dev/hda3 ro

The relevant piece here is the resume parameter, which names my swap partition as the place where hibernation information is stored. Run update-grub after changing the file. Now suspend to disk needs to be enabled in /etc/default/acpi-support:

    ACPI_HIBERNATE=true

After restarting the system, pressing Fn-F12 should send the machine into suspend to disk mode. It can be brought back to life as usual by pressing the power on key.

Various other things

Output of lspci

    0000:00:00.0 Host bridge: Intel Corp. 82855PM Processor to I/O Controller (rev 03)
    0000:00:01.0 PCI bridge: Intel Corp. 82855PM Processor to AGP Controller (rev 03)
    0000:00:1d.0 USB Controller: Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 01)
    0000:00:1d.1 USB Controller: Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 01)
    0000:00:1d.2 USB Controller: Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 01)
    0000:00:1d.7 USB Controller: Intel Corp. 82801DB/DBM (ICH4/ICH4-M) USB 2.0 EHCI Controller (rev 01)
    0000:00:1e.0 PCI bridge: Intel Corp. 82801 PCI Bridge (rev 81)
    0000:00:1f.0 ISA bridge: Intel Corp. 82801DBM LPC Interface Controller (rev 01)
    0000:00:1f.1 IDE interface: Intel Corp. 82801DBM (ICH4) Ultra ATA Storage Controller (rev 01)
    0000:00:1f.3 SMBus: Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller (rev 01)
    0000:00:1f.5 Multimedia audio controller: Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller (rev 01)
    0000:00:1f.6 Modem: Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Modem Controller (rev 01)
    0000:01:00.0 VGA compatible controller: ATI Technologies Inc RV350 [Mobility Radeon 9600 M10]
    0000:02:00.0 CardBus bridge: Texas Instruments PCI4520 PC card Cardbus Controller (rev 01)
    0000:02:00.1 CardBus bridge: Texas Instruments PCI4520 PC card Cardbus Controller (rev 01)
    0000:02:01.0 Ethernet controller: Intel Corp. 82540EP Gigabit Ethernet Controller (Mobile) (rev 03)
    0000:02:02.0 Ethernet controller: Atheros Communications, Inc. AR5212 802.11abg NIC (rev 01)

On Screen Display

    sudo apt-get install tpb

TPB mainly gives you the advantage of being able to map the various ThinkPad specific buttons to custom actions. Besides this, it features a neat OSD display e.g. on volume and brightness changes through those buttons. Note that volume changing, muting, setting display brightness and toggling the ThinkLight work fine without tpb, it just adds OSD to these functions. To enable TPB, change the value of START_TPB in /etc/default/tpb to true.

Please note that I first tried out TPB after upgrading to Breezy. The Hoary version doesn’t seem to support OSD, but there exists a workaround.

    sudo apt-get install xosd-bin

This gives you the osd_cat command which can be used to display arbitrary content on the display. This makes a nice supplement to TPB for actions triggered by Fn-F[1..12]. I use it to display status messages when turning on/off WLAN and bluetooth. See below for how to do this.

ACPI features and IBM specific buttons

As mentioned above, changing display brightness, volume and toggling the ThinkLight work out of the box. Btw, the ThinkLight is one of those little things which make this notebook worth it’s money :-)

The Fn-F1..F12 keys all generate ACPI events whose processing is controlled by the scripts in /etc/acpi and /etc/acpi/events (which you get by installing the acpi-support package). The scripts in events are each mapped to a specific button, e.g. ibm-sleepbtn for the Fn-F4 key:

    event=ibm/hotkey HKEY 00000080 00001004
    action=/etc/acpi/sleep.sh

The event line defines the key this script belongs to, and action names the script to be executed when the event occurs. So in this case, when the user presses Fn-F4 the machine is suspended to RAM.

So it is easy to add new mappings for the unused function keys, or to customize the behaviour of the already configured ones. I added a new mapping for Fn-F6 to toggle bluetooth:

As you can see in the bluetooth script, I factored out the osd stuff into it’s own file, to be sourced wherever it is needed. To make this script work for you, install the xosd-bin package (see above). You will also need to put the script named Default into /etc/gdm/PostLogin/. This will write your username to the file /tmp/X_user_for_osd once you log in through gdm. The osd script uses this information to switch to this username to be able to write to your X display.

The -d parameter in the call to osd_cat determines the time in seconds a message will be displayed, the -p and -A parameters tell osd_cat where to put the message on the screen. See the osd_cat manpage for more information.

In case a newly mapped hot key isn’t recognized, try the following command as root:

    echo 0xffff > /proc/acpi/ibm/hotkey

According to the docs this enables all possible hot keys. To make this change permanent, edit the file /etc/modprobe.d/ibm_acpi.modprobe and make it look like this:

    options ibm_acpi hotkey=enable,0xffff

Fingerprint sensor

If you kept your XP partition, you can use the IBM tools to learn your fingerprint and assign it in addition to a system or harddisk password. You can always access the system using the password instead of the fingerprint, so no need to worry if you once loose that important fingertip ;-)

Didn’t try to protect the harddisk with this yet, as this seems to be pretty low level and everybody warns you that there will be no recovery from a lost password.

The whole fingerprint checking at boot time then is OS independent, seems to be part of the bios. The interesting point is, that IBM’s XP software somehow gets access to the fingerprint read by the bios, using it to auto-log in the user identified by this fingerprint. Pretty nice solution, anybody to write a PAM module doing the same ? That would be neat :-)

Update: According to this article, this wish seems to become reality soon…

Update (2005-11-10): Somebody has written instructions on how to get the fingerprint reader of his T43 to work with Ubuntu. Didn’t have the time to try it, but I soon will.