Installing Ubuntu (Gutsy Gibbon) 7.10 on a ThinkPad R60

From ThinkWiki
Revision as of 12:28, 13 July 2007 by Dirk (Talk | contribs) (The Upgrade to Gutsy Gibbon)
Jump to: navigation, search

My Thinkpad

Lenovo Thinkpad R60 9461 HRG
Intel Core2Duo (Merom) 1.83 CPU
120 GB SATA Hitachi HTS54161 Harddisk
2 GB RAM
ATI Mobility X1400

Originally equipped with a preinstalled MS Windows Vista Business. So the Harddisk was parted into two Partitions.

1. The Rescue & Recovery Partition

2. The preinstalled Windows Vista Partition

And as the parcel with my new Thinkpad arrived I was surprized, that there was a Windows Vista DVD (only 32 Bit Version) with it. So I tried Vista - but I was a little bit shocked by it's performance. I never thought that a new computer could thake so much time to boot up completely.

I decided to do a clean install of Vista, but I want to have Windows XP and Ubuntu Feisty on the Harddisk too.

New Installation

I wanted to use all Space of the Harddisk, so I decided to kill the Rescue & and Recovery Partition, but to have the chance to go back to the factory default state I ordered Recovery DVD's at the Support Call Center for Germany. They shipped the 3 DVD's to me - free of charge - but I think it's only free if your Thinkpad is still in the warranty. I don't know exactly.

Then I created 2 Partitions on my Harddisk, 64 GB for Vista, 20 GB for XP, so 29 GB left free for Linux.

I installed Vista and XP and all the Thinkpad Stuff for each system.

When this was finished I took a Ubuntu Feisty Fawn installation CD and boot my Notebook with it. I created a 4 GB linux-swap partition and a 25 GB root / partition.

Because I want to boot my Ubuntu with the Windows Vista Boot Loader, I decided to install Grub to /dev/sda4 which is my Linux root partition.

The installation of Ubuntu Feisty Fawn works fine, NO PROBLEMS.

NOW I want to boot Linux from the Vista Bootloader, because I don't want to wait for two Bootscreens, and I wan't to have the chance to access the Repair Console of Windows Vista.

First I have to copy the Bootsector of my Linux Partition with:

sudo dd if=/dev/sda4 of=/tmp/bootsect.lin bs=512 count=1

Copy the bootsect.lin file to a USB-Stick or a writable partition which you can access from Windows Vista.

Now boot Windows Vista and copy the file bootsect.lin to your Systemdrive. In an Command Window with Administrator privileges type:

copy bootsect.lin %SYSTEMDRIVE%\

bcdedit /create /d “Ubuntu” /application BOOTSECTOR

You will receice an ID like this {4cdcfd5b-1f3a-11dc-bb90-0019d2b3e926} from bcdedit. This is a uniqe identifier for your new Boot Entry in the Vista Bootloader. Now you will have to manipulate the entry with the following commands:

bcdedit /set {4cdcfd5b-1f3a-11dc-bb90-0019d2b3e926} device boot
bcdedit /set {4cdcfd5b-1f3a-11dc-bb90-0019d2b3e926}  PATH \bootsect.lin
bcdedit /displayorder {4cdcfd5b-1f3a-11dc-bb90-0019d2b3e926} /addlast
bcdedit /timeout 10

Then I booted my Ubuntu an did :

$ sudo gedit /boot/grub/menu.lst

In this file I canged the entry the following entries:

timeout     2
hiddenmenu

So the computer starts up with the Windows Vista bootloader and gives me the option to start Windows XP, Windows Vista, Ubuntu and I have the option to do the repair tasks with the F8 button on Vista if something fails. If I choose to boot Ubuntu I have the option to press the ESC within the two seconds delay of the hidden Grub Menu. I.E. to boot another Linux Kernel.

The tp_smapi modules

I did it under Feisty and, after the Upgrade under Gutsy, like described here : TP SMAPI in the Section "Installation on Ubuntu/Debian" It worked, hdaps-gl and hdaps-pivot shows me now the movements of my Thinkpad. Like you can see here:


Hdaps-pivot.png

Hdaps-gl.png

The Upgrade to Gutsy Gibbon

NO PROBLEMS. So why should I upgrade ?

