| Charles Curley - Software Engineer, Writer
| << | < | > | >>
+ Larger Font | - Smaller Font
Charles Curley

Valid XHTML 1.0! Valid CSS!


Linux on Lenovo R51

TuxMobil - Linux on Laptops, Notebooks, PDAs and Mobile Phones
Linux On Laptops

(OK, "Linux on Lenovo" sounds better -- more alliterative. But I figured I should put the model in.)

I bought a Lenovo/IBM Thinkpad R51 (type 1836) in December, 2005, and it arrived with an infestation of Windows XP. These are my notes, intended to supplement other documents on the net.

Photo of ThinkPad R51
Image courtesy of thinkwiki, and probably
copyright by IBM or Lenovo.

Apparently the R51 shares a lot with the T42, T43 and R40 machines, because a number of documents for those models helped me with this machine. You may find this Clemson Linux Initiative writeup useful. I also found this Dual-Boot Linux and Windows 2000/Windows XP with GRUB HOWTO useful. There is an excellent repository of Thinkpad information at thinkwiki.

Also, feel free to look at Tom Meinlschmidt's writeup and either JP Renaud's or Jenny's writeup (Sorry, no other name is given).

And there's always tuxmobile.org's list of Lenovo laptop installation experiences and Linux on Laptops' Lenovo listing.

More generally, there is a neat tool for checking hardware compatibility by running the results of lspci -n through a database: the Debian GNU/Linux device driver check page.

The Hardware

The output from lspci:

00:00.0 Host bridge: Intel Corporation 82855PM Processor to I/O Controller (rev 03)
00:01.0 PCI bridge: Intel Corporation 82855PM Processor to AGP Controller (rev 03)
00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 01)
00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 01)
00:1d.2 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 01)
00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 01)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 81)
00:1f.0 ISA bridge: Intel Corporation 82801DBM (ICH4-M) LPC Interface Bridge (rev 01)
00:1f.1 IDE interface: Intel Corporation 82801DBM (ICH4-M) IDE Controller (rev 01)
00:1f.3 SMBus: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller (rev 01)
00:1f.5 Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller (rev 01)
00:1f.6 Modem: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Modem Controller (rev 01)
01:00.0 VGA compatible controller: ATI Technologies Inc Radeon Mobility M7 LW [Radeon Mobility 7500]
02:00.0 CardBus bridge: Texas Instruments PCI4520 PC card Cardbus Controller (rev 01)
02:02.0 Network controller: Intel Corporation PRO/Wireless 2200BG (rev 05)
02:08.0 Ethernet controller: Intel Corporation 82801DB PRO/100 VE (MOB) Ethernet Controller (rev 81)

And partial output from dmidecode:

        System Information
                Manufacturer: IBM
                Product Name: 1836Q4U
                Version: ThinkPad R51

The sound, video, keyboard, rodent, USB, hard drive, CD-RW/DVD-ROM, and Ethernet all worked with no intervention. I have not tried the modem, and probably never will. I have not yet tried the cardbus controller.

The rodent is a bit unusual in that it has both a touchpad and a rubber stick input, and buttons to match. For more on that see this thread.

2006-04-23: The write-up below recommends using the Livna packages for the ATI Radeon video adapter. However, read this message about proprietary drivers first. Fortunately, the current ATI driver doesn't even support the Radeon 7500 series and you can use the native X driver.

2006-07-23: The microphone is there and works, but pretty much useless. Get an external mic or headset.

Tools

Tools I found useful:

2006-08-31: Nigel Henry reports sucess with the GParted LiveCD. It is GUI based and the iso image is 30 MB. It is favorably reviewed.

Recovery CDs

Make a set of recovery CDs. From "Access IBM", follow the steps to make either a 7 CD set of recovery CDs or (if at all possible) a CD and a DVD. If you do the latter, put the CD in first, then the DVD. Then back up anything you want to preserve on the laptop's hard drive.

