Gentoo Wiki


This article is part of the Hardware series.
Laptops TV Tuner Cards Wireless Servers Storage Other Hardware Motherboards Related


Part 2, Installing Gentoo Linux

Continued from Dell Precision 690.

The workstation now has 500GB of unallocated storage space waiting for Linux. This next part follows standard Gentoo installation procedure for AMD64 architecture. Gentoo Linux AMD64 Handbook details a 10-step procedure for installing Gentoo along with various alternative choices. The following summary only describes particular steps applied to these 690 workstations. Naturally, your choices may differ. The following only describes the choices I made together with reasons for doing so. Though not necessarily the right choices under all circumstances, those outlined below reflect the basic goal for these 690s: a pair of synchronised reference machines for software development.

Note that Gentoo has a different set of installation instructions called the Gentoo Linux 2006.1 AMD64 Handbook. These instructions describe the installation procedure based on the 2006.1 Gentoo Reference Platform (GRP). Each GRP comprises a large set of pre-built packages, so quicker to install. The 2006.1 GRP packages represent a snapshot taken in early 2006. Although they represent a working snapshot, the Gentoo project does not maintain the packages. So these packages do not represent the latest stable versions. Speeding up installation is the purpose; having pre-built binary packages avoids some lengthy compilation steps. However, for these 690s, compilation speed is a relatively small issue. So the outline below follows standard procedure, non-GRP.

10-Step Procedure

In outline, the procedure goes like this:

  1. boot a working Linux environment
  2. connect the Internet
  3. initialise the hard drive space
  4. prepare the installation environment and chroot to it
  5. synchronise Portage
  6. compile the Linux kernel
  7. configure the Gentoo system
  8. install basic system tools
  9. install and configure bootloader
  10. boot Gentoo Linux

Actually, for these two systems, additional steps will be needed to set up the development tools and environment, synchronise the two machines, and also set up two-way real-time audio communication between the two systems (planning for co-development in two widely-separated locations).

Steps 1 and 2, an On-Line Linux Environment

Various ways of doing this. Simplest way already described.

  1. Boot off the Minimal CD
  2. Choose your keyboard layout
  3. Set up the Ethernet device using net-setup eth0

Assuming an attached LAN deals with Internet routing, name resolution, firewall and all other such connection-related issues, the workstation is now running a working Linux environment and also on-line, connected to the Internet. Steps 1 and 2 complete.

Step 3, Initialise the Hard Drive Space

This step creates a new Linux partition using Linux's fdisk tool once again (see previous usage at Repartition Storage Array) then creates a new Linux filesystem within the new partition.

All sorts of partition configurations are possible. But in this instance, we will just create a single half-terabyte Linux partition, no boot partition, no swap partition. Main advantage of a single partition: makes no assumptions about space allocations.

Multi-partition configurations limit space allocated to boot images, home directories, etc. Fixing space allocations with partitions reduces system flexibility but at the same time improves security and simplifies backup. Separate partitions let you utilise different kinds of filesystem as well, so possibly a performance improvement.

In this case however, the 690s are not dedicated high-availability high-security servers but just general-purpose development workstations, so flexibility preferred. Choosing a simple partition configuration also follows the KISS principle!

Why no boot partition? Some systems need a separate boot partition. Their BIOS software can only access the first 1,024 cylinders, a ten-bit limitation on cylinder number. Not the case here though.

Why no swap partition? The workstations have 2GB of high-speed RAM. If they run low on memory, there is probably something wrong! Anyway, if swap space becomes necessary for whatever reason, you can add swap space as a file within the existing partition (see mkswap and swapon).

New Linux Partition

Run fdisk as follows.

livecd ~ # fdisk /dev/sda

The number of cylinders for this disk is set to 121576.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sda: 999.9 GB, 999999668224 bytes
255 heads, 63 sectors/track, 121576 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          10       80293+  de  Dell Utility
/dev/sda2   *          11       60792   488231415    7  HPFS/NTFS

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
Partition number (1-4): 3
First cylinder (60793-121576, default 60793):
Using default value 60793
Last cylinder or +size or +sizeM or +sizeK (60793-121576, default 121576):
Using default value 121576

