Installing openSUSE 10.2 on a ThinkPad X60

From ThinkWiki
Revision as of 20:59, 11 March 2007 by McCoy-Tyner (Talk | contribs) (What doesn't work yet)
Jump to: navigation, search

Lenovo ThinkPad X60 (model 1707-CTO / model 1706-8GG)

Hardware Details

  • Intel Core Duo T2400 (1.83GHz, 2MB L2, 667MHz FSB)
  • 2GB RAM (2 NonParity DDR2 SDRAM SoDIMM PC2-5300)
  • Intel Graphics Media Accelerator 950 / 945GM on 1706GG
  • 12.1 inch XGA (1024x768) (Lenovo LTN121XJ-L07)
  • 80GB, 5400rpm Serial ATA (Hitachi HTS541080G9SA00) / 100GB Serial ATA on 1706GG (Toshiba MK1034GSX)
  • Intel PRO/1000 Gigabit Ethernet
  • Intel PRO/Wireless 3945ABG
  • Bluetooth
  • Firewire
  • SD Card Reader
  • 56K V.92 Modem

Software Details

Installation procedure

Setup

Since I didn't get a dock or usb CDROM with this machine, I started the installation procedure using a USB Stick. I followed these instructions to set up a boot USB key. This contains GRUB and the loader for the installer. The actual installation media was on an NFS share. To set this up, copy the contents of the CDS/DVD into a directory (or mount the DVD iso image loopback) then share the directory containing CD1 via NFS, is the simplest way. Sharing the DVD as a SMB share works from windows, too.

Using the ultra-bay DVD-drive is straightforward as it is detected at startup and can be booted from. Nothing special about this.

Installation

Press F12 during POST to get the boot selector menu up, choose the USB Key. This boots into GRUB. Press F4 here to set the installation source to NFS or SMB as needed, and enter the server details. For example, with SMB, enter the server name, the name of the share, and the directory where the first CD's contents are, eg 'CD1'. Now the installer is loaded from the share and proceeds as a usual SUSE install. No special steps are required during the install, but read the documentation about preserving or moving the ThinkVantage rescue partition before you commit to the installation.

NOTE!
After installing the software, the installer reboots into the installed system to configure it, as usual. Note that because it was booted from a USB key, GRUB has been installed onto the key instead of the hard disk. You can correct this after the configuration is completed, but for now, keep the USB key inserted, boot from that again. The GRUB menu boots the installed system from the hard disk, just like the old days with LILO and a boot floppy. Once the installation and you're logged in, start YaST2, go to System, Bootloader, and change the boot loader location to its proper location (I recommend the boot or root partition with the Generic MBR option). Now the laptop can boot on its own.

What works out of the box

Hardware

  • Ethernet adaptor
  • Intel 3945ABG Wireless ethernet adapter
  • GMA950 graphics with 3D acceleration with integral monitor
  • Sound playback
  • USB
  • Bluetooth (with kbluetoothd, gets about 55kB/s with OBEXFTP)
  • Trackpoint
  • SD card reader

Power management etc

  • Suspend to disk (Fn+F12)
  • Suspend to RAM (Fn+F4)
  • Disable display (Fn+F3)
  • CPU speed stepping (required BIOS update to 2.05 though)
  • LCD Brightness depending on current power scheme, via KPowersave and HAL

Extra keys

  • Volume control, keyboard light and screen brightness control
  • Lid switch (LCD off when lid closed, resume from suspend to RAM when opened)
  • Multimedia keys with KMix and Amarok
  • Browser back/forward keys with Konqueror

What had to be configured by hand

  • Mouse wheel emulation, set "Emulate Mouse wheel with button 2" in SaX2 mouse settings
  • Keyboard dead keys for international characters, set "Right Alt is Compose" in SaX2 keyboard settings, then ralt-shift-2, a => ä
  • Sound recording, using KMix or other mixer, set the mic as capture source, turn it up, enable and turn up 'Capture' channel.
  • FN-F2 initially does nothing. This requires extra tweaking.
  • FN-F7 doesn't work either. Even though ibm-acpi module may be loaded, the video-switch facility does not work.
  • The finger print reader, a working driver is existing.
  • By default the fan runs all the time. If power management on the ipw3945 is enabled, it only runs about 1/3 of the time. Use 'iwpriv eth1 set_power 7' to enable power management - this comes at the cost of increasing latency when using wireless. See the ipw3495 README for details.

Accessing the nvram - device

The default permissions of the nvram device prevent the screen sliders for brightness / volume etc. from being displayed for non root users. To circumvent this problem, a modification of an entry should be made within /etc/udev.d/hooks/50-udev-default.rules:

replace

KERNEL=="nvram",               GROUP="kmem", MODE="600"

by

KERNEL=="nvram",               GROUP="users", MODE="640"

and every user is able to read from nvram. This ensures that the sliders are displayed when modifying the brightness or the volume.

Automatic power switching for ipw3495

This procedure can be automatized:

Create a script switch_wireless_mode in /usr/lib/powersave/scripts and make it executeable:

#!/bin/bash
###########################################################################
#                                                                         #
#                         Powersave Daemon                                #
#                                                                         #
#          Copyright (C) 2004,2005 SUSE Linux Products GmbH               #
#                                                                         #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the   #
# Free Software Foundation; either version 2 of the License, or (at you   #
# option) any later version.                                              #
#                                                                         #
# This program is distributed in the hope that it will be useful, but     #
# WITHOUT ANY WARRANTY; without even the implied warranty of              #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU       #
# General Public License for more details.                                #
#                                                                         #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., #
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA                  #
#                                                                         #
###########################################################################
#
# change mode for the wireless network card on X60 lenovo laptop
# currently the interface name needs to be set manually.
#
#

IWPRIV="/usr/sbin/iwpriv"
MODEPARAM="set_power"
POWERSCHEME="6"
BATTERYSCHEME="7"
IF="eth1"

. ${0%/*}/helper_functions

if [ $EVENT_TYPE != ACADAPTER ]; then
    DEBUG "switch_wireless_mode only makes sense for acadapter events ;-)" WARN
else
    if [ "$1" = "acadapter.online" ]; then
        ${IWPRIV} ${IF} ${MODEPARAM} ${POWERSCHEME}
    fi
    if [ "$1" = "acadapter.offline" ]; then
        ${IWPRIV} ${IF} ${MODEPARAM} ${BATTERYSCHEME}
    fi
fi
$SCRIPT_RETURN $EV_ID 0 "switch_wireless_mode finished"
EXIT 0

Finally only two lines have to be modified "on top" of this to make powersaved aware of this script. This ought to happen in /etc/sysconfig/powersave/events:

## Path:                System/Powermanagement/Powersave/Events
## Type:                string
EVENT_ACADAPTER_ONLINE="reread_cpu_capabilities switch_wireless_mode"
EVENT_ACADAPTER_OFFLINE="reread_cpu_capabilities switch_wireless_mode"

"switch_wireless_mode" should be added to the EVENT_ACADAPTER_ONLINE and EVENT_ACADAPTER_OFFLINE as shown above. Given this, the x60 will switch to low power mode when running on battery and back to high power mode when running on mains automatically.

But be warned: if for any reason the device ID of the wireless adapter should differ from eth1 you will have to edit the file switch_wireless_mode accordingly.

Doing a test

iwpriv eth1 get_power

should make it clear whether everything works as expected, the return values should differ between mains plugged and mains unplugged.

Activating FN-F2 and FN-F7

Both keys FN-F2 and FN-F7 create acpi events. This can be seen easily by performing a "tail -f /var/log/acpid" and pressing one of those combinations, however, in the initial state of the installation nothing happens afterwards. The following description shows how to make both keys do what you would expect them to.

FN-F2: blocking the screen as soon as FN-F2 is pressed

Firstly I have to point out that this description is referring to kde - users, I am highly convinced that there exists a similar program on gnome for locking the screen but I simply do not know (and did not test). Therefore your mileage may vary.

Locking the screen may be realized by calling: /opt/kde3/bin/kdesktop_lock --forcelock This works from within a kdesktop, however, if you perform this call from a deamon you do not have access to a X11-screen / a kde session. To circumvent this, the call is executed as the user that is currently owning the screen ":0" through sudo. See the patch for "dockhandler" below.

FN-F7: switching video outputs

Every attempt to make

echo "video_switch" > /proc/acpi/ibm/video

work failed. Luckily there is a tool available from Ken Mano at http://www16.plala.or.jp/mano-a-mano/i810switch.html that can be patched to make video switching work on x60.

The chip i945 on the x60 should be treated like a i855, so the patch that needs to be applied is:

--- i810switch-0.6.5/i810switch.c.original	2005-06-12 06:36:36.000000000 +0200
+++ i810switch-0.6.5/i810switch.c	2007-02-28 15:05:49.000000000 +0100
@@ -60,6 +60,7 @@
 #define I855STR			"8086:3582"
 //#define I865STR			"8086:2572"
 #define I915STR			"8086:2592"
+#define I945STR			"8086:27a2"
 #define MEMSTR			"Memory at"
 #define NONPRSTR		"32-bit, non-prefetchable"
 
@@ -272,7 +273,8 @@
 			return p;
 		}
 
-		i = (p = strstr(*buff_ptr, I855STR)) != NULL;
+		i = (p = strstr(*buff_ptr, I855STR)) != NULL ||
+		    (p = strstr(*buff_ptr, I945STR)) != NULL;
 		if (i)
 		{
 			*chiptype = I855;

After this, the tool should be compiled and installed. I can provide RPM's for openSUSE 10.2 on request.

What is missing now is the interfacing between FN-F7 and i810switch and i810rotate. The latter should be used as it rotates from LCD-Only - LCD+CRT - CRT-Only with every new call.

Patching dockhandler

I included this in dockutils (/usr/lib/dockutils from dockutils-01), however, there are several optional ways how to do this. The patch in use is depicted below:

--- dockhandler 2006-11-06 18:22:37.000000000 +0100
+++ dockhandler 2007-03-02 12:44:53.000000000 +0100
@@ -70,6 +70,12 @@
        elif [ "$SER" -eq 4107 ]; then # Fn+F9
            ACTION=dock
        fi
+       if [ "$SER" -eq 4098 ]; then # Fn+F2
+           ACTION=lockscreen
+       fi
+       if [ "$SER" -eq 4103 ]; then # Fn+F7
+           ACTION=videotoggle
+       fi
     elif [ "$EVENT" = "ibm/dock" ]; then
        case $VAL in
            0)  # X32 has strange dock code
@@ -81,7 +87,7 @@
     fi
 fi

-export MODEL=`hal-get-property --udi /org/freedesktop/Hal/devices/computer --key smbios.system.version`
+export MODEL=`hal-get-property --udi /org/freedesktop/Hal/devices/computer --key smbios.system.version | sed "y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/"`

 if [ -n "`echo $MODEL | grep -i thinkpad`" ]; then
     HOOKDIR=thinkpad
--- hooks/thinkpad/60x60        2006-11-05 02:35:17.000000000 +0100
+++ hooks/thinkpad/60x60        2007-03-02 12:18:37.000000000 +0100
@@ -6,10 +6,25 @@
 #
 # This file is released under the GPLv2.
 #
+# Modifications by Dr. Ing. Dieter Jurzitza / enhanced features
+#

 . common_functions

-[ "$MODEL" == "Thinkpad X60" ] && exit 0;
+[ "$MODEL" = "THINKPAD X60" ] || exit 0;
+
+video_toggle(){
+    echo x60 video_toggle
+    /usr/sbin/i810rotate
+}
+
+lock_screen(){
+    echo x60 lock_screen
+    APPLICATION="/opt/kde3/bin/kdesktop_lock"
+    [ -f ${APPLICATION} ] || exit 0
+    USER=`/usr/bin/who -u | /bin/awk '{if(match($2, ":0")){print $1}}'`
+    sudo -u ${USER} /bin/bash -l -c "export DISPLAY=:0.0; ${APPLICATION} --forcelock &"
+}

 if [ "$1" = "dock" ]; then
     echo x60 dock
@@ -18,4 +33,12 @@
 elif [ "$1" = "undock" ]; then
     echo x60 undock
     unregister_cdroms
+
+elif [ "$1" = "videotoggle" ]; then
+    echo x60 video toggle
+    video_toggle
+
+elif [ "$1" = "lockscreen" ]; then
+    echo x60 lock screen
+    lock_screen
fi

This patch does two things: firstly it repairs a bug in dockutils. The comparison [ "MODEL" == "Thinkpad X60" ] && exit 0; ensures that the file 60x60 is processed for each notebook not named "Thinkpad X60" what is not what was meant here.

Functionally both the FN-F2 and FN-F7 keys are tested in dockhandler. Events are assigned that are called "lockscreen" for FN-F2 and "videotoggle" for FN-F7, correspondingly. The event "lockscreen" in turn triggers the function call "lock_screen()" from within 60x60, the same holds true for the event "videotoggle" and the function call to "video_toggle". Please make sure that the path to i810rotate in "video_toggle()" fits to your system environment.

After this, both keys FN-F2 and FN-F7 should do what you expect them to do. FN-F2 is adapted for the usage of kde, so your mileage may vary if you want to adapt it to gnome or other window managers.

Activating the internal modem

Choosing the right modem driver

The internal modem can only be used with the hsfmodem-package that is available from http://www.linuxant.com. The current version is hsfmodem-7.60. I recommend *not* to use the "openSUSE" package but to switch to the "generic" package as the latter one rebuilds the module if the kernel version does not match. My experiments with the slmodem package have failed.

Suspend2ram / Suspend2disk issues with the modem driver

Installing this module encorporates issues with suspend2disk / suspend2ram. These are twofold. On one hand you have to make sure that the modules are being unloaded before performing a suspend2ram / suspend2disk process. Otherwise you will observe crashed. On the other hand the unloading of the intel sound module that is replaced by the hsf-package does not work as expected if i. e. kmix is running.

But step by step. First of all it must be ensured that the module is unloaded for sure if a susped2disk / suspend2 ram action should be performed. This can be achieved as follows:

This is done by placing a script in /etc/pm/hooks, I have chosen the name "08softmodem" and made it executable:

#!/bin/bash

. /etc/pm/functions

case "$1" in
        hibernate|suspend)
                /etc/init.d/hsf stop
                ;;
        thaw|resume)
                /etc/init.d/hsf start
                ;;
        *)
                ;;  
esac

exit $?

Secondly, given you want to unload this you have to make sure that the soundmodule is not bound to kmix any more. Therefore I created a second script called 06kmix located in the same directory to make sure that it is processed before the unloading of the modules is actually being processed:

#!/bin/bash

. /etc/pm/functions

KMIXPID=`ps ax | awk '{if (match($5, "kmix")){print $1}}'`

case "$1" in
        hibernate|suspend)
                kill -SIGHUP $KMIXPID
                ;;
        thaw|resume)
                ;;
        *)
                ;;
esac

exit $?

If both scripts are in place, suspending and resuming should work, however, kmix will be halted when you get out of the suspend and it will not restart automatically. I had received a suggestion to restard it using an event of kpowersaved did not work for me. But I realized it using a different technique. I created a script called /home/<username>/.kde/Autostart/restartkmix with the following contents. It should be executeable as well:

#!/bin/sh
SLEEP=10
while [ 1 ]; do
        PROCNUM=`ps ax | awk '{if(match($0," kmix")&&(!match($0,"awk"))){print $1}}'`
        if [ "${PROCNUM}" = "" ]; then
                kmix -autostart
        fi
        sleep $SLEEP
done

This generates a small amount of system load every 10 seconds but I think this is neglible. If kmix is not running it is restarted. This works for perfectly for me.

Activating the fingerprint reader

There is a description of the fingerprint reader project at another location in this wiki (http://www.thinkwiki.org/wiki/Integrated_Fingerprint_Reader). The package (currently thinkfinger-0.2.2,tar,gz) should be downloaded, untared, built and installed. After that, you will have to do three things in addition:

1.) you need to modify /etc/pam.d/common-auth:

#%PAM-1.0
#
# This file is autogenerated by pam-config. All changes
# will be overwritten.
#
# Authentication-related modules 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    required        pam_env.so
auth    sufficient      pam_thinkfinger.so
auth    required        pam_unix2.so

the line containing pam_thinkfinger.so needs to be added.

2.) you have to add a fingerprint from you. This is precisely described in the documentation of the thinkfinger package.

3.) you should change your default displaymanager to gdm, otherwise you will be able to use the fingerprint-reader only in console applications. This can be achieved by setting

DISPLAYMANAGER=gdm

in /etc/sysconfig/displaymanager.

openSUSE bug - make irqbalancer work

If you installed the "irqbalancer" package you probably realized that it is not running. Calling "/etc/init.d/irq_balancer status" will return "unused". Doing a "cat /proc/interrupts" will show all interrupts on CPU 0, CPU 1 will not process any interrupt. To solve this problem you should edit /etc/init.d/irq_balancer manually. Change the line

start)
        echo -n "Starting irqbalance "
        if [ $PHYS -gt 1 ] || [ $PROC -gt 1 -a $PHYS -eq 0 ] ; then

into

start)
        echo -n "Starting irqbalance "
        if [ $PHYS -gt 1 ] || [ $PROC -gt 1 -a $PHYS -eq 1 ] ; then

$PHYS should be compared to 1, not to 0. After restarting irq_balancer, the interrupts should be shared between cpu 0 and cpu 1 now.

PCMCIA - slot

There is nothing special to say about the PCMCIA-slot. It just works (for me).

What doesn't work yet

  • Xinerama with external LCD
  • Dual head with external LCD

What I haven't tested yet

  • Firewire
  • Embedded Security Subsystem (TCPA)
  • Active Protection System (HDAPS)
  • Maximum battery life

lscpi

> lspci
00:00.0 Host bridge: Intel Corporation Mobile 945GM/PM/GMS/940GML and 945GT Express Memory Controller Hub (rev 03)
00:02.0 VGA compatible controller: Intel Corporation Mobile 945GM/GMS/940GML Express Integrated Graphics Controller (rev 03)
00:02.1 Display controller: Intel Corporation Mobile 945GM/GMS/940GML Express Integrated Graphics Controller (rev 03)
00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 02)
00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 02)
00:1c.1 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 2 (rev 02)
00:1c.2 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 3 (rev 02)
00:1c.3 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 4 (rev 02)
00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #1 (rev 02)
00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #2 (rev 02)
00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #3 (rev 02)
00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #4 (rev 02)
00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev e2)
00:1f.0 ISA bridge: Intel Corporation 82801GBM (ICH7-M) LPC Interface Bridge (rev 02)
00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 02)
00:1f.2 SATA controller: Intel Corporation 82801GBM/GHM (ICH7 Family) Serial ATA Storage Controller AHCI (rev 02)
00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 02)
02:00.0 Ethernet controller: Intel Corporation 82573L Gigabit Ethernet Controller
03:00.0 Network controller: Intel Corporation PRO/Wireless 3945ABG Network Connection (rev 02)
15:00.0 CardBus bridge: Ricoh Co Ltd RL5c476 II (rev b4)
15:00.1 FireWire (IEEE 1394): Ricoh Co Ltd R5C552 IEEE 1394 Controller (rev 09)
15:00.2 Generic system peripheral [Class 0805]: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 18)