Difference between revisions of "Installing Linux On An IBM/Lenovo ThinkPad R52"

From Strugglers
Jump to: navigation, search
(bluetooth setup info)
(fingerprint reader)
Line 256: Line 256:
  
 
With the above all done clicking "Connect" in KPPP now makes a succesful connection.
 
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:
 +
 +
wget http://www.qrivy.net/~michael/temp/bioapi_1.2.3_i386.deb
 +
sudo dpkg -i bioapi_1.2.3_i386.deb
 +
 +
It moaned about not being able to find /usr/lib/libqtpwbsp.so, but this seems not
 +
to be fatal.
 +
 +
Next, I fetched and installed the UPEK driver for the fingerprint reader:
 +
 +
wget http://www.upek.com/support/download/TFMESS_BSP_LIN_1.0.zip
 +
unzip TFMESS_BSP_LIN_1.0.zip
 +
chmod a+x install.sh
 +
sudo ./install.sh /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
 +
wget http://www.qrivy.net/~michael/blua/pam_bioapi/pam_bioapi-latest.tar.bz2
 +
tar jxvf pam_bioapi-latest.tar.bz2
 +
cd pam_bioapi-*
 +
wget http://badcode.de/downloads/fingerprint.patch
 +
patch -p0 < fingerprint.patch
 +
./configure
 +
make
 +
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  pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/
 +
password  sufficient  pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/
 +
auth      required    pam_unix.so 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:
 +
 +
# Enter username
 +
# Hit return in the password box as though a blank password
 +
# 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.
 +
 +
===Issues===
 +
 +
* I have this working at the login screen, but if I lock the screen then I can only get back in using password.

Revision as of 00:30, 10 March 2006

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

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 http://gb.archive.ubuntu.com/ubuntu breezy universe
deb-src http://gb.archive.ubuntu.com/ubuntu breezy universe

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.

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:

wget http://people.ubuntu.com/~jriddell/kubuntu-packages-jriddell-key.gpg
sudo apt-key add kubuntu-packages-jriddell-key.gpg

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

deb http://kubuntu.org/packages/kde351 breezy main

Upgraded everything:

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

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.

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:

wget http://download.videolan.org/pub/libdvdcss/1.2.9/deb/libdvdcss2-dev_1.2.9-1_i386.deb
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.

Bluetooth

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.

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.

Dialup

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:

wget http://www.qrivy.net/~michael/temp/bioapi_1.2.3_i386.deb
sudo dpkg -i bioapi_1.2.3_i386.deb

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

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

wget http://www.upek.com/support/download/TFMESS_BSP_LIN_1.0.zip
unzip TFMESS_BSP_LIN_1.0.zip
chmod a+x install.sh
sudo ./install.sh /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
wget http://www.qrivy.net/~michael/blua/pam_bioapi/pam_bioapi-latest.tar.bz2
tar jxvf pam_bioapi-latest.tar.bz2
cd pam_bioapi-*
wget http://badcode.de/downloads/fingerprint.patch
patch -p0 < fingerprint.patch
./configure
make
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   pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/
password   sufficient   pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/
auth       required     pam_unix.so 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.

Issues

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