Command (m for help): p

Disk /dev/sda: 999.9 GB, 999999668224 bytes
255 heads, 63 sectors/track, 121576 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          10       80293+  de  Dell Utility
/dev/sda2   *          11       60792   488231415    7  HPFS/NTFS
/dev/sda3           60793      121576   488247480   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

What about making the partition active? Is this not necessary?

New Linux Filesystem

Linux supports many different kinds of filesystem. Having so many choices is an excellent feature but adds a small problem: how to choose?

Run mkreiserfs as follows.

livecd ~ # mkreiserfs /dev/sda3
mkreiserfs 3.6.19 (2003

A pair of credits:
Chris Mason wrote the journaling code for V3,  which was enormously more useful
to users than just waiting until  we could create a wandering log filesystem as
Hans would have unwisely done without him.
Jeff Mahoney optimized the bitmap  scanning code for V3,  and performed the big
endian cleanups.

Vitaly Fertman wrote  fsck for V3 and  maintains the reiserfsprogs package now.
He wrote librepair,  userspace plugins repair code, fsck for V4,  and worked on
developing libreiser4 and userspace plugins with Umka.

Guessing about desired format.. Kernel 2.6.17-gentoo-r7 is running.
Format 3.6 with standard journal
Count of blocks on the device: 122061856
Number of blocks consumed by mkreiserfs formatting process: 11937
Blocksize: 4096
Hash function used to sort names: "r5"
Journal Size 8193 blocks (first block 18)
Journal Max transaction length 1024
inode generation number: 0
UUID: 45d963d3-2909-4597-8064-a5ca326cccb7
        ALL DATA WILL BE LOST ON '/dev/sda3'!
Continue (y/n):y
Initializing journal - 0%....20%....40%....60%....80%....100%

Tell your friends to use a kernel based on 2.4.18 or later, and especially not a
kernel based on 2.4.9, when you use reiserFS. Have fun.

ReiserFS is successfully created on /dev/sda3.

Now you can mount the new file space.

livecd ~ # mount /dev/sda3 /mnt/gentoo

It now appears at mountpoint /mnt/gentoo.

Step 4, Preparing the Installation

Step 4 involves

  1. installing a stage tarball from the Internet
  2. installing a Portage snapshot from the Internet

Change directory to the new Gentoo mountpoint.

livecd ~ # cd /mnt/gentoo
livecd gentoo # 

The new prompt shows the new current directory. But before you can unpack the stage tarball and Portage snapshot, you need to download them. This means surfing the Net! The installation CD comes with a text-based browser called links. Just enter the following command at the prompt.

livecd gentoo # links

It opens the browser at a list of international mirrors. You can use Page Down and mouse clicks to select a mirror close to your location. Using the mouse requires that you activate the console mouse using /etc/init.d/gpm start (see Using a Mouse within the Console). Links appear in bold. I choose The UK Mirror Service (UK/http).

Download and Extract the Stage3 Tarball

At the mirror, click the releases directory, then amd64 subdirectory, 2006.1 subdirectory, stages. You finally arrive at a list of stage[123] archives along with their MD5 digests.

Download (by left-clicking) the stage3-amd64-2006.1.tar.bz2 archive. You see a box asking to Save, Display or Cancel. Choose Save and OK to download. The stage-3 tarball for AMD64 has a size of 116.4MB, so may take a few minutes to complete.

While you wait, hit Enter to continue downloading in background, then click and download stage3-amd64-2006.1.tar.bz2.DIGESTS, useful for checking download integrity when it finally finishes. This is small in comparison so downloads almost instantly. Afterwards, press Alt+D to bring up the Downloads menu then press Enter to resume viewing the download progress dialogue. When finished hit q to return to the command line.

Listing the current directory now shows two new files stored in the new Linux ReiserFS filesystem.

livecd gentoo # ls
stage3-amd64-2006.1.tar.bz2  stage3-amd64-2006.1.tar.bz2.DIGESTS

Verify the stage tarball.

livecd gentoo # md5sum -c stage3-amd64-2006.1.tar.bz2.DIGESTS
stage3-amd64-2006.1.tar.bz2: OK

Option -c is short for check, long option --check.

Unpack stage 3. Following assumes /mnt/gentoo is the current directory, as before.

livecd gentoo # tar xvjpf stage3-amd64-2006.1.tar.bz2

It outputs a long list of files. These will seed the new Gentoo Linux operating system.

Download and Extract a Portage Snapshot

Download and install a Portage snapshot. Run links again and return to your local Gentoo mirror location.

livecd gentoo # links

But this time, open the snapshots directory. Use Page Down key to scroll down if necessary. Download two files: portage-latest.tar.bz2 (around 34MB) and its MD5 digest portage-latest.tar.bz2.md5sum.

Verify snapshot integrity and extract its contents to the new filesystem.

livecd gentoo # md5sum -c portage-latest.tar.bz2.md5sum
portage-latest.tar.bz2: OK
livecd gentoo # tar xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr

Again, a long list of file names appears.

The Linux filesystem now contains a basic 64-bit operating system (2006.1 GRP) along with the latest Portage snapshot.

Configure the Compile Options

Standard Gentoo installation proceeds by compiling a collection of packages downloaded in source-form from the Internet one-by-one along with any dependencies. The compiler uses compiler flags. The flags control how the compiler turns the source to machine code. Exact details depend on CPU architecture. You can easily configure Gentoo's build system to use specific compiler flags to take advantage of processor capabilities.

Question is: what gcc compiler flags best suit the Xeon 5160? Gentoo Wiki's safe CFLAGS page recommends -march=nocona for Xeon's with EM64T capability. But at the same time, it points to Gentoo Discussion Forums recommending plain old -O2 -pipe without any architecture specification for best overall results. It turns out that these compile flags happen to be the default as well. How convenient!

However, one thing the default configuration does not account for, as yet: multiple CPUs. Allow for parallel compilation, one job each for the four CPUs plus one extra for good measure. Edit the make options in the new filesystem's etc/make.conf.

livecd gentoo # nano -w etc/make.conf

This command runs the nano editor on the file /mnt/gentoo/etc/make.conf. Note the missing initial /; current working directory of /mnt/gentoo.

File: etc/make.conf
CFLAGS="-O2 -pipe"

Add a new line at the end. Use the cursor keys to navigate.


Press Ctrl+X to exit and save.

Copy the resolver configuration.

livecd gentoo # cp -L /etc/resolv.conf etc/

Mount proc and dev.

livecd gentoo # mount -t proc none /mnt/gentoo/proc
livecd gentoo # mount -o bind /dev /mnt/gentoo/dev

At last, enter the new Linux environment.

livecd gentoo # chroot /mnt/gentoo /bin/bash

Then reload the environment.

livecd / # env-update
>>> Regenerating /etc/
livecd / # source /etc/profile

Step 5, Synchronise Portage

Synchronise the Portage tree. Enter

livecd / # emerge --sync

It takes a few minutes to update.

At the end, it recommends updating Portage itself first before any other packages. Makes sense!

Pretend to upgrade to see what Gentoo plans to do when upgrading Portage itself. A pretend upgrade only lists the packages needing upgrade; the new version of Portage depends on newer versions of its dependent packages, so other basic packages need upgrading first.

livecd / # emerge -up portage

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild     U ] dev-libs/openssl-0.9.8d [0.9.7j]
[ebuild     U ] sys-devel/gnuconfig-20060702 [20060227]
[ebuild     U ] sys-libs/db-4.2.52_p4-r2 [4.2.52_p2-r1] USE="-tcl% -test%"
[ebuild     U ] sys-libs/gpm-1.20.1-r5 [1.20.1-r4]
[ebuild     U ] sys-libs/ncurses-5.5-r3 [5.5-r2] USE="-trace%"
[ebuild     U ] sys-libs/zlib-1.2.3-r1 [1.2.3]
[ebuild     U ] dev-lang/python-2.4.3-r4 [2.4.3-r1] USE="-tk%"
[ebuild     U ] sys-devel/gettext-0.15 [0.14.4] USE="-nocxx%"
[ebuild     U ] sys-apps/sed-4.1.5 [4.1.4-r1]
[ebuild     U ] app-shells/bash-3.1_p17 [3.1_p16] USE="-vanilla%"
[ebuild     U ] sys-apps/portage-2.1.1-r2 [2.1-r2]

