Friday, 23 July 2004

Gentoo Linux on IBM ThinkPad T20

Last night, I installed Gentoo Linux 2004.1 on an IBM ThinkPad T20 laptop. Here is a quick summary of the experience.

Background

In terms of general technical knowledge, I am a professional software architect. In a previous job, I used to install and maintain Sun servers and Sun or Windows workstations for bank trading rooms so I have installed and maintained every version of Sun's operating system, from SunOS 4.1.3 to Solaris 9, as well as every version of Microsoft Windows from 3.11 to XP. The last time I played with Linux was a few years ago with RedHat 6.2. I had a couple of problems that I did not have time to investigate so I stopped using it. Now, full of motivation and having heard only good things about Gentoo, I decided to try again.

In order to do this, I decided to install Gentoo on an IBM ThinkPad. This machine used to be used for development in my company and I was able to buy it for a small fee when it was decided to upgrade. The machine has a 700 MHz Penthium III with 256Mb RAM, on board ethernet card and modem, 2 PCMCIA slots, a DVD drive, a nice LCD screen that can support resolutions up to 1024x768 in 32M colours, 1 USB port, a PS/2 mouse/keyboard port and the ubiquitous IBM Trackpoint. No floppy drive is present. Ok so it's a laptop and hence has specialised hardware but IBM having said they supported Linux, my expectation was that all recent distros of Linux would have all the relevant drivers.

The Gentoo CDs I had where the generic x86 CDs bought from the Gentoo store a couple of weeks ago.

Booting the Live CD

Booting the Live CD for the first time went well. I had a look at the potential options for booting and decided to boot kernel gentoo with option dopcmcia. It all started fine except that it didn't manage to find the ethernet adapter. One very nice thing is that once it has booted, the first thing it tells you is where to find the documentation on the net. So, using the work machine sitting next, I browsed to it and my first impression is that the Gentoo doc is very well written and very clear. Definitely one of the best I've seen.

However, the first thing I learn when reading chapter 2 was that I should have booted with option dokeymap in addition to dopcmcia on the grounds that my machine has a UK keyboard, not a US one. So I decide to reboot and, as expected, the machine asks me for a keymap before giving me a prompt. It still doesn't see my network adapter though. I try a number of things suggested by the documentation, such as modprobe on some drivers but to no avail. After some investigation on the IRC channel and in the Gentoo forums, it appears this is a known bug with 2004.1 and, has been sorted and the fix will be in 2004.2. Nevermind, I'll do without the network for this first install, I can always add it later. This means I'll have to do a stage 3 install, which suits me fine. As a first time Gentoo user, this was my intention anyway.

Partitions and file systems

Before I can install anything, the first task is to partition the disk. Following the manual, this is very easy. However, if I were configuring a more complex system than an experimental laptop, I'd like to have more hints as to how large I should make the different partitions. In particular, how much do I need in swap? To solve the problem, I use the rule of thumb I've always used with Solaris: twice as much swap as physical memory so the documentation's example of 512Mb is just what I need. I'll just have to assume this rule of thumb also applies to Gentoo. For the rest, I also follow the example and, in the process get rid of the Windows 2000 install that resides on the machine (oops :-))

Creating the file systems and mounting them is also very easy. However, I am impressed by the number of different file systems that can are supported.

Installing a stage 3 and Portage from CD

I have no problem installing the stage 3 and Portage from CD, the documentaiton explains how to do this very well.

However, configuring /etc/make.conf could be improved. The CFLAGS and CXXFLAGS variables don't seem to need much change from what is in the default make.conf. The documentation does say though that one of the -O options, such as -O2 is a popular flag so why not add it to the default? As for the MAKEOPTS variable, on the grounds that its optimal value depends on the number of processors (namely n + 1, where n is the number of processors on the machine), it would be nice to have a configuration script that sets this and a few other popular options for you.

The USE variable

The USE flags is one of Gentoo's most powerful features and what makes it really configurable. However, this is Gentoo specific and, even though there is extensive documentation on the subject, a Gentoo beginner like me can find it difficult come up with a USE variable that actually makes sense for his system. It would be nice if the default /etc/make.conf contained commented out examples for a number of standard use cases, such as simple end user laptop and desktop, developer laptop and desktop or games desktop.

