Install Ubuntu 9.10 (Karmic Koala) on a ThinkPad T400

From ThinkWiki
Revision as of 13:07, 11 May 2011 by Jango (Talk | contribs) (Active Protection System: fix typo)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

T400

Before Installation

Before you can start Ubuntu from CD or USB you have to change two BIOS settings:

  • Change to Internal or ATI Graphics with Config --> Display --> Graphics Device --> [Integrated graphics] or [Discrete Graphics]
  • Disable OS Detection for Switchable Graphics. Otherwise it will mysteriously switch back to Switchable Graphics.

Now you can boot your Live-CD, connect to Wireless Lan, and install the OS.

What works out of the box?


  • Intel driver for Integrated Graphics (Intel Integrated Intel GMA 4500MHD)
    • with 3D acceleration out-of-the-box
  • ATI fglrx driver for Discrete Graphics (ATI Mobility Radeon HD 3470 graphics)
    • To enjoy 3D acceleration, you have to install the proprietary fglrx Driver. (for example with the jockey-gtk tool)
  • VGA/HDMI output


  • Sound card
  • Optical drive (Including DVD burning)
  • built-in webcam (tested with skype, cheese and vlc media player)
  • 7-in-1 card reader from Ricoh (MMC, Memory Stick, Mem Stick Pro, SD, SDHC, XD, XD Type H Memory)
  • Trackpoint and Touchpad
    • Including scroll at the right side of the pad by default. (for scrolling with the middle mouse button, see below!)


  • Control buttons/Hotkeys
    • Volume control buttons
    • Screen brightness control (FN + Home/End)
    • Thinklight control (FN + PgUp)
    • WLAN/BT/OFF toggle (Fn+F5 press once: Wlan and BT off/Press second time: BT off, Wlan on/Third time: BT on, Wlan off/Press another time: BT and Wlan on)
    • To add a bluetooth-only-toggle (Fn+F6) that doesn't affect WLAN take a look here
    • Wlan/BT hardware switch
    • Media player control (FN + arrows)
    • Browser history buttons
    • Switch to extern Monitor (FN + F7 press once: picture on both monitors/Second time: on external Monitor/Third time: Laptop monitor)
    • Suspend shortcut (FN + F4)
    • Hibernate shortcut (FN + F12)
    • Battery info shortcut (FN + F3)
    • Screenlock shortcut (FN + F2)
    • dock eject button (FN + F9) not tested yet!
    • ThinkVantage Button (You only have to allocate a programm!)


  • Some ACPI features
    • Battery status, power graphs and history (tested with an single 6-Cell battery)
    • Lid states and events
  • Suspend/Hibernate

What needs some Tweaks?

Mute button

The Mute button only mutes the sound but no induction in the gnome volume indicator. To fix this you must edit your grub configuration adding a kernel option acpi_osi="Linux".

Configure your grub

> sudo vim /etc/default/grub

Look for the line:

GRUB_CMDLINE_LINUX=""

Add the kernel option to the end of the line:

GRUB_CMDLINE_LINUX="acpi_osi="Linux""

Save the file, then update grub

> sudo update-grub

Scrolling with Trackpoint

Create a new file called /etc/hal/fdi/policy/mouse-wheel.fdi typing:

sudo gedit /etc/hal/fdi/policy/mouse-wheel.fdi

And fill it with this code:

<?xml version="1.0" encoding="UTF-8"?> 

<match key="info.product" string="TPPS/2 IBM TrackPoint">
 <merge key="input.x11_options.EmulateWheel" type="string">true</merge>
 <merge key="input.x11_options.EmulateWheelButton" type="string">2</merge>
 <merge key="input.x11_options.XAxisMapping" type="string">6 7</merge>
 <merge key="input.x11_options.YAxisMapping" type="string">4 5</merge>
 <merge key="input.x11_options.ZAxsisMapping" type="string">4 5</merge>
 <merge key="input.x11_options.Emulate3Buttons" type="string">true</merge>
</match>


Source: [1]

(Based on code from Michael Vogt and adapted to support both vertical and horizontal scrolling.)

Enabling Touchpad on/off key

Enabling it