Upgrade for real by taking off the p option.

livecd / # emerge -u portage

Gentoo proceeds to download these 11 packages, then compile and install them, replacing the existing outdated packages. Message at the end of the merge says:

 * IMPORTANT: 7 config files in /etc need updating.

Merge configuration changes in /etc using etc-update. It automatically merges trivial changes. Enter -3 to auto-merge all remaining files then enter y for each replacement.

Set Up Local Timezone

Set up local timezone as follows. Adjust Europe/London according to your local timezone.

livecd / # cp /usr/share/zoneinfo/Europe/London /etc/localtime

This is also a good time to check your local time: enter date to print the current system date and time. Type man date for help on setting the system date and time if it needs adjustment.

Step 6, Compile the Linux Kernel

Install the kernel. This involves: merging, configuring, compiling.

The following command merges the kernel but does not compile it; in Gentoo terminology, merging refers to adding files to the main filesystem tree.

livecd / # USE="symlink" emerge gentoo-sources

The merged kernel sources appear in /usr/src/.

livecd / # ls -l /usr/src
total 1
lrwxrwxrwx  1 root root  22 Jan  9 14:32 linux -> linux-2.6.18-gentoo-r6
drwxr-xr-x 19 root root 712 Jan  9 14:32 linux-2.6.18-gentoo-r6