If your recovery partition has been damaged, you can restore it. Boot to the first recovery CD, the "IBM Rescue & Recover with Rapid Restore CD". Click on "Continue" in the flash screen, then on "Restore Factory Contents" to restore the Product Recovery Discs. Click "OK" and "No". Accept the terms and conditions, and click on "OK". Feed CDs as prompted. (More of the patience comes in here.) Reboot as requested. The system will take you to the Rescue and Recovery system.

Cohabitation: Adding Linux

I wanted to get Fedora Core 4 cohabiting with XP. I wrassled with that for a while. Lenovo ships the hard drive with two VFAT partitions. The second one (hda2) is the rescue partition. The first one is where XP will run. The first time you boot, XP will convert it to NTFS. I was skeptical about Linux' ability to resize an NTFS partition, so I tried resizing the VFAT partition to make some room. Wrong. The parted on Knoppix 4.02 clobbered both VFAT Windows partitions.

The solution: Let XP boot and convert the VFAT partition to NTFS. Then resize it. Mostly, I followed Cay Horstmann's instructions. One thing Herr Horstmann neglected to mention: install grub in the /boot partition before you grab its boot record to give to XP.

The most important item is to use the latest statically linked version of ntfsresize. I did not use parted on Knoppix. I followed the ntfsresize command line instructions to the letter, except that:

Having done that, I then hand built the partitions I would need with fdisk. Notice that I am not using Logical Volume Manager (LVM).

[root@dragon ntfsresize-static-1.12.0]# fdisk -l /dev/hda

Disk /dev/hda: 40.0 GB, 40007761920 bytes
240 heads, 63 sectors/track, 5168 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1        1551    11725528+   7  HPFS/NTFS
/dev/hda2            4519        5168     4914000   12  Compaq diagnostics
/dev/hda3            1552        1562       83160   83  Linux
/dev/hda4            1563        4518    22347360    5  Extended
/dev/hda5            1563        2917    10243768+  83  Linux
/dev/hda6            2918        3183     2010928+  82  Linux swap / Solaris
/dev/hda7            3184        4518    10092568+  83  Linux

Partition table entries are not in disk order

The three Linux (ext3fs) partitions became /boot, /, and /home, respectively. Running "sfdisk -d" on the results looks like this:

# partition table of /dev/hda
unit: sectors

/dev/hda1 : start=       63, size= 23451057, Id= 7, bootable
/dev/hda2 : start= 68312160, size=  9828000, Id=12
/dev/hda3 : start= 23451120, size=   166320, Id=83
/dev/hda4 : start= 23617440, size= 44694720, Id= 5
/dev/hda5 : start= 23617503, size= 20487537, Id=83
/dev/hda6 : start= 44105103, size=  4021857, Id=82
/dev/hda7 : start= 48127023, size= 20185137, Id=83

You might be able to take the first two entries out and feed that to sfdisk to reproduce my setup, but I haven't tried it.

Bare Metal Recovery Scripts

Earlier, I pretty well given up on having Linux and XP cohabit (due to inexpert googling). So I had installed Linux and left the broken Windows partitions alone. So while I mucked with this stuff, I used my Bare Metal Recovery scripts to preserve my Linux partitions. By judiciously commenting out certain stanzas in the restoration scripts, I was able to restore Linux and have it working almost flawlessly. N.B: the scripts are set to re-install GRUB to the master boot record. Change that! GRUB should restore to your /boot partition's boot record! I install GRUB to /dev/hda3.

IPW2200 Firmware

To use the wireless card, you need both the IPW2200 driver (included in the kernel) and the firmware. The firmware for the version of the driver that ships with Fedora 4 as updated (currently 2.6.14-1.1653_FC4) is 2.2, so you need ipw2200-fw-2.2.tgz. It works fine with my two Linksys WAP54G wireless access points, firmware version 2.08.

Unfortunately, it does not work as is with kismet, which requires firmware 2.3. Drat. (But see the note dated 2006-03-05 below.) If you insist, try this Fedora Core 2/3/4 and the IPW2200 Wireless Driver writeup from Clemson. I have not tried it.