Source: [[2]] The SHMConfig is now controlled through hal. In the past this was done through xorg.conf

You have to add the file

$ sudo gedit /etc/hal/fdi/policy/shmconfig.fdi

with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
 <device>
  <match key="input.x11_driver" string="synaptics">
   <merge key="input.x11_options.SHMConfig" type="string">True</merge>
  </match>
 </device>
</deviceinfo>

After this change please reboot. Restarting hal doesn't help.

Auto Re-enable Workaround

The touchpad will be automatically enabled every time you hit a key on the keyboard (Bug #459832 [[3]]). In order to avoid that you have to install gsynaptics and unselect "Disable touchpad while typing". To do it:

sudo apt-get install gsynaptics
Go to Menu: System->Preferences->Mouse->Touchpad
Under General unselect "Disable touchpad while typing".

Configuring Trackpoint's sensitivity and speed on start

Source: [[4]] Adjusting the speed and sensitivity of the TrackPoint requires echoing a value between 0 and 255 into the appropriate file. For example, for a speed of 120 and a sensitivity of 250, type the following into a terminal:

   # echo -n 120 > /sys/devices/platform/i8042/serio1/serio2/speed 
   # echo -n 250 > /sys/devices/platform/i8042/serio1/serio2/sensitivity 

Feel free to experiment with your settings until you find a combination that is comfortable. Do it as root, sudo does not work. Instead use "sudo -i" or "sudo su".

When you satisfy your setting, add the two lines into /etc/rc.d/rc.local in order to avoid restoring the default setting every time the system reboots. In Ubuntu 9.10, add the lines to /etc/rc.local before the exit 0 line:

   # By default this script does nothing.
   
   echo -n 120 > /sys/devices/platform/i8042/serio1/serio2/speed 
   echo -n 250 > /sys/devices/platform/i8042/serio1/serio2/sensitivity 
   
   exit 0


There is also a graphical tool for configuring the trackpoint: Configure Trackpoint

Gnome Power Manager: Put computer to sleep when inactive for: XX Minutes workaround

Type ALT+F2, input gconf-editor and click on Run. Navigate to /apps/gnome-power-manager/actions. Notice that sleep_type_battery has no value defined. Click on it, select options with the right mouse button, click on Edit key... Set value to hibernate or suspend whatever you want.

Now your computer should suspend or hibernate after the idle time you set on gnome-power-manager. Remember that this time starts only after the screensaver has jumped in. That's 5 minutes standard. So if you set 10 minutes it will sleep after 15 minutes idle time.

Notebook-Harddrive Bug


This step is probably not necessary, at least on my t400 Load_Cycle_Count is stable.


Source: [[5]]

Change "BATT_HD_POWERMGMT=1" in /etc/laptop-mode/laptop-mode.conf to an higher value to stop permanent harddrive-parking! Line 238, 200 seems to be a reasonable value:

   BATT_HD_POWERMGMT=200

Sound in KDE (Kubuntu) does not work

Flash sound and/or Skype did not work. Other sounds are working. You have to switch sound settings, so that Pulse Audio is preferred before all other systems. System settings -> Multimedia -> Sound ouput.

Performance Problem with Window Unminimize and Resize

If you happen to use the following combination: gnome, compiz and proprietary ati/amd driver you are almost certainly experiencing performance problem when either resizing or unminimizing terminal window. Follow instructions provided here to install modified version of X.

Ubuntu Bug: 351186

CPU High Pitch Noise

While running on battery power, T400 produces some high pitch noise on its front left corner. It seems to be related to the CPU idle C-States, this has nothing to do with the Speedstep. Information on C-States: [[6]]. This noise has been referred as "CPU Whine" throughout the Internet.

To eliminate the noise you have to disable C-States 3 and 4, to do so edit your "/etc/default/grub" where it says, GRUB_CMDLINE_LINUX = "" and input "processor.max_cstate=2". If this entry does not exist, create it. If there is already something defined for it, include it with a space as separation mark. (e.g. GRUB_CMDLINE_LINUX="acpi_osi="Linux" processor.max_cstate=2"). This will increase your power consumption by 1W, from 15W to 16W more or less.

Configuring your grub:

> sudo vim /etc/default/grub

Look for the line:

GRUB_CMDLINE_LINUX="acpi_osi="Linux""

Add the kernel option "processor.max_cstate=2" to the end of the line:

GRUB_CMDLINE_LINUX="acpi_osi="Linux" processor.max_cstate=2"

Save the file, then update grub

> sudo update-grub


There are other possible solutions listed here: [[7]]; neither max_cstate=3 nor bm_history=0xFFFFFFFF have worked for me. Turning off CPU Power Management on BIOS works, but you can as well just add max_cstate to 2. At last I found this IBM report [[8]], which suggests this could be related to usb devices not going to sleep. Michael Kiausch [[9]] reports having removed the usb controller module and solved his noise problem on his X41. However, usb controller modules are compiled inside the kernel on Ubuntu-9.10. Nevertheless, enabling autosuspend for every usb device in any of the following ways did not solve the problem either; by "echo -n 1 > "/sys/bus/usb/devices/usb*/power/autosuspend"", through powertop or grubline "usbcore.autosuspend=1".

What doesn't work at the moment?

Integrated Fingerprint Reader

There is a new chipset build in, the "AuthenTec AES2810". So neither the thinkfinger nor the fprint Project support this Device at the moment.

lsusb:
Bus 002 Device 004: ID 08ff:2810 AuthenTec, Inc.

Daniel from fprint Project wrote in their mailing list, that support for our device is in development! For more information look here: fprint Unsupported devices

Switchable Graphics

Not tested yet.

ATTENTION!
If you are dual-booting XP (or older) make sure you disable switchable graphics detection in the BIOS. If you don't when you boot Linux the BIOS will enable switchable graphics since apparently Linux is aware of it and later when you boot into XP with it still enabled you'll have problems (drivers won't load, etc).

Upgrading from earlier versions of Ubuntu

Resume/Suspend problems

If you have problems with resume/suspend, first try if it works from the LiveCD. If LiveCD works, the problem must be in your Ubuntu configuration. Try reinstalling acpi-support and laptop-mode-tools:

sudo apt-get remove --purge laptop-mode-tools acpi-support
sudo apt-get install laptop-mode-tools acpi-support

If this doesn't help, check the files in /etc/hal/fdi/information directory and remove the unnecessary files.

Extras

Active Protection System

Simple version for everyone... just run the script!

  • Download this script: http://homepage.univie.ac.at/s.hammer/install_hdapsd
  • Give it the permissions to be executed (Right-click -> Properties -> Permissions -> Allow executing file as program)
  • Open a terminal window, type "sudo su" and enter your password to become Superuser.
  • Execute the script with typing "./install_hdapsd"
  • Finished! ATTENTION: Run this script only once, otherwise your config files will get spammed!


Install Packages:

Since Karmic the packages were updated in the repository. So you only have to install this packages:

sudo apt-get install tp-smapi-source hdapsd

Then use module-assistant to build tp-smapi:

sudo module-assistant prepare tp-smapi
sudo module-assistant auto-install tp-smapi

Set Options:

To load these modules on every startup you have to write them into the /etc/modules file:

sudo gedit /etc/modules

Append this to the file:

thinkpad_ec	
tp_smapi
hdaps

We also need options to load these modules correctly. They have to be written in /etc/modprobe.d/local.conf

sudo gedit /etc/modprobe.d/local.conf

Fill the file with this code

# enable thinkpad_ec
options thinkpad_ec force_io=1

# option to correctly set tilting through hdaps sensor
options hdaps invert=1

Test installation:

Now you can try, if the modules are loaded yet. Do so with

lsmod | grep hdaps

if not perform:

sudo modprobe -a thinkpad_ec tp_smapi hdaps


If the installation of hdapsd succeeded, you can test it by typing this into your terminal:

sudo hdapsd -d sda -s 15 -a -v -y 

If you suddenly move your laptop the output will change! (stop it with pressing Ctr + C)

Now you can start hdapsd with typing:

sudo /etc/init.d/hdapsd start

After an reboot everything should start automatically and work correctly! You can change the sensitivity value and other things in this file: "/etc/default/hdapsd". To see the effects you have to type "sudo /etc/init.d/hdapsd restart" to restart hdapsd!

Further, events of parking and un-parking will be logged to "/var/log/syslog". This shows you, when the hdaps was triggered:

user@computer:~$ cat /var/log/syslog | grep hdaps
# example output:
Mar 23 23:14:25 computer hdapsd[1880]: parking
Mar 23 23:14:26 computer hdapsd[1880]: un-parking


Additional tools:

To install the gnome-panel-applet type these lines into the terminal (or create a new file, insert this lines and execute it with sudo):

sudo apt-get install libpanel-applet2-dev
mkdir gnome-hdaps
cd gnome-hdaps
wget http://www.zen24593.zen.co.uk/hdaps/gnome-hdaps-applet-20081204.tar.gz
tar xfvz gnome-hdaps-applet-20081204.tar.gz
sudo 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/
cd ..
rm -R gnome-hdaps

The first line is to install required deps, next lines are to download, extract and move to the source directory, then we compile it and copy the files to several positions. At last clean up a little bit. Now you can add this applet to the panel!

Please feel free to correct mistakes. If you have trouble, don't be shy and contact me with jabber: jango4@jabber.org

Undock from a docking station

I experienced that the docking station disconnects all devices immediately when the eject button is pressed. Even if you use a udev triggered script! This can end in data recovery if you have file systems mounted via the docking stations USB ports. You can use the following script to unmount all file systems from the docking station before ejecting your ThinkPad.

Get the correct syspath

The scripts needs to know which syspath points at the docking stations USB ports. Follow these steps:

Step 1: Plug a usb block device (i.e. usb key) into your docking station.

Step 2: Run:

mount

in the terminal and look for the device path - something like "/dev/sdb1" (should be the last line of the output).

Step 3: Now run

udevadm info --query=path --name=/dev/sdb1

with the device path from step 2 for "name=...".

Step 4: You will get quite a long path - copy it to a temporary text file to remember it.

Step 5: Repeat the procedure starting from step 1 with the next USB port from the docking station (I suggest for all the ports).

Step 6: I recommend to attach a device to the notebook directly to see the differences in the syspaths.

Step 7: The syspaths will contain a substring similar to /devices/pci0000:00/0000:00:1a.7/usb1/1-5/1-5... In my experiences this is the substring where you can identify an USB device as attached to the docking station. If not: compare the paths and try to find the longest common string for all the syspaths.

The script

Please enter your correct syspath and username in the config section. Save the script somewhere and remember to make it executable.

#!/bin/bash
# http://lukas-pirl.de/spin-offs 01/2010
################## BEGIN config ##################
# define as regular expression:
syspath_usb_at_docking="/devices/pci0000:00/0000:00:1a.7/usb1/1-5/1-5.*"
# need the username to send notifications to the desktop:
username="YouUserName"
################## END config ##################
# iterate through mounts (mtab and truecrypt):
echo "# query truecrypt and /proc/mounts for mounts..."
for mounted in $(truecrypt --text -l | cat /proc/mounts -)
do
	success=1
	# check if it is really a mounted _device_ (starting with /dev/):
	device=`/usr/bin/expr "$mounted" : '\(/dev/[^ ]*\)'`
	if [ "$device" != "" ]
	then
		# check if device is attached to the docking station:
		echo "# try to get sys path for $device..."
		if [ `/usr/bin/expr "$(/sbin/udevadm info --query=path --name=${device})" : "$syspath_usb_at_docking"` -gt 0 ]
		then
			echo "  # try to unmount $device..."
			/bin/umount $device || ( echo "# unmount failed - try unmount with truecrypt..."; /usr/bin/truecrypt -d $device || ( sudo -u "$username" notify-send -u critical -t 100000 "Undock error" "Could not unmount $device"; success=0 ) )
		else
			echo "  # sys path does not contain the path to the usb ports at the docking station"
		fi
	fi
done
if [ ${success} -eq 1 ]
then
	sudo -u "$username" /usr/bin/notify-send "Undock Complete!" "All file systems mounted via docking station unmounted!"
fi

Feel free to correct, enhance or customize the script. You can even contact the author of the script.