Gentoo treats kernel sources as special; they are. The kernel does not run as any other program runs. The bootloader pulls the kernel image off the boot device and executes. The kernel's initial execution environment is therefore quite different from other pieces of software.

Compile the kernel using genkernel. First install genkernel.

livecd / # emerge genkernel

As usual, it downloads, compiles and finally merges the package.

Just before compiling the kernel, add SAS modules to modules_load.

livecd / # nano -w /usr/share/genkernel/x86_64/modules_load

Add modules

to the MODULES_SCSI list. Without these modules, the initial root disk will not find /dev/sda.

Configure and compile the kernel.

livecd / # genkernel --menuconfig all

It begins by displaying the kernel configuration menu. Note, you will see a warning message about /boot failing to mount.

mount: special device /dev/BOOT does not exist
* WARNING: Failed to mount /boot!

You can safely ignore this. It tries to mount the filesystems listed in /etc/fstab but fails because fstab is not configured yet.

After a few moments, the kernel configuration menu appears on-screen. Navigate to Processor type and features, press Enter. Select Processor family which initially defaults to Generic-x86-64. Switch to Intel EM64T. For now, leave all other options unchanged. It takes a few minutes to compile the kernel. On completion, you will find the kernel image and initial RAM drive in /boot.

Step 7, Configure Gentoo

Merge the coldplug package for auto-detecting hardware on cold boot.

livecd / # emerge coldplug

Add to boot-level run control so it boots automatically from now on.

livecd / # rc-update add coldplug boot
 * coldplug added to runlevel boot

Filesystem Table

Set up the filesystem table.

livecd / # nano -w /etc/fstab

Delete the following two lines altogether.

/dev/BOOT               /boot           ext2            noauto,noatime  1 2
/dev/SWAP               none            swap            sw              0 0

No boot or swap partition.

Change the following fstab line from

/dev/ROOT               /               ext3            noatime         0 1


/dev/sda3               /               reiserfs        noatime         0 1

Change CD-ROM specification from:

/dev/cdroms/cdrom0      /mnt/cdrom      iso9660         noauto,ro       0 0


/dev/cdrom              /mnt/cdrom      auto            noauto,user     0 0

Host Name

livecd / # nano -w /etc/conf.d/hostname

Change the hostname.



Add Ethernet device 0 to the default run-level.

livecd / # rc-update add net.eth0 default
 * net.eth0 added to runlevel default

Root Password

Set the root password.

livecd / # passwd
New UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Keyboard Layout

Configure the default keyboard layout. U.S. is the default, by default!

livecd / # nano -w /etc/conf.d/keymaps





Hardware Clock

Configure hardware clock for local time.

livecd / # nano -w /etc/conf.d/clock





