Installing Debian on a ThinkPad G41

From ThinkWiki
Revision as of 21:18, 3 September 2005 by 63.206.198.101 (Talk)
Jump to: navigation, search

If you want to keep the Windows XP partition you should seriously consider whether you want it to be VFAT or NTFS, because on the very first bootup of the system it will automatically run a command to convert from VFAT to NTFS. I recommend disabling the automatic conversion as per instructions here, i.e.:

boot into Knoppix, mount the XP partition, and move the following files (assuming you've mounted /dev/hda1 under /target):

windows/system32/convert.exe:

# mv /target/windows/system32/convert.exe /target/windows/system32/convert_.ex_

windows/system32/autoconv.exe:

# mv /target/windows/system32/autoconv.exe /target/windows/system32/autoconv_.ex_

i386/convert.exe

# mv /target/i386/convert.exe /target/i386/convert_.ex_

i386/autoconv.exe

# mv /target/i386/autoconv.exe /target/i386/autoconv_.ex_

IBM does not provide the rescue/recovery CD set with this model so I suggest before anything else that you immediately boot into Windows and create the set. You could always order one from IBM and pay $45. The set from IBM consists of a "Rescue and Recovery" CD plus 6 "Product Recovery" CD's which contain the actual image that gets written to the hard drive. As mentioned in other places the default drive image contains two VFAT partitions: one large Windows XP partition and one smaller recovery partition.

After creating the recovery CD set I recommend going into the BIOS and setting the "IBM Predesktop Area" in the BIOS under "Security" to "Disabled" so that the 3+ GB of space it uses can be be reclaimed. The Predesktop Environment is not very useful unless you want to have the “feature” of being able to re-image your disk and re-install Windows from scratch.


Notes on the model used in this setup: This info is for setting up Debian on a G41 with the following features:

  • Processor: Mobile Intel Pentium 4 Processor 548 with HT Technology
  • Graphics: NVIDIA GeForce FX Go5200 (nVidia Corporation NV34M)
  • Display: 1400x1050 SXGA+
  • Wireless: ThinkPad 11b/g Wi-Fi Wireless (Atheros Communications, Inc. AR5212 802.11abg)
  • Ethernet: Integrated Gigabit Ethernet (Broadcom Corporation NetXtreme BCM5705M_2)
  • Sound: SoundMAX (Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller)

If your model does not have these features, then some or most of this information might not apply.

Disk Preparation and Partitioning

Next, I went into Knoppix again and ran the QTparted graphical disk partitioning tool to alter the partition layout of the drive. I deleted the recovery partition (partition 2) and shrunk the XP partition to 8 GB. QTParted will correctly resize the XP partition regardless of whether it is VFAT or NTFS. Finally, I created a 2300 MB swap partition as the second partition and used the remainder of the disk (partition 3) as one large XFS filesystem for Linux. The reason I chose the high value for the swap partition size was so that it can accommodate suspend to disk, which requires a swap partition larger than the amount of installed RAM, and allowing for the maximum 2GB of RAM to be installed.

Debian installation

After this I installed Debian using an official i386 Debian minimal bootable CD netinst image obtained from http://www.us.debian.org/CD/netinst/

When the CD booted I pressed the F3 key which gave instructions to type "expert26" at the boot prompt in order to install in expert mode using a more recent 2.6 Linux kernel. I accepted the defaults for all questions except that when it asked about partitioning the disk I chose the option to "manually edit the partition table". This is because I already partitioned the disk with QTParted above and created the swap and XFS filesystems I plan to use. So in the manual partition setup section I simply told it to use hda2 as swap and to use hda3 as xfs, assign the mount point "/" to it, and to format the filesystem. Once this is done the rest is simple. When it asked about making Linux bootable directly from the hard disk, it is important to NOT chose the Grub boot loader since the version included with the installer has a serious problem dealing with XFS filesystems. Choose Lilo instead and everything will be fine.

After the first reboot during the install it asks to set up apt sources. I chose to use http and selected a local mirror in my country. It then asked if I want to choose packages to install and I said no. My philosophy is to install Debian with the minimal amount of stuff, get it working, and then later on install any other applications I want. Also, if you plan on dist-upgrading from stable to testing or Sid then it is easier to do with only a minimal installation.

Installing a few important packages

Here are a few important packages that it is good to install right away:

# apt-get install less vim
# apt-get remove --purge nvi

vim is a much better than nvi. Less is much better than more which is installed by default.

Building a Linux kernel

The next thing I did is immediately build my own kernel. This involved installing:

# apt-get install ncftp build-essential bin86 libncurses-dev bzip2

I then used ncftp to retrieve linux-2.6.12.tar.bz2 from ftp://ftp.kernel.org/pub/linux/kernel/v2.6/

# cd /usr/src
# ncftp
        open ftp.kernel.org
        cd pub/linux/kernel/v2.6
        get linux-2.6.12.tar.bz2
        bye
# tar -xjf linux-2.6.12.tar.bz2
# ln -s linux-2.6.12 linux
# cd linux
# make menuconfig

Prior to compiling the kernel it is important to have an inventory of the components in your system. Here is a list of the most important components in terms of how Linux sees them:

  • Intel Pentium 4 PC-compatible processor. Since this is a HyperThreading processor it requires Symmetric multi-processing support with a maximum number of CPUs = 2
  • ACPI interface supporting CPU frequency scaling
  • PCI bridge
  • ISA bridge
  • CardBus yenta-compatible PC Card controller
  • PC-style parallel port
  • Intel Ultra ATA ICH4 Storage Controller (IDE interface)
  • Broadcom Tigon3 1000 Mbit ethernet controller
  • PS/2 Mouse interface
  • 8250/16550 compatible serial port
  • Intel 855GM AGP chipsets
  • Intel 82801 (ICH) SMBus (I2C)
  • VESA 2.0 compatible graphics cardBus
  • Intel AC97 Audio controller
  • Intel MC97 Modem
  • Intel UHCI USB controller
  • Intel EHCI USB 2.0 controller


There are a few important things in the kernel config to be aware of.

  • Power Management/ACPI: I chose to not enable IBM laptop extras in order to build a newer version later
  • under ATA support be sure to select Intel PIIXn chipsets support
  • You must enable Direct Rendering Manager support (without selecting any of the driver modules, since we will build our own later)
  • In the Graphics section select VESA VGA graphics support but DO NOT select nVidia Framebuffer Support as it interferes with the nvidia DRM driver we will install below


# cp .config ../dot-config-2.6.12 #good to save a copy
# make
# make modules_install
# cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.12
# cp System.map /boot/System.map-2.6.12
# vi /etc/lilo.conf
  1. lilo stanza for image from lilo.conf
image=/boot/vmlinuz-2.6.12
label=2.6.12
vga=0x31B
read-only

Then run "lilo" to install it to the MBR.
Now it should be possible to boot into the new 2.6.12 kernel.

Setting up graphics

First, it is necessary to install the minimal essential components necessary to get the graphical environment working:

# apt-get install x-window-system-core

Then you need to set up the nvidia driver. The easiest way to do this is with the module-assistant utility:

# apt-get install module-assistant
# m-a prepare
# m-a a-i nvidia
# apt-get install nvidia-glx nvidia-settings
# echo nvidia >> /etc/modules
# modprobe nvidia
# dpkg-reconfigure xserver-xfree86
  1. if you are using Sid, then use dpkg-reconfigure xserver-xorg

This will ask a lot of questions about X setup. Here are options I selected:

  • allow it to attempt to autodetect video hardware, but when it shows the list, scroll down one and select "nividia" (NOT "nv")
  • leave video RAM setting blank. X server will autodetect it
  • do NOT use kernel framebuffer interface
  • for keyboard layout do not select default "us" value, but replace with "intl" (this is better because it also supports multi-key on the right-alt key)
  • XKB rule set accept default value
  • for keyboard model replace "pc105" with "pc102"
  • attempt mouse autodetection but then select /dev/psaux
  • Mouse protocol: select ImPS/2
  • yes to emulate 3 button mouse
  • yes to enable scroll events
  • accept all modules (default)
  • under display setup, select only mode 1400x1050
  • under choose method, select medium
  • select 1400x1050 @ 75Hz
  • select default color depth of 24 (you can select 16 which is slightly lower, and might give slightly better performance)

At this point you should be able to start X from the command line with the startx command. But it will not look very appealing. Install a window manager/desktop environment, e.g.

# apt-get install openbox obconf openbox-themes fbpanel

And some fonts to go along with it:

# apt-get install ttf-dustin ttf-freefont ttf-opensymbol ttf-thryomanes ttf-xfree86-nonfree xfonts-100dpi xfonts-100dpi-transcoded xfonts-75dpi xfonts-75dpi-transcoded xfonts-artwiz xfonts-base xfonts-base-transcoded xfonts-biznet-100dpi xfonts-biznet-75dpi xfonts-biznet-base xfonts-scalable defoma fontconfig

For the fontconfig debconf question I chose to use Freetype

Then create a .xsession file in your home directory to invoke openbox/fbpanel when you run "startx":

  #!/bin/sh
  # ~/.xsession: stuff to do when starting X
  #
  xsetroot -solid DarkSlateGrey  #set the background
  xset m 4 1  # increase the mouse sensitivity a bit, good for Trackpoints
  fbpanel &  #run fbpanel
  exec openbox  # run openbox, our window manager

Setting up the Wireless driver

lspci listing should show the Atheros Communications 802.11abg adapter. (NOTE: As of this writing (3 Sep 2005) I have been experiencing system freezes when using this driver. Note that this driver is unfortunately still only in beta state. See the README file in the source tree for more up-to-date information on this driver.)

Here is how to get it working using the madwifi driver:

# apt-get install cvs
# cd /usr/local/src
# cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/madwifi co madwifi
# cd madwifi
# make && make install
# modprobe ath_pci
# apt-get install wireless-tools (you will need these to configure the interface)
# apt-get install dhcp3-client (dhcp client for use with wireless access points)

See /usr/local/src/madwifi/README for useful information about the configuring the interface.

# iwlist ath0 scan (scan for available access points (APs))

Write down a list of the strongest APs, including essid and hexadecimal hardware address

# /sbin/ifconfig ath0 up
# iwconfig ath0 mode 0 (mode: 1 = 11a 2 = 11b 3 = 11g 0 = autoselect)
# iwconfig ath0 essid "foo" (use AP with essid "foo")
# iwconfig ath0 ap 01:23:45:67:89:AB (associate with hw address of AP "foo")
# dhclient3 ath0

Setting up sound

The ALSA sound module is snd_intel8x0m

# apt-get install alsa-base alsa-utils alsamixergui
# alsaconfig


Power management

According to power/video.txt in the Linux kernel source documentation ACPI suspend-to-RAM mode (a.k.a. "Standby" or "Sleep") does not and can not work with Hyperthreading CPUs:

"S3 has absolutely no chance of working with SMP/HT. Be sure it to turn it off before testing (swsusp should work ok, OTOH)."

As of this writing both swsusp and swsusp2 appear to not work. More experimentation is needed to test them with and without certain modules loaded. Both of them seem to enter into standby mode correctly but after what appears to be a normal wakeup process the console goes blank and the system becomes totally unresponsive. It should also be noted that this author experienced severe filesystem degradation when attempting to resume from a swsusp2 standby state, resulting in a large number of disconnected inodes and requiring a complete re-install of Linux. Therefore extreme caution is urged when experimenting with them. Furthermore, swsusp2 is a very large patch and may be difficult to apply. It also has a high likelihood of conflicting with other kernel patches.

It is probably worth installing the latest ibm-acpi, which adds functionality for Fn keys, allows setting of threshold temperatures for fans, and more. But as of this writing much of this functionality is untested or unknown on the G41. Still it doesn't hurt to install it:

Go to the IBM-acpi driver website and download the latest driver (0.11 as of this writing) into /usr/local/src

# tar -xzf ibm-acpi-0.11.tar.gz
# cd ibm-acpi-0.11
# make
# make install
# modprobe ibm_acpi
# echo "ibm_acpi" >> /etc/modules

You can see the currently installed version with:

# cat /proc/acpi/ibm/driver