I have found that you can have all the firmware versions you want in /lib/firmware/, so you might as well get them all and dump them in all at once. Check dmesg from time to time to see if a new kernel has called out a more recent version.

2006-02-12: the kernel-2.6.15-1.1831_FC4 has a version of the ipw 2200 driver that requires firmware version 2.4. I've gotten further: kismet now complains "FATAL: Failed to set monitor mode: Invalid argument." That will take some digging, who knows when.

To find out if your driver supports monitoring, run iwpriv eth1.

2006-02-26: I probably won't go any further with this until FC5 is out and I get a chance to upgrade to it. Apparently, wpa-supplicant is a dependency for system-config-network, so perhaps kismet will work.

2006-03-01: Apparently, the firmware is available at Livna. Try yum install ipw2200-firmware. I haven't tried it.

2006-03-05: Hmmm, occasionally patience is a virtue. It turns out all I needed to do to get kismet working was wait for the 2.6.15-1.1833_FC4 kernel to come down the chute. When you run iwpriv eth1, you should see something like:

[root@dragon ~]# iwpriv eth1
eth1      Available private ioctls :
          set_power        (8BE0) : set   1 int   & get   0
          get_power        (8BE1) : set   0       & get  80 char
          set_mode         (8BE2) : set   1 int   & get   0
          get_mode         (8BE3) : set   0       & get  80 char
          set_preamble     (8BE4) : set   1 int   & get   0
          get_preamble     (8BE5) : set   0       & get  16 char
          reset            (8BE6) : set   0 int   & get   0
          sw_reset         (8BE7) : set   0 int   & get   0
          monitor          (8BE8) : set   2 int   & get   0

Kewl! Now to get a new GPS receiver (My old one being rather ancient, and not a USB receiver), get gpsdrive running, and start snooping the local networks. :-)

2006-04-16: The new GPS receiver is in, and kismet, gpsdrive and gpsd all play together.

GRUB

2006-02-26: I had put an entry for the rescue partition in my grub.conf file. Alas, it does not work. I use the big blue "Access IBM" button instead. However, Andy Smout writes:

I bought an r50e laptop a few weeks ago and have read some of your article. I found some answers to some of the problems you experienced with grub.

Installing fedora core 4, after re-sizing the windows partition and setting a swap partition and ext3 or reiser partition for linux, I installed a basic fedora build with grub installed on the master boot record.

As you found, the ibm button no longer worked, and the ibm r&r partion also did not work. Grub appeared to screw up the partition table, and the type 12 compaq diag partition (ibm r&r) no longer worked properly. Although I could use grub to boot it, it would crash (blue screen). Without analysing the partition table in detail, it appeared to have a problem reading some sectors so I surmised the partiton type was wrong. Given the type of softwaed used in the ibm R&R partn (old windows on dos) the partition had to be a fat friedly type, and given the size of the data in the r&r partiion (approx 4gb) it had to be fat32, maybe lba type so I tried both. I discovered that changing the partition type to hidden w95 fat32 (LBA) [type 1c] fixed the ibm access r&r partition and those tools work fine after I fixed grub's menu.lst file. Partitions are as follows: hd0,0=win xp, hd0,1=ibm r&r, hd0,5=linux boot

Menu.lst:

Title winxp
Unhide (hd0,0)
Hide (hd0,1)
Rootnoverify (hd0,0)
Makeactive
Chainloader +1
Boot

Title ibm r&r
hide (hd0,0)
Unhide0 (hd0,1)
Rootnoverify (hd0,1)
Makeactive
Chainloader +1
Boot

Title fc4
Unhide (hd0,0)
hide0 (hd0,1)
Root (hd0,5)
Kernel /boot...etc etc

I tested this method by using the ibm recovery disk set to rebuild the whole pc to factory original, re-installed fedora using the same technique, and re-applied the partition table changes. This setup has been working fine for a few weeks now, and I have since re-sized (shrunk) the windows partion again and added a second linux (suse 10.0) install with additional entries in the grub menu for suse (suse re-writes/simplifies the grub config so I had to modify it again from a backup copy of the config files from pre suse to add back in the ibm, windows and fedora partition code listed above)

