Installation CentOS 5 on a Thinkpad T60

From ThinkWiki
Jump to: navigation, search

Created by: Roy Vestal 22:42, 25 February 2008

Abstract:

This article describes how I was able to load CentOS 5 on my Lenovo Thinkpad T60.

My ThinkPad:

   * Lenovo ThinkPad T60 (2007-CTO)
   * Intel Core 2 Duo (Merom) T7200 @ 2.00GHz
   * ATI Radeon X1300
   * Intel Gigabit Ethernet Controller
   * Intel PRO/Wireless 3945ABG Mini-PCI Express Adapter
   * Integrated Bluetooth.
   * Integrated Fingerprint Reader
   * 60 GB - Serial ATA Hard Drive.
   * 15.4" TFT display with 1024x768 resolution
   * Intel 82801G (ICH7 Family) High Definition Audio Controller (rev 02)


What Works:

   * CentOS
   * Video, 2D and 3D.
   * Brightness, Volume and Mute with OSD (On-Screen Display).
   * ThinkLight, TrackPoint II and the touchpad.
   * Bluetooth
   * Infrared ( I do not use it, but the drivers load)
   * Suspend
   * Hibernate 

What Doesn't Work:

   * Modem (Haven't tried it)
   * Most of the function keys, except noted above (again, haven't really tried at this point)
   * The fingerprint reader. There seems to be a bug in the libusb driver 

Kernel Drivers: The laptop uses the following hardware specific kernel drivers:

   * kernel level 2.6.18-53.1.6.el5
   * ipw3945 (added later from rpmforge. Discussed later)
   * e1000 (ethernet)
   * snd_hda_intel (sound)
   * nsc_ircc (infrared) 

Installing CentOS:

I have my machine setup for dual booting. It came with Windows XP SP2 installed. I used 7-Tools Partition Manager to partition my machine. It was a $25.00 download that I purchased a few years ago. I have used gparted and partinfo in the past to do the same, so if you are going to dual boot, you do not need to purchase a tool if you do not want. I split my disk into 2x 30GB partitions.

I burned a copy of CentOS-5.0-i386-bin-DVD.iso at the time of this writing. Booted from it and told the installer to use only the free portion of the disk. I had no issues with the install from there. I used the GUI install with no issues. If you want to use the text only mode, simply type "linux text" at the boot prompt of the install DVD.

I do NOT use Gnome, but KDE. During installation, I chose KDE Desktop and unchecked Gnome, and since I use this laptop for development, I chose the development tools and libraries I normally need. If you use Gnome, most of this information will be useful to you, but the KDE specific stuff you can over look.

During the install you can change the name of the "Other" OS during the install. I changed mine to "Windows XP".

After the installation, I ran yum update, and rebooted into the new kernel. I also disabled kudzu after getting my wireless working. See the Wireless LAN section for details. Yum Repositories:

In order to set the machine the way I needed for work and home, I added the EPEL (Fedora Extra Packages for Enterprise Linux) and RPMforge/DAG repositories.

When using third party repositories with CentOS, it is recommended that you use yum priorities. This is a plugin for yum from CentOS that allows you to assign priority levels to your repositories to keep them from causing dependency errors.

To install yum priorities, as root perform:

 $ yum install yum-priorities

Verify the priorities plugin is enabled. In /etc/yum/pluginconf.d/priorities.conf file, verify "enabled=1".

Once yum priorities is installed, I simply installed the repositories. Again, as root run: For EPEL:

 $ rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-2.noarch.rpm

RPMForge/DAG

 $ rpm -Uvh http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

Finally, we have to set the priorities. You will need to decide what the priorities should be. I followed the recommendations from the CentOS website and set them as follows:

 [base], [addons], [updates], [extras] ... priority=1
 [centosplus],[contrib] ... priority=2
 [epel], [rpmforge] ... priority= 10
 [epel-debuginfo], [epel-source], [epel-testing], [epel-testing-debuginfo], [epel-testing-source] ... priority = 15

You may want to adjust these as you see fit for your installation. See http://wiki.centos.org/PackageManagement/Yum/Priorities for more information on priorities

Wireless LAN:

By default, the CentOS kernels do not have drivers for the Intel 3945. But do not fear! RPMForge has this for us.

Step 1: To install, simply run the following as root:

 $ yum install ipw3945-firmware dkms-ipw3945 ipw3945d

Step 2: Setup eth1 as wireless card: Once installed, this will give the drivers needed. I had issues with which eth my wireless was going to be. As I use WPA, I had to setup my system to force my wireless mac to be eth1. You can use wlan0 if you'd like but I prefer eth0 and eth1. I do use both eth0 and eth1, depending on if my laptop is docked in my docking station.

I had to create an /etc/sysconfig/network-scripts/ifcfg-eth1 file with my mac so the drivers didn't force my wireless to be eth0. The /etc/sysconfig/network-scripts/ifcfg-eth1 is as follows:

       # Intel Corporation IPW3945 Wirleess Ethernet Controller
       DEVICE=eth1
       ONBOOT=no
       BOOTPROTO=dhcp
       HWADDR=AA:BB:CC:DD:EE:FF (replace these with your MAC address)

Also, verify the aliases for your nics in /etc/modprobe.conf. Mine are as follows:

       alias eth0 e1000
       alias eth1 ipw3945

Step 3: Modify the boot order:

I modified the startup scripts to use a different boot order that works with wpa supplicant, and to give the drivers a chance to load before wpa supplicant, YMMV. As root, I modified the files below and changed their boot order to the following:

/etc/init.d/network:

chkconfig: 2345 12 87

/etc/init.d/ipw3945d

chkconfig: 345 10 90

/etc/init.d/wpa_supplicant

chkconfig: - 15 88

To use the new boot order, run the following as root:

To disable the default boot order:

       $ chkconfig network off
       $ chkconfig ipw3945d off
       $ chkconfig wpa_supplicant off

To enable the new boot order:

       $ chkconfig network on
       $ chkconfig ipw3945d on
       $ chkconfig wpa_supplicant on

I also disabled NetworkManager as I use wpa_supplicant to manage my networks. If you want to do this, disable NetworkManager and NetworkManagerDispatcher as well:

       $ chkconfig NetworkManager off
       $ chkconfig NetworkManagerDispatcher off

Step 4: Setup WPA Supplicant:

First I setup wpa_supplicant to use eth1 and the ipw3945 driver. To do this, simply edit the /etc/sysconfig/wpa_supplicant file and use the following parameters (don't forget the quotes):

       INTERFACES="-ieth1"
       DRIVERS="-Dwext"

Next, I modified the /etc/wpa_supplicant/wpa_supplicant.conf file as follows:

 #Begin File
 ctrl_interface=/var/run/wpa_supplicant
 ctrl_interface_group=wheel
 network={
  ssid="work"
  .... settings not shown for security.
 }
 network={
  ssid="home"
  .... settings not shown for security.
 }
 network={
  ssid="any"
 }
 #End File

There are a ton of great how tos on setting your WPA Supplicant file for WPA, WPA2, and WEP. I am able to connect successfully regardless of whether I'm at home, work, or the coffee shop. You can add multiple networks as show above. For example, I have wireless setup for family I visit. Once you get wpa supplicant working, you'll be able to add networks at your leisure. YMMV

Bluetooth:

Bluetooth works out of the box, but I had to tweak the /etc/bluetooth/rfcomm.conf file for my devices. I do not know of a KDE GUI util at this time. I used "How to Setup Bluetooth" from ThinkWiki, and Spot's bluetooth information regarding setting up bluetooth on Fedora 7 from ThinkWiki:

 http://www.thinkwiki.org/wiki/How_to_setup_Bluetooth   http://www.thinkwiki.org/wiki/Installing_Fedora_7_on_a_ThinkPad_T60#Bluetooth

Note that the "Configuring the kernel" section from "How to Setup Bluetooth" is not needed as CentOS 5 already has the drivers working.

Infrared:

I do not use infrared but the instructions from Tom Callaway's "Installing Fedora 7 on a ThinkPad T60" appear to work. From http://www.thinkwiki.org/wiki/Installing_Fedora_7_on_a_ThinkPad_T60#Infrared :

 T60 has an NSC FIR chip. The driver needs to know a Dongle ID so it must be manually configured.
 Edit /etc/modprobe.conf, add the following two lines:   alias irda0 nsc-ircc
   options nsc-ircc dongle_id=0x09
 
 Edit /etc/sysconfig/irda:
   IRDA=yes
   DEVICE=irda0
   DISCOVERY=yes
 Start IRDA
   $ service irda start
 
 If You want IRDA to be enabled during system boot, turn it on like this:
   $ chkconfig irda on

Video Drivers:

I built a preconfigured driver from the ATI driver installer with no issues. You will need the latest ATI driver installer (8-5-x86.x86_64 at the time of this writing). To install, do the following as root:

* Download the latest driver from the ati website http://www.ati.com
* Build a predefined packaged from the ATI driver installer, the arguments are case sensitive:
   $ sh ./ati-driver-installer-8-5-x86.x86_64.run --buildpkg RedHat/RHEL5
* Install the driver:
   $ rpm -ivh fglrx-<version-number>.rpm
* Use aticonfig to "automagically" update your xorg.conf
   $ aticonfig --initial --input=/etc/X11/xorg.conf

I also had to tweak the /etc/X11/xorg.conf file so the drivers would work correctly. I had to turn AIGLX off and the Composite extension off. To do this, I had to add the following sections to my /etc/X11/xorg.conf. You can simply add these to the bottom:

Turn Off AIGLX:

 Section "ServerFlags"
  Option "AIGLX" "off"
 EndSection

Disable Composite Extension:

 Section "Extensions"
  Option "Composite" "Disable"
 EndSection

If you have the sections above, I'd recommend changing them to the above settings.

The next part of the video setup is optional. I have a docking station and a 19" LCD monitor. My laptop resolution is 1024x768 (the only think I do NOT like about this laptop). My LCD monitor runs 1280x1024". I run my setup where it's using both screens and I just have to adjust my resolution on the fly. I created a simple script that changes my screen resolution on the fly for both. I also had to add a mode line so the bigger resolution would be used by the script.

I added the following "Modes" line in the "Display" subsection of my "Screen" sections listed (there were 2 in my installation).

 Modes "1280x1024" "1024x768" "800x600"

I created the following script as ~/bin/chgdisplay.sh and added bin to my path. I also used xbindkeys to bind the script to "CTRL+Shift+v". Here is the script:

 #!/bin/sh
 # To force display to 1280x1024 on external and internal
 if [ -e ~/.atilcd ]
    then
       rm ~/.atilcd
       touch ~/.atiboth
       sudo /usr/bin/aticonfig --enable-monitor=lvds,crt1 --nobackup
       exec `xrandr -s 1280x1024`
       exit
 fi
 # To force display to 1024x768 on external and internal
 if [ -e ~/.atiboth ]
    then
       rm ~/.atiboth
       touch ~/.atilcd
       sudo /usr/bin/aticonfig --enable-monitor=lvds,crt1 --nobackup
       exec `xrandr -s 1024x768` exit
 fi
 #End


This script cycles between the 2 settings. I have seen more complicated scripts that detect if the monitors are connected or what not but for my use, this simply works. This script uses aticonfig from the ATI drivers. Please see the ATI documentation for more info, or simply "man aticonfig".

Suspend:

By default, the CentOS 5 KDE installation uses klaptop. I use klaptop to suspend and hibernate my machine as needed.

ThinkPad Buttons:

I only use the ThinkPad volume buttons (including mute), the brightness buttons, and the thinklight buttons. I installed tpb from the RPMForge repositories. To install, run as root:

 $ yum install tpb

You will need to edit the udev nvram file to make this work by default. The default permissions of /dev/nvram are 660 (rwrw---) and they need to be 666 (rwrwrwrw). To do this simply edit the /etc/udev/rules.d/50-udev.rules file and change the line:

KERNEL=="nvram",  MODE="0660"

to read

KERNEL=="nvram",  MODE="0666"

You will need to restart udev for these settings to take affect. As root run the following:

$ service udev restart

Logout of your session and back in. The volume up and down, the mute, the brightness up and down, and the thinklight buttons should all work and give on screen display.

If you want to make more of these buttons work, I'd suggest checking the following from thinkwiki.org:

http://www.thinkwiki.org/wiki/Installing_Fedora_7_on_a_ThinkPad_T60 - Section "Getting the ThinkVantage Buttons to work" http://www.thinkwiki.org/wiki/How_to_get_special_keys_to_work

Build Environment:

I wanted to setup my account with a nonroot rpm build setup so I could recompile some src rpms and for rpm development. Fedora has setup rpmdevtools utility that is designed to do just this. I simply installed it from the EPEL repository. As root run the following:

 $ yum install rpmdevtools

Then run as your own user:

 $ fedora-buildrpmtree

This will build your ~/rpmbuild folder and set the .rpmmacros file to use your user information to build as opposed to using the root user (recommended by RPM and Red Hat).

Xbindkeys:

I use xbindkeys to bind shortcuts for my system, especially my editors and a script I have to change between my laptop display and my flat panel monitor on my docking station.

To install xbindkeys, I had to recompile an Fedora 7 src rpm. You can download this from any Fedora mirror. As yourself run the following:

$ wget http://download.fedora.redhat.com/pub/fedora/linux/releases/7/Everything/i386/os/Fedora/xbindkeys-1.8.0-1.fc7.i386.rpm
 $ rpmbuild --rebuild --target=i686 xbindkeys-1.8.0-1.fc7.i386.rpm

xbindkeys requires guile-devel and libX11-devel. If they are not installed, you can install these running the following as root:

 $ yum install guile-devel libX11-devel

This will build the xbindkeys rpms and put them in ~/rpmbuild/RPMS/i686. To install simply run the following as root, replacing USERNAME with your username:

 $ rpm -ivh /home/USERNAME/rpmbuild/RPMS/i686/xbindkeys-1.8.0-1.i686.rpm

To start xbindkeys, you'll need to add it to your ~/.kde/Autostart folder. Simply run this as your user:

 $ echo /usr/bin/xbindkeys >> ~/.kde/Autostart/xbindkeys.sh
 $ chmod a+x ~/.kde/Autostart

This will start xbindkeys at every login. You can start xbindkeys for your current session by simply running /usr/bin/xbindkeys from a prompt.

To verify it's working for you, simply press the "Ctrl+Shift+q" keys to show the current xbindkey definitions.

To add key bindings, simply run the following:

 $ xbindkeys --defaults > $HOME/.xbindkeysrc

Then edit .xbindkeysrc to your liking. I found it helpful to have a second terminal open to run xbindkeys -k to display what exact keys I was pressing for the key combinations. For more information and examples: http://hocwp.free.fr/xbindkeys/xbindkeys.html

NTFS-3G:

Since I'm running a dual boot, I need to occasionally get to my ntfs partition. I simply installed ntfs-3g from RPMForge. As root run the following:

 $ yum install fuse dkms-fuse fuse-ntfs-3g

I then setup a small script to mount my C partition so I wouldn't have to type in the mount command everytime. You could add this to the /etc/fstab, but I don't want it connected unless needed. First, I created a new mount point:

 $ mkdir drivec

Then created this script in my ~/bin directory, and set it to executable:

 $ echo sudo mount -t ntfs-3g /dev/sda1 /home/USERNAME/drivec -o uid=USERNAME,ro >> ~/bin/mntc
 $ chmod +x ~/bin/mntc

If you do this, you'll need to change USERNAME to your username. I set it to read only (ro). I know that ntfs-3g is supposed to be safe, but I'm still skeptical. If you want to be able to write to the partition, you'll need to change this to rw.

Credits:

A lot of credit goes to ThinkWiki and especially Tom Callaway for his Installing Fedora 7 on a Thinkpad T60 page.

References:

   * http://www.centos.org
   * http://www.thinkwiki.org/wiki/Installing_Fedora_7_on_a_ThinkPad_T60
   * http://hocwp.free.fr/xbindkeys/xbindkeys.html
   * http://www.jwz.org/xscreensaver