Installing Gentoo 2007.0 on a ThinkPad R61

From ThinkWiki
Revision as of 01:59, 22 January 2008 by Fuchs (Talk | contribs) (xmodmap: I see dead foxes!)
Jump to: navigation, search


Lenovo Thinkpad R61 7743-Y1B


This installation instruction describes the steps after a Gentoo 2007.0 base installation. Please read the gentoo handbook for installation instructions


- Keyboard, UltraNav input (Touchpad and NavPoint)

- Drives

- X11 with nVidia including acceleration

- Network, wireless network and bluetooth

- Sound

- Suspend to RAM

- ThinkLight


- ACPI (Battery, CPU Frequency, Fan, Temperature, ...)

- Fingerprint scanner (includes login and screen lock)

- Fn Key combinations

- Hot swapping of optical drive (UltraBay)

- HDD Acceleration Meter (can be used as an input device)

Not tested:

- Firewire (should work as it is recognized, no devices for testing)

- Suspend to disk (hibernate)

- Express Card Slot (should work)

- Harddisk protection (should work with patching)

- Docking Station (should work according to several sources)

Graphics: NVIDIA Quadro NVS 140M

To install and configure the nVidia driver, just emerge nvidia-driver. Tested with nvidia-driver-100.14.19, everything works fine, games run smooth.

Framebuffer works fine with vga=869 which will set the resolution to 1440x900. hwinfo --framebufer displays all supported resolutions.

The brightness can be changed with the new nvidia driver (169.04) which is a beta driver at the moment. Does not work with older drivers, only known workaround is to either use vesa / nv driver or to change the brightness on a vt.

Sound: AD1984

Did not work with older Versions of ALSA driver, works fine with ALSA 1.0.15 and should work with ALSA 1.0.14 as well. The in-kernel ALSA works since 2.6.23.

The mute button is hardwired and works, the volume up and volume down buttons work as well but you need to configure them first.

Note: After muting you have to press a volume up or down button to unmute, and the mute status is not displayed in any mixer application.

Network: Intel E1000 NIC, IPW4965abgn WNIC, Bluetooth

The integrated e1000 LAN NIC works out of the box.

For wireless you have to unmask and emerge the iwlwifi package with the ipw4965 USEFlag enabled.

Don't forget that the interface (wlan0) has to be set as up (ifconfig wlan0 up) before scanning and associating works.

Bluetooth works out of the box with blueZ. You can disable / enable bluetooth via proc, with a script similar to this one:

bluetooth=`head -n 1 /proc/acpi/ibm/bluetooth | awk '{print $2}'`
case "$bluetooth" in
        sudo sh -c "echo "enable" > /proc/acpi/ibm/bluetooth"
        sudo sh -c "echo "disable" > /proc/acpi/ibm/bluetooth"
exit 0

or directly with the proc interface. This script helps you to bind it to the Fn+F5 key combination.

Note that the hardware killswitch on the front works as well, but disables both bluetooth and WLAN

Ports: PCMCIA, USB, IEEE 1394 Firewire

PCMCIA port works out of the box, tested with an audigy pcmcia. I have no express slot cards available for testing.

The left hand usb ports generate an IRQ nobody cared error from time to time, Try to boot with irqpoll in your kernel line as suggested.

A BIOS Update might help as well, it is recommended to use the ThinkVantage Software Updater for windows for a BIOS Update. The error disappeared here and USB works fine.

Firewire is untested but should work, as the port is recognized and the module loaded.


The optical drive and hard drive work out of the box, at least with AHCI disabled in the BIOS.

If you run a dualboot system with windows <= 5.1 (XP) you want to disable AHCI anyway.



Works out of the box here, with scrolling. Have a look at my Xorg.conf section at the end

Can be disabled via synclient when using the synaptics driver, a possible solution is this script:

touchpad=`synclient -l | grep TouchpadOff | awk '{print $3}'`
case "$touchpad" in
        synclient TouchpadOff=0;
	echo "Touchpad Enabled" | osd_cat -d 1 -c cyan --font="-*-times-bold-r-*--34-240-*-*-p-*-*-*" -A center -p bottom
        synclient TouchpadOff=1;
	echo "Touchpad Disabled" | osd_cat -d 1 -c cyan --font="-*-times-bold-r-*--34-240-*-*-p-*-*-*" -A center -p bottom
exit 0

which needs xosd to display the current state. You can make it excecutable and map it to the fn+f8 button.


Works out of the box as well, with no scrolling however. Can be configured via xorg.conf, I prefer using the middle button as mouse3.


Works out of the box, most of the Fn Keys work.

Hardwired: Mute, Thinklight, Brightness

Generates a keycode and can be configured: Volume Down, Volume Up, Fn+F2, Fn+F3, Fn+F4, Fn+F5, Fn+F7, Fn+F8, Fn+Arrows

Does not generate a key event: Fn+F9, Fn+F12, Fn+Space Those keys do produce an acpi event, so you can modifiy your acpi configuration to bind them to commands.