Hope that helps.

Note: I haven't tried Andy's code. Your mileage may vary, no warranty, use at your own risk, yada, yada.

Unless you take Andy's route, be sure to install GRUB to your /boot partition's boot record, not the master boot record! I install GRUB to /dev/hda3.

boot.ini

BOOT.INI is the file that tells XP what to boot. You may can use it to present a choice to the user. One thing you can do is set the default to Linux. I named my boot record file dev.hda3.boot, so my BOOT.INI looks like so:

[boot loader]
timeout=30
default=c:\dev.hda3.boot
[operating systems]
c:\dev.hda3.boot="Linux"
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect

There are other ways to hack BOOT.INI

3D support for ATI Radeon

Fedora FAQ has an article on how to install the 3D drivers for the Radeon card on Fedora Core 4. This is what I did:

  1. Again, following the instructions, install the driver.
    yum install kernel-module-fglrx-$(uname -r)
  2. I ran aticonfig --verbose, which told me to run aticonfig --initial. Before doing so, I backed up my xorg.conf file.
  3. I then edited my xorg.conf file, so that stanza looked like so:
    Section "Device"
    	Identifier  "ATI Graphics Adapter 0"
    	Driver      "fglrx"
    	BusID       "PCI:1:0:0"
    EndSection
  4. Then I shut down X and restarted it. That was a disaster.
  5. I then ran system-config-display, changed the display to a generic LCD at 1024x768, and set the configuration accordingly. On restarting X, I had a working display and glxgears in the 500+FPS range.

FC5: My testing of the Livna ATI drivers has been a disaster. The installation script (which you have to run manually) cannot tell the difference between the radeon and radeonfb modules, and (once I disabled the radeonfb) eats my configuration file, making it useless. This may be because the ATI driver does not support the 7500 cards.
Another reason to stick with the native drivers is that glxgears reports 1180 frames per second!

Suspend to RAM

I did exactly what Mr. Moss says to do. N.B: what appear to be two /usr/bin/dbus-send stanzas in sleep.sh are actually all one line. If you want to break them up to aid reading, use back slashes.

#!/bin/sh
/usr/bin/dbus-send --system --dest=org.freedesktop.NetworkManager\
   --type=method_call /org/freedesktop/NetworkManager\
   org.freedesktop.NetworkManager.sleep

/sbin/hwclock --systohc
echo -n mem > /sys/power/state
/sbin/hwclock --hctosys

/usr/bin/dbus-send --system --dest=org.freedesktop.NetworkManager\
   --type=method_call /org/freedesktop/NetworkManager\
   org.freedesktop.NetworkManager.wake

It appears my computer has the power drain problem described at thinkwiki. The fix on that page did not appear to work. The Clemson fix, which involves making a custom initrd (easy enough that even a congressman could do it), works.

2006-07-02: The 2.6.17-1.2139_FC5 kernel is causing problems with suspend. See bug 196835 for the gory details. I was able to work around it by changing one line, per Ed Hill's suggestion:

# echo -n mem > /sys/power/state
/usr/bin/pm-suspend

Updating Kernel Modules

