Installing Debian Lenny on Lenovo X61s

My old DELL D410 laptop reached the end of its life and I started to look for some appropriate replacement. DELL is great for its world wide service. You just pick the phone, call a technician, explain the problem and the next day there is a specialist ready to fix the problem knocking on your door. What is not so great on DELL is their Linux support, they somehow support servers but Linux on laptops is not supported at all. Linux on D410 works also fine, but it took me a quite long to get all working well.

IBM/Lenovo has a good reputation in the linux community, so I decided that the next laptop will be Lenovo. I was thinking about Lenovo X300, the flag ship in their black fleet. No matter how expensive X300 is, it is hard to get to one. I completely failed to find a shop in Prague, where I could play with one (I'm speaking about April and May 2008). At the end of May I decided to give it up and start searching in more distant places. Finally, I found Orange & Green in Brno. I was very surprised how I was treated by them. They borrowed me X300 for one week, I also got permission to install Linux over pre-installed MS Vista it came with. I'm sure they do not lend X300 to everyone who asks, but still it was great. We spend a lot of money on the DELL hardware, our server platform is almost uniquely based on the DELL servers, but as far as I know they never lend us a hardware to test before buying it. I really appreciate the service I received from Orange & Green. Thanks!

Why I'm writing about installing Debian on X61s and not on X300? Because of the display. My eyes are not excellent but also not bad, I'm wearing light glasses - only 0.25 dioptres per eye. The display on X300 have resolution 1400x900 it's perfectly sharp, has a good contrast, but everything is so small on it. I had difficulties when reading wrongly coded web pages with fixed sizes hard coded in pixels. Now with improved zooming in Firefox 3.0 I might be able to use X300, but there are still too many other applications which use bitmap fonts and where it is hard to zoom text. I also do not like wide screen, who is going to watch DVD on laptop? Wide screen display only made the laptop 5cm wider. X61s offers resolution 1024x768 I'm used to, it has the same physical dimensions of the display as my old D410 but within thinner frame. SSD drive would be very nice, but I could wait year/two until they get cheaper. That is why I decided for X61s over X300.

Content

My laptop configuration

Model Lenovo X61s 7669-3KG
CPU: Intel(R) Core(TM)2 Duo @ 1.60GHz (L7500)
RAM: 4GB; under 32bit kernel are visible only 3GB, installing amd64 kernel fixes the problem but breaks hibernation
HDD: 160GB spinning at 5400rpm (HITACHI HTS542516K9SA00); it's silent and deliver decent speed.
Graphics: Intel X3100 + 12.1'' TFT display with 1024x768 resolution
Network card: Intel Gigabit Ethernet
Wireless: Intel PRO/Wireless 4965AGN
Other HW: AD1984 HD Audio, Fingerprint Reader, SD/HSCD card reader, CardBus slot, FireWire, Analog modem

Basic installation

I did the basic installation from the Debian Etch installation disk using an external USB DVD-ROM drive (the laptop can have DVD-ROM installed in the docking station which I do not own). After booting into the new system I have replaced distribution code name "etch" by "lenny" in /etc/apt/source.list and executed commands `apt-get update && apt-get dist-upgrade` to upgrade to Debian Lenny (at the time of writing in the testing state). I decided for upgrade, because much needed software, especially the X.org driver for the Intel X3100 video card is missing in Debian Etch.

Because I was planning to do final configuration during my business trip to Berlin, I downloaded all 5 Debian Lenny DVDs to save my bandwidth on the trip. I setup /etc/fstab:

/home/debian-lenny/debian-testing-i386-DVD-1.iso /mnt/debian/dvd1 auto loop
/home/debian-lenny/debian-testing-i386-DVD-2.iso /mnt/debian/dvd2 auto loop
/home/debian-lenny/debian-testing-i386-DVD-3.iso /mnt/debian/dvd3 auto loop
/home/debian-lenny/debian-testing-i386-DVD-4.iso /mnt/debian/dvd4 auto loop
/home/debian-lenny/debian-testing-i386-DVD-5.iso /mnt/debian/dvd5 auto loop

and /etc/apt/source.list:

deb file:/mnt/debian/dvd1/debian lenny main contrib
deb file:/mnt/debian/dvd2/debian lenny main contrib
deb file:/mnt/debian/dvd3/debian lenny main contrib
deb file:/mnt/debian/dvd4/debian lenny main contrib
deb file:/mnt/debian/dvd5/debian lenny main contrib

At this moment Lenny is missing XEmacs21 so I have installed it from Sid, but the rest of the installation was easy and pleasant.

X11, display, VGA out

The graphical card is Intel X3100 which is the part of the used 965GM chipset, it works with xserver-xorg-video-intel (version 2:2.3.1-1) perfectly. The 3D acceleration seems to be working, glxgears shows "5701 frames in 5.0 seconds = 1140.104 FPS". Playing movies in mplayer is fine, but RealVideo player version 11 in Firefox 3.0 isn't able to play videos from Czech Television :(

The display has resolution 1024x768 pixels, colour reproduction is slightly greenish comparing to my desktop EIZO monitor but not as strong as I experienced on X300. I'm pleased how it acts on the direct sunlight. With the white background and the black text its perfectly readable. The display of my old D410 was unreadable in the same conditions.

VGA output can't be activated by pressing <Fn>+<F7> I must run `xrandr --output=VGA --auto` to activate it and `xrandr --output=VGA --off` to disable it. The key combination <Fn>+<F7> creates the key code 214 named XF86Display. It could be possible to setup helper script to execute these commands.

Brightness control

The display brightness can be controlled by the file /proc/acpi/video/VID1/LCD0/brightness. Events generated by the keys <Fn>+<Home>/<End> were captured by gnome-power-manager but only the brightness window was displayed and no action happened. When I removed gnome-power-manager, the system started to execute /etc/acpi/video_brightnessup.sh and after rewriting it, the brightness control actually started to work.

Keyboard

The keyboard has a bit harder keys than the one from DELL. The layout is a bit different, that's no surprise. At the beginning I saw as many help pages as never before. It was because the <ESC> key is placed above the <F1-12> keys. ;) After a few days I learned this difference. The switch of the <Fn> and <Ctrl> keys is much harder to learn. It is annoying because <Ctrl>+<F4> is closing tab in Firefox and <Fn>+<F4> is putting laptop into suspend. Most likely I will disable <Fn>+<F4> pretty soon.

The browser keys serve for forward and backward navigation in a web browser. Firefox 3.0 has support for this functionality with the XF86Back and XF86Forward key symbols. The keys can be mapped to those symbols by the command `xmodmap .xmodmap-browser-keys`. The content of the .xmodmap-browser-keys file:

keycode 234 = XF86Back
keycode 233 = XF86Forward

Trackpoint

I'm used to a touchpad, I never had a laptop only with a trackpoint. I'm fine with the default Lenovo's trackpoint sensitivity, but I was desperately missing scrolling function. Later I've discovered that it's possible to enable it, just add:

Section "InputDevice"
        Identifier  "Configured Mouse"
        Driver      "mouse"

        Option      "CorePointer"
        Option      "Device"              "/dev/input/mice"
        Option      "Protocol"            "ExplorerPS/2"
        Option      "Emulate3Buttons"     "on"
        Option      "Emulate3TimeOut"     "50"
        Option      "EmulateWheel"        "on"
        Option      "EmulateWheelTimeOut" "200"
        Option      "EmulateWheelButton"  "2"
        Option      "YAxisMapping"        "4 5"
        Option      "XAxisMapping"        "6 7"
        Option      "ZAxisMapping"        "4 5"
EndSection

to your xorg.conf. Then press the middle button and use the trackpoint to scroll, both axis are working. I must admit that this way of scrolling is faster and easier to use than touchpad! By the command `echo -n 1 > /sys/devices/platform/i8042/serio1/press_to_select` it's possible to enable tap-to-click feature. It's a bit hard to my taste, but after a while of training I'm able to use it even for moving messages in Thunderbird. Before you start to experiment with this feature, I suggest you to install ConfirmFolderMove which can protect you from accidentally moved folders by asking for confirmation.

For more info see ThinkWiki article "How to configure the TrackPoint".

Suspend & Hibernation

The hibernation package was interfering with the uswsusp package and the laptop was unable to resume correctly from the hibernation. After I removed the hibernation package resume started to work correctly. Now I can use the command `s2ram` to suspend the laptop and the command `s2disk` to hibernate it. The keys <Fn>+<F4> and <Fn>+<F12> were not working until I removed the gnome-power-manager.

Do not remove the hal package, it's necesary for proper restoring the state of the video card after resume.

Even after all those changes the laptop was not going to sleep when I closed the lid. I had to modify the script /etc/acpi/lid.sh to get this feature working. Also the gnome-screensaver was unable to lock the screen when it was called from lid.sh or from sleepbtn.sh - it was complaining about some problems with DBus. I switched to XScreenSaver which works just fine. Only slight modification to /etc/acpi/sleepbtn.sh was needed. I was modifying scripts from the version 0.109-3 of the acpi-support package. I didn't modify with the hibernation script because my hibernated laptop is protected by the startup password. If you do not use the encrypted root drive you might need to adjust those scripts to lock screen.

After resume I experience the delay about 10 seconds before the machine starts to respond, so far I did not find the neither reason nor the solution.

Network card

The network card is "00:19.0 Ethernet controller: Intel Corporation 82566MM Gigabit Network Connection (rev 03)" it works with the e1000e module even in Debian Etch. I've only little experience with it, I used it only for the basic installation.

Wireless card Intel 4965AGN

The wireless card is "03:00.0 Network controller: Intel Corporation PRO/Wireless 4965 AG or AGN Network Connection (rev 61)". Drivers are a bit tricky. With the kernel 2.6.18 it doesn't work at all, with the kernel 2.6.24 it somehow works but when used on an 801.2x network it very often crashes with message "iwl4965: Microcode SW error detected. Restarting 0x2000000". I had to upgrade to the kernel 2.6.25-2 from Debian Sid to get it works, but it is still not 100% reliable and sometimes when I'm re-connecting to a wireless network I see those 0x200... errors.

The kernel 2.6.25-2 is using the driver version 1.23, there is version 1.25 available on the web pages of the iwlwifi. I'm planning to test it before I fill the bug report. Changlelog doesn't speak about any serious change since 1.23.

The LED designed to display the active WiFi connection isn't working for me.

HOT right palm rest!

After a while of work the right palm rest get so hot that I'm unable to keep my finger on the fingertip reader for more than two seconds. There is hidden the wireless card under the right palm rest. This is very annoying design bug of Lenovo X61s. Upon the request of the service technician I disassembled my new laptop, the photo is here. I also found page at notebokreview.com about this problem, it seems that some models of X61s have one more fan installed. Sadly my laptop doesn't have it. I do not have even chance to install one because the connector for connecting it is missing. The outcome from my discussion with the Orange & Green technical support is that only the laptops with a WAN card inside should have the secondary fan.

I'm very disappointed by this. Putting heat source so close to users hands is very stupid. Saving 1 euro for not installed fan is also stupid, but saving 1 cent for not installing connector is dead brain idea! This machine is EXPENSIVE, why do they save money for something so cheap? :(

By experimenting and by reading Internet forums I've discovered some tricks to lower temperature to an acceptable level:

  • in BIOS set laptop power management to Maximum Batter even when on AC
  • execute echo 5 > /sys/bus/pci/drivers/iwl4965/*/power_level after inserting the iwl4965 module into the kernel
  • put some isolation between the wireless card and the cover, I used piece of carton from transport box
  • remove the Intel Turbo Cache, it's supported only under M$ Vista and it might produce some more heat

Bluetooth

Bluetooth can be activated by pressing <Fn>+<F5> but this event kills the WiFi connection. I prefer controling bluetooth by the command `echo enable >/proc/acpi/ibm/bluetooth` which is safe to the WiFi connection.

I use bluetooth for connecting with my Nokia E51 cell phone to Internet. You might find useful my configuration files: /etc/bluetooth/rfcomm.conf, /etc/ppp/peers/GPRS, /etc/chatscripts/GPRS2.

Sound

lspci identifies the audio device as "00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 03)". With the kernel 2.6.25-2 the playback works fine, I didn't tested the internal microphone, yet. The laptop itself has only one small speaker located in the middle of the palm rest, it's good just for YouTube videos, but with my headphones the sound quality is good.

The mute and volume buttons were working automatically.

USB Mass Storage

To get auto mount of the USB mass storage devices correctly working I had to remove the gnome-mount package (it causes the error "Cannot open /media/.hal-mtab" in Nautilus) and install the usbmount and the pmount packages. The usbmount package required to modify the /etc/usbmount/usbmount.conf configuration file to start work with VFAT formatted USB Flash Drives.

usbmount offers the possibility to write scripts which are executed after mounting the USB mass storage device. It can be useful for automatic umount of additional partitions with MS Windows software, which are sometimes added to the USB Flash Drives as "added" value. I wrote a simple script for this purpose. Put it into the /etc/usbmount/mount.d directory and do not forget chmod +x it.

pumount is needed to umount devices mounted by root, it allows umounting without matching /etc/fstab when the device is mounted into the /media directory.

SD/HSCD card reader

The SD/HSCD card reader is working without any tweaking. When I insert card the kernel logs:

kernel: [29053.919809] mmc0: new high speed SDHC card at address d555
kernel: [29053.919809] mmcblk0: mmc0:d555 SU08G 7977472KiB
kernel: [29053.919809]  mmcblk0: p1

The card is not mounted automatically, not a serious issue for me as I'm not planning to use this too often.

Fingertip reader

The finger tip reader is a cool device. It allows me to log in and unlock the locked screen just by finger touch. WOW! The setup is very well described on ThinkWiki I had only add uinput module loading into the /etc/modules file.

The needed packages are now the part of Debian experimental, save your time on compiling and download them from there: deb ftp://mirrors.kernel.org/debian/ experimental main contrib non-free.

This device provides the false sense of security. By touching things around, I'm leaving my password easily accessible literally to anyone. Read more in an article of the Chaos Computer Club and watch video about forging fingertips.

Better do not enable this feature. Shame, that Lenovo put inside this toy and saved money on secondary fan. :(

Acceleration sensors

X61s has acceleration sensors which can help the operating system to secure the hard drive heads before impact of the laptop on the floor. I'm pretty curious if this really can work. When I drop my laptop from 1 m to the floor the operating system have only 100 ms to detect fall and clear the drive heads of its surface. There is IBM Active Protection System Whitepaper. I learned from there that the operation system running on the laptop has to constantly analyse data from the acceleration sensors and try to predict fall. Clearing the hard drive heads itself takes 300-500 ms.

For enabling this feature in Linux a kernel patch is reqired, I'm waiting until it gets into the stock Debian kernels. Read more on ThinkWiki pages HDAPS and Active Protection System.

Except protecting the hard drive, the sensors can be used for fun. Application hdaps-gl can show the orientation of my laptop. Or I can play with gravitation in Neverball game.

To get sensors work I had to do:

apt-get install tp-smapi-source libsmapi-dev sysfsutils hdaps-utils neverball
module-assistant prepare tp-smapi
module-assistant auto-install tp-smapi
rmmod hdaps
modprobe tp_smapi
modprobe hdaps

Fan

The automatic fan control is weird, until the CPU temperature reaches 50 °C it does nothing, after that it set the fan to 3800 rpm and resumes doing nothing even under heavy load which caused the CPU and the GPU temperature rise over 70 °C.

I wrote a simple script to get table of possible fan speeds:

Level = full-speed; Avg. speed = 4887 rpm
Level = 7;          Avg. speed = 4454 rpm
Level = 6;          Avg. speed = 4423 rpm
Level = 5;          Avg. speed = 3806 rpm
Level = 4;          Avg. speed = 3834 rpm
Level = 3;          Avg. speed = 3823 rpm
Level = 2;          Avg. speed = 3285 rpm
Level = 1;          Avg. speed = 3296 rpm
Level = 0;          Avg. speed =    0 rpm

The ThinkWiki is full of stories about Thinkpad's fans. There are also a few scripts designed to do better job than the firmware. I have chosen tpfand, it provides packages for Ubuntu but they work under Debian Lenny too. By using nice graphical tpfan-admin, I created tpfand profile for my X61s. My profile doesn't make laptop more silent, but by allowing maximum speed of fan it helps to faster cool after an intensive computation.

Sensors

Temperature and fan sensors are supported by the coretemp module, output of the sensors command is not very nice because of error messages complaining about missing sensors. I prefer using /proc/acpi/ibm/thermal and /proc/acpi/ibm/fan provided by the thinkpad_acpi module.

$ cat /proc/acpi/ibm/fan
status:         enabled
speed:          3357
level:          1
commands:       level <level> (<level> is 0-7, auto, disengaged, full-speed)
commands:       enable, disable
commands:       watchdog <timeout> (<timeout> is 0 (off), 1-120 (seconds))

$ cat /proc/acpi/ibm/thermal
#                1  2  3  4  5    6  7    8  9 10   11   12   13   14   15   16
temperatures:   42 38 38 38 30 -128 28 -128 40 39 -128 -128 -128 -128 -128 -128

I failed to find verified explanation what all temperatures mean. Most valuable reading is linux-source/Documentation/laptops/thinkpad-acpi.txt. Based on this reading on my experiments I guess:
1. CPU
2. unknown - but must be close to no 3.
3. WiFi mini-PCIe
4. GPU
5. Main battery: main sensor
6. Bay battery: main sensor (not available)
7. Main battery: secondary sensor
8. Bay battery: secondary sensor (not available)
9.-10. unknown
11.-16. unknown/unused

Temperatures 9 and 10 are increasing when massive memory operations as `md5sum bigfile` or graphical operations like `glxgears` are active. They stay almost intact when CPU is actively computing, so I guest those sensors are close to memory and/or chipset.

Power consumption & Battery life

To be written...

Useful pages

Think Wiki on X61s
Gentoo on the Thinkpad X61s
Thinkpad X61s review

Conclusion

Lenovo X61s is a perfect replacement to my old DELL D410. It has the same physical dimensions of the screen and the keyboard but because of the tighter frame it's smaller and also lighter. I'm thinking about buying SSD, it was really great experience in X300.

I have never had a laptop where linux was working so nicely. Yes, I needed many tweaks to get things working as I need, but information were easy to find, mostly at Think Wiki.

What still worries me is temperature of right palm rest. Before I discovered tricks how to reduce it, the laptop wasn't usable. I was for a few days thinking about returning it to shop. I still hope to solve this problem. Without this heat problem X61s is a machine of my dreams.



  7. 7. 2008 Today I posted link to my page to Linux On Laptops.