Memoirs of a Gentoo Junkie - Part I

by Dana H. P'Simer

Wed, Dec 14, 2005


I first heard the word Gentoo from a colleague of mine I met while I was doing a gig at Cingular, Chris Bravo. Chris is a very savvy developer and I learned quickly to trust his judgment during our time working together. When he told me to give Gentoo a try I took the plunge. I have not regretted my trust. The Gentoo system is by far the best distribution I have used. Keep in mind, my requirements may not be the same as yours. Through the course of this article I will point out where Gentoo meets my requirements.

Some History

Let me start by telling you about my history with Linux. I have been using linux since 1993 when I installed Slackware on my Northgate 25mhz 386. I did not have a PPP or SLIP connection to the internet back then so I downloaded the disk images at work and copied them on to floppies and took them home. I can’t remember how many disks there were but I am certain it was over 20. Having fooled around with Minix and even installed on a floppy and booted it on one of my old 8086 computers, I was familiar with the process of bootstraping an operating system install. Slackware made it much easier but there were still some pretty hariy parts to the installation. That system still boots, I never throw anything away. I was still doing most of my development in Windows at the time so I mostly used it to fool around. Since then, I have installed several versions of RedHat, Mandrake, and Debian. One particularly good experience was with a RedHat derivative called ClarkConnect. I never could get Debian to work for me, but I don’t blame the distro, I just did not have the patience to work around some network card issues.

On several occasions I have been in a situation where I wanted to upgrade a single component on one of my systems. Sometimes, the upgrade to a new version isn’t available for the distro or is but requires upgrading several other libraries and packages which have implications to still other components. This is commonly known as dependency hell. On these occasions I usually just punted and installed from source tar ball. This never sat well with me because I hated having software that was not under the package management system. I was expressing this frustration to Chris and said wouldn’t it be great if a packaging system existed that built from source and therefore the only version dependencies were due to true reliance on new features or APIs not just because that was the version the package maintainer compiled the software with. And he said: here is your wish come true.

Gentoo Installed

I like to dive right in so I downloaded the 2004.2 live CD install and proceeded to do an install on my Dell Inspiron 9100 laptop. Being the f*cking crazy geek that I am, I chose a stage 1 install ( More on what that is later ). The process was slow, I spent several days doing the first install. After lots of reboots and some scary moments when I thought I had hosed my Windows install. To some, that might not sound like a problem, but I still had some important client data on there.

Now, another problem I have with most distros is their “shovelware” tendency. Gentoo makes it easy to customize your system at the library and package level. For instance, I don’t use KDE, don’t ask why, I just don’t. I have no KDE stuff on my box. So many packages have features to integrate with both Gnome and KDE. By putting a “-kde” in my USE variable I get no KDE features in any of the software I install and therefore no KDE libraries are dragged onto my computer.

I am not going to go into every detail of how to install Gentoo. That is what the handbook is for. Read it. Really. I mean it. What I want to do is give you a flavor of what it is like to do a Gentoo install. Nowadays, there is no support for anything other than a Stage 3 install so you won’t have to do many of these steps. Here are the intersting parts of the install highlighted.

The Gentoo Live CD is not like a Knoppix CD. It does not give you a full X/KDE desktop to work from. You get a shell prompt and you are logged in as root once it is done booting. The first thing that you need to do is set the root password and start SSH if you want to be able to access the system over the network. Gentoo systems take so long to install it is a good idea to start the compiles and then check in on them from time to time over the network.

As in all distos, before a Gentoo system can be installed the system has to be prepared to hold the operating system. Unlike other distros, the process of preparing a system for installation is carried out entirely by hand.

Preparing the Disks

I decided I wanted to use LVM. LVM allows, among other things, your logical volumes to be resized as needed. For instance, when I installed OpenOffice the compile takes so much disk space that it filled the /var file system. So after it failed the first time I increased the /var volume by 2GB and later, after OpenOffice was installed, I reduced the size. There is a great Gentoo/LVM How-To on the Gentoo site. I definitely recommend LVM, it has saved me tons of trouble. It is especially useful when you have to dual boot your system and plan on reducing the size of your Windows partition. Frankly, I love reducing the size of my Windows partition, it means I am getting closer to eliminating that overgrown trojan horse from my life :).

I also chose to use ReiserFS. I wanted a journalizing FS and Reiser has a good balance between read and write speed and can handle reasonably sized files efficiently. XFS, JFS, and ReiserFS are all good journalizing file systems. Each has their strengths. I think the benchmarks show that ReiserFS has a good balance of performance in a wide range of applications. I chose JFS for my MythTV video volumes because it is good at handling frequent writes to large files. Just do some research and pick the one that fits your needs.

The USE Variable

The single most powerful feature of portage, the Gentoo packaging system, is the USE variable. There is also the /etc/portage/package.use file that can be used to specify USE flags for packages individually. If you want to have jpeg support built into all the packages that can have that feature just put it in the global USE variable in the /etc/make.conf file. There are also USE flags that are “local” to a particular package. All the use flags are documented in /usr/portage/profile/use.desc and /usr/portage/profile/use.local.desc.

Stage 1

Stage 1 installs take a heck of a lot of time. This stage is called “bootstrapping” and that is what it is, literally. No matter what stage you install you start by mounting all the volumes you are going to install into and then untaring the stage tar ball into the file system. Once the stage tar ball is untared you chroot into the mounted filesystem.

This stage includes building glibc and other system libraries from source so you can imagine how long that takes. The idea was that you can improve performance by optimizing the base system libraries. Turns out benchmarks show that the improvement is just not worth it. I am actually glad they have eliminated it.

Stage 2

Stage 2 is the process of getting the system packages built. These are the packages for which there is no choice. They are things like tar, man, stuff like that.

There’s not much very interesting to tell about stage 2. Your computer just spends a bunch of time compiling stuff.

Stage 3

This is where you start making your most significant choices. You will configure and compile your kernel. Another advantage of a Gentoo install is you don’t get a canned kernel with a ton of junk you don’t use. Personally, I never used those anyway; I always recompile my kernels no matter what distro I chose.

You will also have to chose a system logger, a system scheduler, and other system tools. There are choices along the way here. The handbook has some good info on your choices.

Next Time

In Part II I am going to cover the applications I installed for each of my systems. I have 4 Gentoo systems: A mail/web/file server, A colo’d web server, a desktop for gaming and development, and a laptop for gaming and development, as well.

In a future series I am will cover how to go about constructing a functional home network with most of the elements you would find in a mid sized corporate office. Check back later for more details.