Step 8, Install Basic System Tools

Install system logger and cron daemon.

livecd / # emerge syslog-ng vixie-cron
livecd / # rc-update add syslog-ng default
 * syslog-ng added to runlevel default
livecd / # rc-update add vixie-cron default
 * vixie-cron added to runlevel default

File system tools.

livecd / # emerge reiserfsprogs

Networking tools.

livecd / # emerge dhcpcd

Step 9, Install and Configure Bootloader

Configure GRUB bootloader.

livecd / # nano -w /boot/grub/grub.conf
File: /boot/grub/grub.conf
default 0
timeout 3

title=Gentoo Linux
root (hd0,2)
kernel /boot/kernel-genkernel-x86_64-2.6.18-gentoo-r6\
root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/sda3 udev\
doscsi noload=usb-storage\
vga=791 splash=silent,theme:livecd-2006.1 CONSOLE=/dev/tty1 quiet
initrd /boot/initramfs-genkernel-x86_64-2.6.18-gentoo-r6

title=Windows XP
rootnoverify (hd0,1)
chainloader +1

The kernel options doscsi and noload=usb-storage play an important role. The first loads SCSI modules including mptsas and its dependencies. The second tells Gentoo not to load module usb-storage. If Gentoo loads USB storage before SAS modules, USB storage receives the /dev/sda designation. First come, first served. SAS takes the second SCSI device, /dev/sdb. Stopping the initial load lets SAS take sda even if you have a USB card reader or other USB-based storage device inserted. USB storage module loads automatically later anyway.

An alternative option set: nodetect and doload=mptsas. This only loads the SAS modules, nothing else. Advantage, speed; disadvantage, prevents the USB keyboard running until much later in the boot sequence. So splash screen prompts to press Alt+F1 and later F2 do not initially work, in this case.

Install GRUB's boot record.

livecd / # grub
Probing devices to guess BIOS drives. This may take a long time.

    GNU GRUB  version 0.97  (640K lower / 3072K upper memory)

 [ Minimal BASH-like line editing is supported.  For the first word, TAB
   lists possible command completions.  Anywhere else TAB lists the possible
   completions of a device/filename. ]
grub> root (hd0,2)
root (hd0,2)
 Filesystem type is reiserfs, partition type 0x83
grub> setup (hd0)
setup (hd0)
 Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/reiserfs_stage1_5" exists... yes
 Running "embed /boot/grub/reiserfs_stage1_5 (hd0)"...  18 sectors are embedded.succeeded
 Running "install /boot/grub/stage1 (hd0) (hd0)1+18 p (hd0,2)/boot/grub/stage2
/boot/grub/menu.lst"... succeeded
grub> quit

Step 10, Boot Gentoo Linux

Leave the changed-root environment and unmount the Linux partition.

livecd / # exit
livecd gentoo # cd
livecd ~ # umount /mnt/gentoo/dev
livecd ~ # umount /mnt/gentoo/proc
livecd ~ # umount /mnt/gentoo
livecd ~ # reboot

Reboot, eject the installation CD and hold your breath!

After booting, Gentoo shows you the login prompt. Log in as root, entering user name root followed by the root password. This time you get the hash prompt for root-level access but now showing the host name you specified in /etc/conf.d/hostname. See host name section.

Cleaning Up

You might notice that the text-based browser (links) keeps bookmarks and history in hidden subdirectory .links off the new filesystem root. You can list root directory hidden files using ls -a / (a for all, including hidden). You can remove these files. Your Gentoo operating system no longer needs them.

Restoring BIOS Boot Sequence

You can revert the BIOS boot sequence if you like, or leave as is. In a previous section, you altered the BIOS boot sequence. The system currently boots off CD before booting off the storage array. This is not a problem, provided you do not store bootable CD-ROMs in the drive tray. It could be an advantage under some circumstances; booting off CD in rescue mode for example. The choice is yours.

Next, Upgrading to Latest Stable Platform

Dell Precision 690 Part 3 follows.

Links and References


Concerns or Compliments? Please use the Discussion section.

Retrieved from ""

Last modified: Sun, 07 Sep 2008 21:59:00 +0000 Hits: 4,264