2006-04-20: Two scripts which (their authors claim, I haven't tried them) will update these and more packages are Fedora Helper and Fedora Frog.

New kernels come out from time to time. I apply them assiduously. However, I now have two modules on this computer alone which are specific to each kernel and not in the kernel. Gnrrr. One can, of course, update them manually each time one updates the kernel. A bit easier is the following script. Since I just wrote it, you are on your own, use it at your own risk, there is no warranty, I'm not responsible for a dang thing anyway, etc., etc. It is copyright 2006, and released under the GPL.

This script also builds a custom radeonfb initrd, as the section above on suspending to RAM indicates.

# -*- shell-script -*-

# Time-stamp: <2006-02-07 08:04:05 root get.modules>

# Get certain kernel version specific modules. We can run without
# them, but prefer not to. For more information, see
# http://www.charlescurley.com/Lenovo.R51.html.

KERNEL=$(uname -r)

BUILD=$(uname -r | cut -d '.' -f4 | cut -d '_' -f1)

echo Kernel release is ${KERNEL}, build is $BUILD

if [ ! $(rpm -qa | grep -i kernel-module-fglrx | grep -i $BUILD) ]; then

  echo Getting kernel-module-fglrx.

  yum install -y -d 0 kernel-module-fglrx-${KERNEL}

fi

if [ ! $(rpm -qa | grep -i kernel-module-ntfs | grep -i $BUILD) ]; then

  echo Getting kernel-module-ntfs.

  yum install -y -d 0 kernel-module-ntfs-${KERNEL}

fi

# Get the radeon frame buffer driver into the initrd so we can reduce
# battery drain while suspended.

if [ ! -f /boot/initrd-${KERNEL}.au.img ]; then

  echo Building Radeon Frame Buffer initrd.

  mv /boot/initrd-${KERNEL}.img /boot/initrd-${KERNEL}.au.img

  /sbin/mkinitrd -f --with=radeonfb /boot/initrd-${KERNEL}.img ${KERNEL}

fi

For FC5, the Livna folks have seen fit to re-arrange the file names. I've re-worked the script. We no longer need the Radeon driver, so that went away. And the ntfs drivers get updated along with the kernel. That leaves only the frame buffer initrd to build.

# -*- shell-script -*-

# Time-stamp: <2006-04-26 20:51:50 root get.modules>

# Get certain kernel version specific modules. We can run without
# them, but prefer not to. For more information, see
# http://www.charlescurley.com/Lenovo.R51.html.

KERNEL=$(uname -r)

BUILD=$(uname -r | cut -d '.' -f4 | cut -d '_' -f1)

echo Kernel release is ${KERNEL}, build is $BUILD

# Get the radeon frame buffer driver into the initrd so we can reduce
# battery drain while suspended.

if [ ! -f /boot/initrd-${KERNEL}.au.img ]; then
  echo Building Radeon Frame Buffer initrd.
  mv /boot/initrd-${KERNEL}.img /boot/initrd-${KERNEL}.au.img
  /sbin/mkinitrd -f --with=radeonfb /boot/initrd-${KERNEL}.img ${KERNEL}
fi

Since these script have to be run while the new kernel is running, the first time you reboot after installing a new kernel the radeon frame buffer module is not installed. You could reboot. Easier to become root and install it manually.

modprobe radeonfb

Or add that line to the script, inside the if clause that makes the new initird.

2006-07-07: It appears that there is an undocumented config file for mkinitrd, /etc/sysconfig/mkinitrd. If it does not exist, create it, and add the line:

MODULES="radeonfb"

Once you've done that, when you install a new kernel, the radeonfb module will be included in the initrd. This removes the last excuse for this script, so it can go away. Thank you, Matthew Saltzman, for that information.

Update: Fresh Installation

On 23 July, 2006, I did a fresh installation of Fedora Core 5. First, I did a complete bare metal backup. I then cleaned out and reinstalled on the root and boot partitions, leaving all the rest intact. I did a minimal installation, figurng that a "yum install foo" would usually get me what I wanted.

Update: radeon_force_sleep argument to radeonfb

2006-10-22: It took me a while to track this one down, so I'll describe it here.

The Xorg driver for radeon has a problem with power management. The workaround is to install the radeonfb (frame buffer) driver even if you don't care about text mode.

So far so good. However, as of kernel 2.6.18-1.2200.fc5, the argument to the radeonfb driver "radeon_force_sleep=1" is no longer valid, and the driver refuses to load on discovering it. The solution is to change it to "force_sleep=1".

So in /etc/modprobe.conf, the appropriate line is:

options radeonfb force_sleep=1

If you make this change, build yourself a new initrd to make it effective on boot.


Copyright © 1996 through 2008 by Charles Curley
Last Modified: 30 Nov, 2008
100% Microsoft-free web site.