It is also possible to translate the acpi events to keyevents, have a look at the following configuration file:

My example file for the missing keys is here and there is a good, more complete howto here: Gentoo Wiki

Try whether echo "0xffffffff" > /proc/acpi/ibm/hotkey enables additional fn+fx keys to produce a key event instead of only an acpi event.

Power Management

Suspend to RAM worked out of the box here, echo 3 > /proc/acpi/sleep puts the machine in suspend mode, opening it or pressing the power button wakes it up. Worked with nvidia driver and in X11. All devices came back without problems, wlan might have disconnected, but by using networkmanager, wicd or a good configuration it should reconnect after waking up. Works here with wicd.

Integrated Fingerprint Reader

Emerge the thinkfinger package, add a user with the tf-tool. Then you have to edit the /etc/pam.d/system-auth file by adding

auth sufficient

between pam.unix and pam.env.

Read the Gentoo-Wiki to use it with xscreensaver, there is a good solution over there

Note: kdm has problems with thinkfinger auth and might crash. There are patches, but I didn't test them yet. gdm works fine here.

Hard Drive Active Protection

The integrated harddrive active protection acceleration meter can be used as a joystick or to get information about movements of your thinkpad.

Emerge the hdapsd (which includes a kernel module you have to load) which will generate a joystick and an event device.

It could as well be used to protect your harddisk from damage, but I have not tested this and I wont, as I can't be arsed to use my backups just because I did some experimenting with my hdd.


The thinklight works out of the box with the Fn+PgUp key, but it can be controlled as well via the proc interface.

So you can write a nice script, which you can bind to events, such as incoming emails, to let the light flash.

A possible solution is this small script:


if [ -z "$1" ]
	echo "IBM ThinkLight Control script." 
	echo "2007 by Christian \"Fuchs\" Loosli."
	echo ""
	echo "usage: lightctl on | off | toggle | blink"
	echo "blink takes two arguments: times and time"
	echo "defaults (5 times, 0.5 seconds) are used if not specified"

	if [ $1 = "on" ]
    	       sudo sh -c "echo on > /proc/acpi/ibm/light"
	if [ $1 = "off" ]
   	       sudo sh -c "echo off > /proc/acpi/ibm/light"

        if [ $1 = "toggle" ]
		status=`cat /proc/acpi/ibm/light | grep status | awk '{print $2}'`

		if [ $status = "on" ]
			sudo sh -c "echo off > /proc/acpi/ibm/light"
			sudo sh -c "echo off > /proc/acpi/ibm/light"

	if [ $1 = "blink" ]


		if [ -z "$2" ]

		if [ -z "$3" ]

    	for i in `seq 1 $times`;
    		$0 toggle;
                sleep $time;
                $0 toggle;
                sleep $time
exit 0

which can be called to let the light blink or switch it off or on. The blink part is nice for setting to events such as incoming messages or emails.

