Installing Linux On An IBM/Lenovo ThinkPad R52

From Strugglers
Jump to: navigation, search

These are some notes from what I've discovered installing Linux, and in particular Ubuntu 5.10 "Breezy", onto an IBM/Lenovo ThinkPad R52.

I can be contacted by email at

Pre-Installation Steps

These are a few things that I decided to do prior to installing Linux onto the notebook.

Created Rescue & Recovery Discs

In Windows there is a program to create the recovery discs:

Start -> All Programs -> Access IBM -> Create Recovery Discs

It prompts you to put blank/erasable discs in the drive; I used two DVDs though I now believe that the first disc may only need to be a CD rather than a DVD.

After you've created one set of discs it wont let you create any more sets.

Created Rescue Media

There is another program for creating "Recovery Media" accessible from the start menu:

Start -> All Programs -> Access IBM -> Create Rescue Media

I believe this just creates the same thing as the first CD in the above step though so shouldn't be required.

Updated Firmware

I checked Lenovo's website to see if any of the firmware needed updating. I updated the BIOS (from version 1.18 to 1.22), everything else seemed to be up to date for me.

I noticed that most of the firmware updates are available as bootable CD images and things so it shouldn't be a problem to update firmware in future even with no Windows on the machine.

Installed Additional Memory Module

I'd purchased an additional 512MB memory module from Crucial, so I put that in and checked that it was visible by the BIOS and Windows before installing Ubuntu.

Ubuntu Installation

I actually wanted a Kubuntu installation (using KDE rather than the default GNOME of Ubuntu), but I had an Ubuntu CD lying around so I decided to do that and add the Kubuntu bits afterwards. So I used a regular Ubuntu 5.10 "Breezy" installation CD and didn't use any special parameters at the boot prompt (I did try using "expert" mode first, but that just left me with all sorts of problems once it was installed, so I went back and installed it using the default installation mode).

Disk Partitioning

I used the manual patitioning mode when it got to that part of the installer. There were two partitions, one taking most of the disk for the main Windows installation and then a second partition of around 3GB for the IBM "Pre-Desktop Area" used for Windows recovery and so on. I deleted the main Windows partition and decided to leave the pre-desktop partition for now. I created one large partition of around 50GB to be the root filesystem (e3fs) and allocated the rest, approx 5GB, as a swap partition.

WiFi During Install

My home WiFi network uses WEP encryption in a "shared-key" system. I entered my WEP key etc in the installer but it failed to connect to my network. I found that I had to change my wireless access point from "shared-key" to "open" in order to get it to connect up. Once I had done that I was able to complete the install using WiFi just fine.

Fetching Updates

Once the Ubuntu installation was complete I made sure all the packages were up to date using APT from a terminal window:

sudo apt-get update; sudo apt-get upgrade

Adding More Repositories

I modified /etc/apt/sources.list to uncomment the 'universe' repository there by giving me access to more software via APT. I uncommented the following lines:

deb breezy universe
deb-src breezy universe

I also added "multiverse" on the end of each one, so they became:

deb breezy universe multiverse
deb-src breezy universe multiverse

and following that I ran the following to update my package list with the newly available software:

sudo apt-get update


Kubuntu & KDE

Now that I'd got a base Ubuntu system, I decided to install the KDE parts to get a Kubuntu system. This is done easily by fetching the kubuntu-desktop package:

sudo apt-get install kubuntu-desktop

I think that during the installation of that package it prompted me to select whether to use the gdm (GNOME based) or kdm (KDE based) login screen. I opted for kdm (though I later changed to gdm as it seems to support the fingerprint scanner better, see later for details).

Upgrading KDE To 3.5.1

Breezy by default uses KDE 3.4.3, but I found that I needed to upgrade this in order to get DVD playback working (details to follow). So, I upgraded to KDE 3.5.1 using info from an Ubuntu forum article. The condensed steps I performed were:

Fetched and added package maintainer's key:

sudo apt-key add kubuntu-packages-jriddell-key.gpg

Added the following line to my /etc/apt/sources.list to add the repository:

deb breezy main

Upgraded everything:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

Upgrade Kernel

I say "upgrade", but what I really mean is that I took a build of the same kernel version but built for i686 instead of i386. It may be slightly faster though I doubt I'll really know the difference. The only thing that really pushed me to do it was the availability of a packaged 56k modem driver for the i686 version of the kernel.

To fetch and install the kernel I did:

sudo apt-get install linux-image-2.6.12-10-686

Once that had been completed I rebooted to run the newly installed kernel. Note that the kernel that was replaced will still be listed in the grub bootloader menu so you can still get to that one too if needed.

Power Management

Suspend To RAM

This seems to mostly work right from the default Ubuntu installation. I can hit Fn+F4 on the keyboard and the machine will suspend to RAM. I can then wake it up by pressing the power button, or alternatively if the lid is closed then opening it resumes.

I say that it mostly works for I've seen a couple of issues:

  • On one occasion it did not resume correctly, instead I was left with a blank screen.
  • On one other occasion the machine resumed correctly but then immediately shut down (using the normal shutdown procedure).
  • Sometimes the Fn+F4 button combination doesn't work and I have to use a software method instead (eg. from the KLaptop applet on the Kicker).

There are also some other things I'd like to get working right with it:

  • When suspending to RAM using Fn+F4 the machine suspends, but when it resumes you are not prompted for any password it just lets you right in. If you suspend from software, eg. the KLaptop applet, then it does prompt you for password.
  • I would like the ThinkPad to suspend to RAM if I close the lid, but I haven't found a way to do that yet.

Suspend To Disk / Hibernate

With the default Ubuntu installation this didn't work. The suspend to disk seemed to work, but when I tried to resume it would leave me with a blank screen.

The solution (workaround) to this has been to make some changes to the grub bootloader. I removed the kernel parameter "splash" from all the kernel lines in /boot/grub/menus.lst so changing them from lines like this:

kernel          /boot/vmlinuz-2.6.12-10-386 root=/dev/sda1 ro quiet splash

to lines like this:

kernel          /boot/vmlinuz-2.6.12-10-386 root=/dev/sda1 ro quiet

After editing that file I needed to reinstall the grub bootloader using the following command:

sudo grub-install /dev/sda

Once I'd done that resume from hibernate has worked fine for me. Like with suspend to RAM sometimes the Fn+F12 key combination doesn't work and you have to use the software method instead and also like with suspend to RAM using the Fn+F12 combination means that you don't get prompted for a password on resume.

Special Buttons & On Screen Display (OSD)

This model contains a few special buttons such as:

  • Volume Up & Volume Down
  • Mute
  • Access IBM

By default the volume and mute button work fine, though there is no on screen feedback when you press them. The "Access IBM" button doesn't do anything by default.

To enable configuration of the above buttons and enable on screen feedback I fistly ran the following command:

sudo chmod 644 /dev/nvram

With that done I brought up KDE's "Laptops & Power" section within System Settings and selected the "IBM Thinkpad Laptop" page. In there I selected the "Run Thinkpad Buttons KMilo plugin" and disabled the "Change volume in software" option. You can set a command for the "Thinkpad" button in there too. The other buttons don't exist on this laptop apart from the Fn+Zoom button which can also be set.

Once that had been done I then had to go to the "KDE Components" section of System Settings and from the "Service Manager" page I was able to select KMilo, stop the service and start it again.

After all that I could use the volume buttons etc as before but now with some on screen feedback and the commands I'd set for the Access IBM button etc worked.

DVD Video Playback

It took a bit of messing around to get this to work, so I'm not certain if all the steps here are required, but at least having done them all I seem to have a working setup. There are a few movie players already installed with the Kubuntu system and I messed around with some of them, the best success so far has been with Kaffeine which is what I'll detail here.

I had to upgrade KDE to 3.5.1 in order to get this working (see above section on Kubuntu & KDE for steps).

I installed the "regionset" package (available from APT if you have enabled the "universe" repository) and used that to set the region code in the DVD drive's firmware to region 2 (I'm in the UK so that's what most of my DVDs are) by running:

sudo regionset

and answering the prompts.

Note: You can only set the region code in the DVD drive firmware a number of times (5 I think) so take care.

I installed the libdvdcss library for viewing DVDs in other regions. I fetched a Debian package containing libdvdcss and installed that:

sudo dpkg -i libdvdcss2-dev_1.2.9-1_i386.deb

Now for Kaffeine. By default in Ubuntu Kaffeine uses GStreamer for the backend DVD playback but I didn't have any success with that. I installed the package kaffeine-xine to get the Xine backend and enabled it from within Kaffeine using the menu: Settings -> Player Engine -> Kaffeine (it doesn't actually say Xine, but it's the non-GStreamer one).

Now I was able to insert a DVD and play it using Kaffeine.


