Installing Ubuntu (Gutsy Gibbon) 7.10 on a ThinkPad R60

From ThinkWiki
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 take 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 key 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 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  ;-)

Help needed
I think the last command (with --append-to-version was an error ! I need help from an specialist in kernel compiling. Please read ahead at the next section "The hdapsd - Deamon (next try)".

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.3-ubuntu1.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 hdaps

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

Now, after I have a working hdaps-deamon I want it to be started at boot time. Because I have upgraded to Gutsy and installed the hdapsd - Package I have a script called /etc/default/hdapsd. Here I have to change some things. HINT: Remember that you still need the /etc/init.d/hdapsd file if you try this on Feisty and maybe you have to do:

$ sudo update-rc.d hdapsd defaults

to create the init links for the hdapsd init script. My links was already there. My /etc/default/hdapsd script now looks like this:

# hdapsd default file

# start hdapsd at boottime?
START="yes"

# the name of the disk device that hdapsd should monitor.
#
# usually this is 'hda' the primary master or 'sda'
# on SATA ThinkPads.
DISK="sda"

# sensitivity
SENSITIVITY=12

# other options to pass to hdapsd.
# the -d $DISK, -s $SENSITIVITY, -b and -p $PIDFILE options are always passed.
OPTIONS="-a"

Now I could use the gnome-hdaps-applet with the following comands:

$ mkdir gnome-hdaps-applet
$ cd gnome-hdaps-applet
$ wget http://www.zen24593.zen.co.uk/hdaps/gnome-hdaps-applet-20060120.tar.gz
$ tar -xzf gnome-hdaps-applet-20060120.tar.gz
$ sudo apt-get install libpanel-applet2-dev
$ gcc $(pkg-config --cflags --libs libpanelapplet-2.0) -o gnome-hdaps-applet gnome-hdaps-applet.c
$ sudo cp gnome-hdaps-applet /usr/bin/
$ sudo mkdir /usr/share/pixmaps/gnome-hdaps-applet/
$ sudo cp *.png /usr/share/pixmaps/gnome-hdaps-applet/
$ sudo cp GNOME_HDAPS_StatusApplet.server /usr/lib/bonobo/servers/

Now after a restart of the Gnome Session I could find a "HDAPS Status" applet in the "Add to Panel" dialog. I added it, and when I move the Thinkpad it shows me the "Pause" Hdaps-paused-small.png Symbol, otherwise it shows "Play" Hdaps-running-small.png.

So far so good !!! After I got this running I tried the same steps with the normal Gutsy Kernel (2.6.22-7-generic) on the same way, and it worked ! To my surprise with the same kernel patch.

The only Problem that I now have is that I cannot use restricted modules with my new kernels. Now I have to figure out how to compile restricted modules agains selfmade kernels.

EDIT: This might be useful restricted modules compilation: [2]https://help.ubuntu.com/community/CustomRestrictedModules --user.Sarang2005 (Sarang) END EDIT.


Help needed

The hdapsd - Deamon (next try)

I am not satisfied with the above result, because I cannot use the accelerated xorg-fglrx driver for my ATI Graphics Card and I cannot use my wireless Intel card ipw3945 driver. And the Ubuntu restricted-manager is not working. PLEASE can someone help me to compile a Ubuntu kernel in the correct way, so that I can use the whole hardware ?

I have done a - I think really ugly hack - to get the restricted-manager working :

# cd /usr/src/linux
# make clean
# cp /boot/config-2.6.20-16-generic .config
# cp /boot/config-2.6.20-16-generic /lib/modules/2.6.20-16-generic/.config
# gedit /usr/src/linux/Makefile

In the Makefile I changed the entry EXTRAVERSION to my running kernel version like this "EXTRAVERSION = -16-generic". Then I compiled the kernel again with:

# make oldconfig
# fakeroot make-kpkg clean
# fakeroot make-kpkg --revision=4711 kernel_image --initrd binary

Then I moved my modules with :

# mv /lib/modules/2.6.20-16-generic /lib/modules/2.6.20-16-generic.orginal

And installed the kernel with:

# dpkg -i linux-image-2.6.20-16-generic_4711_i386.deb

Then I rebooted the computer and recompiled the tp_smapi drivers as described above. Finally I copied the ipw3945.ucode with

# cp /lib/firmware/2.6.22-7-generic/ipw3945.ucode /lib/firmware/2.6.20-16-generic/ipw3945.ucode

My wireless-card is working now ! My ATI Card cannot be configured with restricted-manager!

Help needed
Please can someone who is conform in compiling Ubuntu kernels and restricted modules help me to do it in the correct way ! And can someone recheck the things described above, because I am not sure about all things that I have written here.

After some days Ubuntu updated the kernel to version 2.6.22-9-generic, so I need to do the steps described above again, with "EXTRAVERSION = -9-generic". But now my wireless card and my grapics card did not work. The restricted-manager crashes when I start it. So I downloaded the packages ipw3945-1.2.1.tgz and ati-driver-installer-8.39.4-x86.x86_64.run.


The Wireless Card

First I extracted and installed the Intel Pro Wireless Package:

$ tar xzvf ipw3945-1.2.1.tgz
$ cd ipw3945-1.2.1
$ make
$ sudo make install

After this I could do :

$ sudo modprobe ipw3945

The module was loaded, and i was able to use my wireless card now.


The Graphics Card

For my Radeon Mobility X1400 I did the following steps:

$ sudo apt get update
$ sudo apt-get install module-assistant build-essential fakeroot dh-make debhelper debconf libstdc++5

Created a Debian Package with:

$ sudo bash ati-driver-installer-8.39.4-x86.x86_64.run --buildpkg Ubuntu/gutsy

And blacklisted the old fglrx module with:

$ sudo gedit /etc/default/linux-restricted-modules-common

I added "fglrx" to the line with "DISABLED_MODULES". Then I installed the created Debian Packages with:

$ sudo dpkg -i xorg-driver-fglrx_8.39.4-1_i386.deb fglrx-kernel-source_8.39.4-1_i386.deb fglrx-amdcccle_8.39.4-1_i386.deb

Then I compiled the kernel Modules:

$ sudo module-assistant prepare
$ sudo module-assistant update
$ sudo module-assistant build fglrx
$ sudo module-assistant install fglrx
$ sudo depmod -a


The helpful informations for this was found at http://wiki.cchtml.com/index.php/Ubuntu_Feisty_Installation_Guide.


After this steps my wifi-card and my graphics-card was working and restricted-manager was not crashing when I tried to start it.

After The Kernel Update (HDAPS AGAIN)

On 9.October 2007 Ubuntu released the Kernelpackage linux-image-2.6.22-14-generic and I installed it. So here is what I have done to get it working:

$ sudo apt-get install linux-headers-generic
$ sudo ln -s /usr/src/linux-source-2.6.22 /lib/modules/2.6.22-14-generic/source
$ sudo cd /usr/src/linux
$ sudo make clean
$ sudo cp /boot/config-2.6.22-14-generic .config
$ sudo cp /boot/config-2.6.22-14-generic /lib/modules/2.6.22-14-generic/.config
$ sudo gedit /usr/src/linux/Makefile

In the Makefile I changed the entry EXTRAVERSION to my running kernel version like this "EXTRAVERSION = -14-generic".

$ sudo gedit .config

In the .config file I changed the entry " # CONFIG_SND_HDA_INTEL is not set " to " CONFIG_SND_HDA_INTEL=m ". This was needed to compile the module for my sound card.

Then I compiled the kernel again with:

$ sudo make oldconfig
$ sudo fakeroot make-kpkg clean
$ sudo fakeroot make-kpkg --revision=4711 kernel_image --initrd binary

Then I copied my modules with :

$ sudo cp -R /lib/modules/2.6.22-14-generic /lib/modules/2.6.22-14-generic.orginal

And installed the kernel with:

$ sudo dpkg -r linux-headers-generic linux-headers-2.6.22-14-generic
$ cd ..
$ sudo dpkg -i linux-image-2.6.22-14-generic_4711_i386.deb

When you install the new kernel you get this messages:

Kernel1.png 
Kernel2.png
Kernel3.png

Then I rebooted the computer and recompiled the tp_smapi drivers with:

$ cd /home/dirk/tp_smapi-0.32
$ sudo make install HDAPS=1

After this I load the modules with:

$ sudo modprobe tp_smapi
$ sudo modprobe hdaps

And test it with:

$ hdaps-gl

Now I had to get my sound-card working. The module from ubuntu is not working, I don't know why. So I did this:

$ sudo mv /lib/modules/2.6.22-14-generic/ubuntu/media/snd-hda-intel/snd-hda-intel.ko
                  /lib/modules/2.6.22-14-generic/ubuntu/media/snd-hda-intel/snd-hda-intel.ko.orginal
$ sudo cp /usr/src/linux-source-2.6.22/sound/pci/hda/snd-hda-intel.ko
                  /lib/modules/2.6.22-14-generic/ubuntu/media/snd-hda-intel/snd/hda-intel.ko

After this I load the modules with:

$ sudo modprobe snd-hda-intel

To get my graphics card accelerated again I recompiled the kernel modules for it:

$ sudo module-assistant prepare
$ sudo module-assistant update
$ sudo module-assistant build fglrx
$ sudo module-assistant install fglrx
$ sudo depmod -a

After this I restarted my computer and checked the acceleration with:

$ glxgears

You should get something around 3100 FPS in 5 seconds (without acceleration it is around 700 FPS per 5 seconds).

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 :

$  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.


UPDATE: You don't need to do this since kernel version 2.6.22 on Ubuntu

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.