(note: the thinklight is a LED, so it should not care on how fast and often you let it blink. But I am not responsible if this script damages your thinklight. Use at own risk.

Power saving

First of all, turn off all things you are not using, most of all bluetooth and W-LAN. You can use the killswitch on the front, it works out of the box.

You can use the application powertop by Intel to look for processes which prevent the CPU from longer sleep states.

It also gives you some recommendations on services to turn off.

Do _not_ turn off the optical drive polling by HAL.

Dimming the display also saves lots of power.

You can achieve about 2 - 3 hours of working time (no compiling or other heavy CPU / GPU usage applications) with the standard battery.

Configuration Files


Note that I use the XFont Server, you might have to change the font path.

Note as well that the modes given don't affect the modes available, as in this configuration the nvidia driver reads out the available resolutions which fit the monitor. You will only have 3 resolutions, but it saves lots of time spent on configuring frequencies otherwhise.

Read the nvidia documentation on how to disable this behaviour if you want the same resolutions as in windows or other OSes.

Section "ServerLayout"
	Identifier     "single head configuration"
	Screen         0 "Screen0" 0 0
        InputDevice    "Keyboard0" "CoreKeyboard"
	InputDevice    "Mouse0" "CorePointer" 
        inputDevice    "Touchpad" "SendCoreEvents"

Section "Files"
	FontPath     "unix/:-1"

Section "Module"
	Load  "dbe"
	Load  "extmod"
	Load  "glx"
	Load  "freetype"
	Load  "type1"

Section "InputDevice"
	Identifier  "Keyboard0"
	Driver      "kbd"
	Option	    "XkbModel" "pc102"
	Option	    "XkbLayout" "ch"

Section "InputDevice"
    Identifier	"Touchpad"
    Driver	"synaptics"
    Option	"Protocol"	"auto-dev"
    Option	"Device"	"/dev/input/mouse0"
    Option	"Emulate3Buttons"	"no"
    Option	"ZAxisMapping"	"4 5"
    Option	"LeftEdge"	"1700"
    Option	"RightEdge"	"5300"
    Option	"TopEdge"	"1700"
    Option	"BottomEdge"	"4200"
    Option	"FingerLow"	"25"
    Option	"FingerHigh"	"30"
    Option	"MaxTapTime"	"180"
    Option	"MaxTapMove"	"220"
    Option	"VertScrollDelta"	"100"
    Option	"MinSpeed"	"0.02"
    Option	"MaxSpeed"	"0.28"
    Option	"AccelFactor"	"0.0010"
    Option	"SHMConfig"	"on"
    Option	"UseSHM"	"true"

Section "InputDevice"
	Identifier  "Mouse0"
	Driver      "mouse"
	Option	    "Protocol" "ExplorerPS/2"
	Option	    "Device" "/dev/input/mice"
	Option	    "ZAxisMapping" "6 7"
	Option	    "buttons" "7"
	Option	    "Emulate3Buttons" "yes"

Section "Monitor"
	Identifier   "Monitor0"
	VendorName   "Monitor Vendor"
	ModelName    "Flat Panel 1400x950"
	Option	     "DPMS"

Section "Device"
	Identifier  "Videocard0"
	Driver      "nvidia"
	VendorName  "NVIDIA"
	BoardName   "NVIDIA GeForce FX (generic)"
	Option 	    "Coolbits" "1"
	Option      "AllowGLXWithComposite" "true"
	Option      "RenderAccel" "true"
	Option      "UseEvents"         "false"
	Option      "TripleBuffer" "1"
	Option      "DamageEvents" "1"
	Option      "BackingStore" "1"
	Option      "InitialPixmapPlacement" "2"
	Option      "RandRRotation" "true

Section "Screen"
	Identifier   "Screen0"
	Device       "Videocard0"
	Monitor      "Monitor0"
	DefaultDepth  24
	Option       "AddARGBGLXVisuals" "true"
	Option	     "UseCompositeWrapper" "true"
	SubSection "Display"
		Viewport  0 0
		Depth     24
		Modes    "1440x900" "1024x768" "800x600" 
	SubSection "Display"
		Viewport 0 0
		Depth 16
		Modes	"1440x900" "1024x768" "800x600" 
	        SubSection "Display"
	        Viewport 0 0
		Depth 8
		Modes   "1440x900" "1024x768" "800x600" 

Section "Extensions"
    Option "Composite" "Enable"

Section "DRI"
	Group        0
	Mode         0666


Note: you have to xmodmap /path/to/file this file in your autostart. You might have different keycodes, use the application xev to display them. It is highly recommended to use the XF86foobar buttons, as some applications will be preconfigured to them. If you want to map them by yourself use Fxx, while xx > 12.

! additional Arrow keys

keycode 233 = XF86Forward
keycode 234 = XF86Back

! Fn+arrow keys

keycode 144 = XF86AudioPrev
keycode 162 = XF86AudioPlay
keycode 153 = XF86AudioNext
keycode 164 = XF86AudioStop

! Fn+Fx keys  F2, F3, F4, F5, F7, F8, F9, F12  in this order

keycode 146 = XF86ScreenSaver
keycode 241 = XF86Display
keycode 223 = XF86Sleep
keycode 243 = XF86Send
keycode 214 = XF86Video
keycode 196 = XF86iTouch
keycode 197 = XF86Eject
keycode 165 = XF86Standby

! Space bar

keycode 148 = XF86ZoomIn

! volume control (mute is hardwired)

keycode 174 = XF86AudioLowerVolume
keycode 176 = XF86AudioRaiseVolume (acpid)

This is my slightly modified file to handle ibm hotbutton events. Of course you can add the other buttons as well, however, as they produce key events there are easier ways for configuring the actions. However, an acpi solution is window manager / X independent.

You can read out the key events, as they might differ on your model, with the acpi_listen application.

# /etc/acpi/

set $*


if [ "$group" = "ibm" ]; then
	key="$2"\ "$3"\ "$4"

log_unhandled() {
	logger "ACPI event unhandled: $*"

case "$group" in
		case "$action" in
				/sbin/init 0

			*)	log_unhandled $* 

		case "$action" in
				case "$key" in
					"HKEY 00000080 00001008")
						/usr/bin/acpi_fakekey 220	
					"HKEY 00000080 00001009")
						/usr/bin/acpi_fakekey 221
					"HKEY 00000080 00001014")
						/usr/bin/acpi_fakekey 222
						logger "acpid: $group/$action $key is not defined"

	*)	log_unhandled $* 

Note that I use acpi_fakekey to translate acpi to key events.

ACPI Fakekey

With this nice app you can translate acpi events into key codes.

I borrowed it from gentoos acpi-support, which borrowed it from Ubuntu people.

You can it out of the sunrise overlay, I recommend only getting the acpi-fakekey.c file and compile it.

For the lazy guys:

There is an explanation and the source code, which I wont copy and paste here, on this page:

Gentoo Wiki on Hotkeys

I use this in the file above to generate keycodes for Fn+F8, Fn+F9 and Fn+Space.