OK I really wanted to get hdapsd (Harddisk Active Protection) to work. I tried a lot of things with Feisty, but I didn't get it going. And after a lot of seach through the Internet I found out that Gutsy Gibbon, the next Release of Ubuntu should have the Package for hdapsd on board. SO I decided to upgrade to Gutsy - with the knowledge that it is still in Beta Stadium.

Upgrading Ubuntu is really simple, you only have to do the following steps:

$  sudo gedit /etc/apt/sources.list

Search all feisty entries and change them to gutsy. Save and Close the file.

Do:

$  sudo apt-get update
$  sudo apt-get upgrade

Go and drink a cup of Tea or Coffee. When you are back you have a message, that you should reboot your System, to get all packages active. So do it.

After the reboot I installed the hdapsd package and I tried to activate the Harddisk Protection with:

$  sudo hdapsd -d sda -s 14 -a -v

But I still get the message "open(protect_file): No such file or directory". ---- The Same Message that I get in Feisty before I did the Upgrade. So I banged my head on the table and noticed that I'm not tough enough to get this thing working. Maybe someone else.


I decided to get the other things to work.


UPDATE: After some days I tried to get hdapsd to work, again !

The hdapsd - Deamon (IBM Active Disk Protection)

Because I never had compiled or patched a kernel under Ubuntu I had to find out how this works ! After a lot of search in the Internet, the Ubuntu Help and at Thinkwiki.org I found the (hopefully) correct way to do it.

The best information I found was this : Ubuntu 7.04 on a ThinkPad T43 in section "Disk protection"

Here is what I did to get it to work:


1. Make sure that you have the required packages, with:

$ sudo apt-get install build-essential fakeroot kernel-package libncurses5-dev wget bzip2 linux-source


2. Get the correct kernel patch for your running kernel from here : HDAPS section "8.1.1 Kernel patch (apply using 'patch -p1 -l < hdaps_xx.patch')"


After all my experiences I was not sure that there was a patch available for my Gutsy-kernel (2.6.22-7-generic), but I still had my old kernel on the disk. So I booted up the old one (2.6.20-16-generic). Check the running kernel with:

$ uname -r

You should see something like: 2.6.20-7-generic

Now change to /usr/src and look that the sources for the running kernel are there with:

$ cd /usr/src
$ ls -d linux-source*

You should see a file with the name "linux-source-2.6.20.tar.bz2" wich includes the packed kernel sources. You have to extract it, so do:

$ sudo su
# tar xvfj linux-source-2.6.20.tar.bz2

Now you have the kernel sources in the /usr/src/linux-source-2.6.20 directory. Take a look if there is a link from /usr/src/linux to an other kernel source directory (It's maybe there if you tried to compile a kernel some time before).

# ls -l linux

If you see that linux is linked to an other source than your running kernel remove the link and create a new one with:

# rm -r linux
# ln -s /usr/src/linux-source-2.6.20 linux

Change to the source directory and patch the kernel with this:

# cd /usr/src/linux
# patch -p1 -l < /home/dirk/993-001.bin

The file "993-001.bin" is the kernel patch for the 2.6.20 and 2.6.21 kernels, I downloaded it here : [1]

After the patchwork I did this :

# make clean
# cp /boot/config-2.6.20-16-generic .config
# make oldconfig
# fakeroot make-kpkg clean
# fakeroot make-kpkg --append-to-version=.hdapscustom kernel_image --initrd binary

This would take its time, so go and clean up your house  ;-) After your house is clean you can do :

# cd /usr/src
# ls -l linux*.deb

You should see some newly builded Debian Pakage files. Install them with:

# dpkg -i linux-headers-2.6.20.3-ubuntu.hdapscustom_2.6.20.3-ubuntu1.hdapscustom-10.00.Custom_i386.deb
# dpkg -i linux-doc-2.6.20.3-ubuntu.hdapscustom_2.6.20.3-ubuntu1.hdapscustom-10.00.Custom_all.deb
# dpkg -i linux-image-2.6.20.3-ubuntu.hdapscustom_2.6.20.3-ubuntu1.hdapscustom-10.00.Custom_i386.deb
# dpkg -i linux-manual-2.6.20.3-ubuntu.hdapscustom_2.6.20.3-ubuntu1.hdapscustom-10.00.Custom_all.deb
# dpkg -i linux-source-2.6.20.3-ubuntu.hdapscustom_2.6.20.3-ubuntu1.hdapscustom-10.00.Custom_all.deb