A fair amount of the bluetooth stuff works right out of the box. In KDE at least I get a popup if someone tries to send me a file via bluetooth etc.

If the LED for bluetooth is off, bluetooth is disabled and can be activated with:

sudo bash -c "echo enable > /proc/acpi/ibm/bluetooth"

First thing I did was to set the bluetooth PIN so that other people can't pair with my machine using the default PIN (1234). The PIN is set in /etc/bluetooth/pin. I also changed the bluetooth name to something more friendly by editing the name line in /etc/bluetooth/hcid.conf.

After setting those I restarted bluez by running:

sudo /etc/init.d/bluez-utils restart

Once I'd done that I was able to use my bluetooth phone to pair with my ThinkPad and was prompted for the PIN I'd just set.


In order to get a GPRS connection via bluetooth to my mobile phone, the first thing I did was to edit /etc/bluetooth/rfcomm.conf in order to tell the ThinkPad about by phone. The file is short and there is a commented out example configuration in there so I just uncommented it and substituted in the relevant values for my phone. By running the following command I was able to find out the bluetooth address of my phone and the channel that DUN (Dialup Networking) was running on:

sdptool search DUN

Once I'd done that I restarted bluez again:

sudo /etc/init.d/bluez-utils restart

And now I had a new device called /dev/rfcomm0.

Once I'd done all that I used the KDE app KPPP, listed as "Internet Dial-Up Tool" on the KDE menu, to create the connection to my phone/provider. This will of course be different depending on your phone and provider, but basically in KPPP I created a new modem with the device /dev/rfcomm0 and connection speed of 115200. I created a new account for my mobile provider (O2 in the UK) and set the phone number to *99# (I believe that several providers use this same number for GPRS access, but YMMV).

There was one other change that I found I needed to make. To begin with I couldn't get it to complete the connection as it was requiring the remote end to authenticate which it seems it wasn't doing. I edited the file /etc/ppp/options and changed the line which said "auth" to "noauth" instead. I'm not really sure if it's a good idea or not, but it's the only way I've been able to make it work so far.

With the above all done clicking "Connect" in KPPP now makes a succesful connection.

Build Environment

I needed some build tools in order to get the fingerprint reader working so I installed the following packages:

sudo apt-get install gcc libc-dev g++ make

Fingerprint Reader

Not all the R52 sub-models have a fingerprint reader it seems, but mine (sub-model 1846AQG) has one.

I fetched and installed bioapi system, which is packaged as a Debian unstable package, but it installed on Ubunut just fine:

sudo dpkg -i bioapi_1.2.3_i386.deb

It moaned about not being able to find /usr/lib/, but this seems not to be fatal.

Next, I fetched and installed the UPEK driver for the fingerprint reader:

chmod a+x
sudo ./ /usr/lib

I now built the "sample" tool that comes with the UPEK driver. Firstly I changed to the directory containing that within where I'd unziped the UPEK driver:

cd NonGUI_Sample

And in there did the following:

gcc -o sample main.c -lbioapi100 -DUNIX -DLITTLE_ENDIAN

Note: For this to work I needed to have installed the development tools as mentioned in the previous section above.

Now I could run the sample tool:

sudo ./sample

In the tool I pressed "e" to enroll a fingerprint (you should give the name for the fingerprint the same name as your user account, so in my case "matt"). I then used "v" to verify the fingerprint and then I quit. Once you quit you should find that a .bir file has been created, in my case matt.bir.

I now worked on integrating this with PAM. Firstly a number of steps to get the PAM bioapi system patched with fingerprint support and built:

sudo apt-get install libpam0g-dev
tar jxvf pam_bioapi-latest.tar.bz2
cd pam_bioapi-*
patch -p0 < fingerprint.patch
sudo make install
sudo cp /usr/local/lib/security/* /lib/security

And then some steps to get my fingerprint to the right place:

SERIAL=`BioAPITest | sed -ne "/Fingerprint/{n;n;s/^.*: \(.\{9\}\)\(.\{4\}\)\(.\{4\}\)\(.\{4\}\)\(.*\)/\1-\2-\3-\4-\5/gp}"`
mkdir -p /etc/bioapi/pam/$SERIAL
cp matt.bir /etc/bioapi/pam/$SERIAL

Where "matt.bir" should obviously replaced with whatever the file is that you created with the sample tool above.

The final step was to modify /etc/pam.d/common-auth to call the bioapi stuff. I edited mine so that it contained the following lines:

auth       sufficient {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/
password   sufficient {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/
auth       required nullok_secure

With all the above done it was time to reboot. On reboot the kdm login screen started and then I was able to do the following:

  1. Enter username
  2. Hit return in the password box as though a blank password
  3. Now scan finger, multiple times if necessary, there is no visual feedback

Once it read my finger it let me in.

This seemed a little clunky to me though as there is no visual indication of what is going on and no way to enter a password instead if you can't scan your finger for whatever reason. So then I tried gdm instead of kdm and it does seem to have better support. In gdm, after you enter your username you get a GUI asking you to scan your finger, and if that fails 3 times then it prompts for password instead. Much better in my opinion so I've switched my default login screen to gdm for now.

SSH Logins

It's a bit annoying when using SSH to the machine from elsewhere that you have to go up to the machine and scan your fingerprint for it to let you login! So I modified /etc/pam.d/ssh to remove this line:

@include common-auth

and replaced it with the contents of my original common-auth file:

auth    required nullok_secure


I found that with the above fingerprint setup there were a few issues surrounding sudo functionality such as:

  • If I was logged in remotely via ssh and then ran something as sudo, it would expect me to scan my fingerprint.
  • Certain tools within KDE that used the "run as administrator" type modes would not behave right. Some would just hang when I tried to start them (perhaps waiting for a fingerprint scan? but scanning one didn't seem to help), others would work fine as long as I scanned my finger when it presented the password box.

I found that by disabling fingerprint access to sudo the same as I did for ssh above made a lot of these issues go away. I modified /etc/pam.d/sudo and again removed the line:

@include common-auth

and replaced it with the contents of my original common-auth file:

auth    required nullok_secure


  • I have this working at the login screen, but if I lock the screen then I can only get back in using password.


Internal 56k Modem

The modem in this machine uses a Conexant chipset and unfortunately there don't seem to be any open source drivers that work with it. There is however a binary driver available from a company called Linuxant which can be downloaded and used for free though limited to 14.4k. Buying a license from the for $19.99 enables the modem to be used upto its full speed and is also required to access the fax capabilities of the modem.

When I looked on Linuxant's site I found that there were Ubuntu packages available for the modem driver, but these required me to run an i686 build of the kernel instead of the i386 build I was currently using. Therefore I upgraded the kernel as described earlier in this article.

Next I fetched and installed the Linuxant driver:

sudo dpkg -i hsfmodem_7.43.00.01full_k2.6.12_10_686_ubuntu_i386.deb

You get prompted for a few things like your email address and your license key if you've purchased one (I just left it as the default of FREE to get the 14.4k functionality for now).

With the driver installed I fired up KPPP to test it. The driver maps the modem as /dev/modem so it's a simple case of creating a modem in KPPP with all default settings. I created an account with the settings for my ISP dialup account and was able to connect fine (though 14.4k feels a bit slow these days!).

Fixing Suspend/Hibernate Issues

Unfortunately the Linuxant drivers prevent the ThinkPad from going into suspend or hibernate states. If you try it you will see that the machine starts to suspend, but never actually stops, and then returns back to fully functioning again (perhaps with a locked screen). I had to modify the suspend,hibernate and resume scripts in order to unload the Linuxant drivers when the machine is sleeping/hibernating and then reload them when the machine resumes.

I edited /etc/acpi/ and found this line:

echo -n $ACPI_SLEEP_MODE >/sys/power/state

Just before that line I added this line:

/etc/init.d/hfs stop

I edited /etc/acpi/ and found this line:

echo -n $HIBERNATE_MODE >/sys/power/disk

Just before that line I added the same line as I did in

/etc/init.d/hfs stop

Finally, I edited /etc/acpi/ to reload the drivers on resume. I found this line at the end of the file:

(sleep 5 && rm /var/lock/acpisleep)&

Just before that line I added this line:

/etc/init.d/hfs start

Following these changes suspend & hibernate both worked again, resumed fine and I was then able to use the modem again following the resume.

Adding License

I decided to purchase the license from Linuxant to unlock the full features of the modem. The purchasing process on Linuxant's website requires you to enter the "Registration ID" of your modem (I guess generated from some serial number in the hardware or whatever) in order to generate the license key. The registration ID can be obtained by the following command:

sudo hsfconfig --info

Once I'd purchased the license key I was able to set that by doing:

sudo hsfconfig --license

and following the prompts.


  • I haven't managed to get the fax functionality working yet.