Configuring the kernel

There I decided to go with the default suggestion and configured the kernel manualy because the documentation said that the alternative of using genkernel would take more compilation time, which can be significant on a not very performant laptop. Altough Gentoo makes it easy to do and the documentation takes you through the steps, the sheer number of options, some of them quite obscure, make it difficult. In particular, I would have expected the configuration menu to take into account the specifics of my system and the installation so far. For instance, it didn't pick up the fact that I had an ext3 partition and that I needed Ext3 journalling file system support. So I ended up having a look at everything, not being very sure of what I was doing, in particular when it came to the power management options, which are essential when installing a laptop. A lot of guesswork. Maybe I should have used genkernel after all.

Compiling the kernel was very easy though.

Configuring the system

Configuring the disk by updating /etc/fstab was very straightforward and having done it countless times on Solaris, it was easy. However, it is very easy to do a spelling mistake that could be fatal in a file like this (as I was to discover later) and an inexperimented user could end up having serious issues with it.

No need to configure the network as I still don't have a network. Reading through it though, it looks well explained and once again standard UNIX so there should be no problem should I want to do it later.

Adding PCMCIA was also easy and well explained. Not having any PCMCIA card with me, I was unable to test it though.

Updating /etc/rc.conf was also straightforward so I changed the keymap setting to uk.

Configuring the boot loader

I decide to use GRUB, it all goes smoothly, nothing to comment on here, except that once again, this is an essential file that could easily get corrupted by a simple misspelling, especially considering the fact that GRUB refers to partitions in a different way than the operating system does. Mentally transforming hda1 into (hd0,0) is not difficult but prone to errors. This could easily be corrected by providing a simple script that reads you partition and file system configuration and produces a GRUB file.

Installing GRUB in the MBR was easy though.

Installing system tools

I had no problem in installing a system logger or a cron deamon. Once again the documentation is excellent.

Reboot!

Or rather, before rebooting, I take the time to install a standard user. Then this is the moment of truth.

Having removed the CD from the drive, I get the boot loader as expected. I select the only option I have and... it fails... and I get the maintenance login prompt. A quick investigation shows that I misspelt my root partition /dev/hga1 instead of /dev/hda1. However, my partition is currently mounted read only so I can't update /etc/fstab. The solution is to reboot using the CD, update the file and reboot again. This time it works and I get a login prompt. I have a very basic display though, probably because I forgot to enable the frame buffer in the kernel configuration but I don't really want to check: it's time to go home, this has taken me 4 hours.

Having decided to go home, I shut down the machine. It all seems to work at first. Then, after it displays the [ok] on the "Saving the random seed" task, it starts accessing the disk heavily with no message until it stops and stay there. I don't know if the machine has properly shut down, I suspect not so I just switch it off. I'll solve this another day.

Conclusion

Even though the documentation, the forums and the help I got from the IRC channel were excellent, I spent 4 hours installing a system that doesn't quite work properly. I will definitely try Gentoo again but it is a tough cookie and demonstrate how Linux can be difficult for newcomers, even experienced ones.

The main thing that could be done to improve this situation would be to provide an installation tool, similar to the one provided by Solaris, that would take the user through the different steps of the configuration. Of course, experienced people who don't want to use the tools wouldn't have to. Such a tool should follow the following guidelines:

  • Remember what the user did and don't ask the same question twice, e.g., once you've set up the partitions and file systems, this information should be used to select the relevant kernel options and set up the GRUB or LILO configuration.
  • Use sensible default vlaues, if possible derived from the hardware configuration. The Live CD can pick up most of it so the installer should as well.
  • When possible, guide the user through standard use cases, such as install a laptop profile or a games machine profile, or do everything custom.
  • Like the Solaris installer, ask all the questions before doing anything and then do all the installation in one go. Thus you can spend 15 minutes working on the setup and then let the tool spend the next 4 hours on its own installing your system.
All in all, it was a very interesting and valuable experience and once again I cannot praise too much the quality of the documentation. I am in two minds though as to whether I want to debug this installation or try something else, like installing Fedora Core 1 and comparing notes afterwards.

Post a Comment