After the installation you should reboot your computer, when Grub comes up make sure that you select your newly builded kernel. Check it with:

$ uname -r

You should see this "2.6.20.hdapscustom". But now you have the Problem, that you have to recompile the tp_smapi driver.

$ cd tp_smapi-0.31
$ sudo make install HDAPS=1
$ sudo modprobe tp_smapi
$ sudo modprobe hdpas

After :

 $ dmesg | grep hdaps

You should see something like this:

[  893.752000] hdaps: initial mode latch is 0x05
[  893.752000] hdaps: setting ec_rate=250, filter_order=2
[  893.752000] hdaps: fake_data_mode set to 0
[  893.756000] hdaps: device successfully initialized.
[  893.756000] input: hdaps as /class/input/input10
[  893.756000] hdaps: driver successfully loaded.

Now we are ready to try out the hdapsd Deamon which is included in the Gutsy repositories, if you are using Feisty you have to compile it yourself like described here: How to protect the harddisk through APS.

# sudo hdapsd -d sda -s 12 -a -v

Should show this:

Hdapsd.png

If you load it with :

# sudo hdapsd -d sda -s 12 -a

You get nothing until you move your Thinkpad, then you see:

Fri Jul 13 12:30:42 2007: parking
Fri Jul 13 12:30:43 2007: un-parking
Fri Jul 13 12:30:44 2007: parking
Fri Jul 13 12:30:45 2007: un-parking

The Browser Buttons

I wanted to use the Browser Forward & Backward Buttons within Firefox. After the upgrade my Firefox had version 2.0.0.4

I did :

$ sudo gedit ~/.Xmodmap

and added the following lines :

keycode 234 = F19

keycode 233 = F20

I saved and closed the file. HINT: You have to re-login to Gnome to get the .Xmodmap file active.

Then I did the things described in How to get special keys to work.


For the Windows Key I added "keycode 115 = F13" to my .Xmodmap File, then I klicked on "System - Einstellungen - Tastenkombinationen" sorry I don't know how it is called in English. And changed the Entry "Das Panelmenü anzeigen" to F13

The Brightness Buttons

When I wanted to control the brightness, I was not able to change it with FnEnd.

So I did the Workaround menitioned here for Fedora Core 6 Users. After this I was able to change the brightness with FnHome and FnEnd, but I don't have the OSD anymore.

The Fingerprint Reader

Do the steps which are described in Installing Ubuntu 6.10 (Edgy Eft) on a ThinkPad T60 until you get to the Point where Keithvassallo says:

"Phew. Now, to make applications actually use the fingerprint reader."

I have done the following things instead of his version:

$ sudo gedit /etc/pam.d/gdm

Change the file as following:

#%PAM-1.0
auth	sufficient	pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/
auth	requisite	pam_nologin.so
auth	required	pam_env.so
@include common-auth
@include common-account
session	required	pam_limits.so
@include common-session
@include common-password

and:

$ sudo gedit /etc/pam.d/common-auth

Change this file as following:

#
# /etc/pam.d/common-auth - authentication settings common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of the authentication modules that define
# the central authentication scheme for use on the system
# (e.g., /etc/shadow, LDAP, Kerberos, etc.).  The default is to use the
# traditional Unix authentication mechanisms.
#
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 this changes you have the advantage, that you are now able to login to Gnome or KDE whitout entering your password. But if you cancel the "Fingerprint Login", you are still able to login whit your username/password combination.

After I was able to login to my desktop I was unsatisfied, because my Computer still wants to get passwords i.e. when I tried to open Synaptic or when I do any sudo actions.


So I tried to figure out how this sudo thing works. I did the following change to /etc/pam.d/sudo with:

$ sudo gedit /etc/pam.d/sudo
#%PAM-1.0

auth	        sufficient	pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/ :0
password	sufficient	pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam :0
auth	        required	pam_unix.so	nillock_secure
@include common-account

With this change I was able to open System Administration tasks with my fingerprint, but the ugly thing is, that you get no information to swipe your finger over the reader when you have switched to a console session with Ctrl+Alt+F1. The fingerprint scanner software will appear at your running X session.