Gentoo Wiki


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc
This page is a candidate for deletion 
Reason given: Obsolete.
If you disagree with its deletion, please explain why on its discussion page.
If you intend to fix it, please remove this notice, but do not remove this notice from articles that you have created yourself.
Make sure no other pages link here and check the page's history before deleting.



This guide is intended to help those wanting to build a Gentoo system using NPTL and a 2.6 kernel.

Installing Gentoo Linux

With your LiveCD burned to a disk and your Bios configured to boot from CD go head and restart your PC. Refer to the Gentoo Handbook for more information about obtaining and burning a Gentoo 2004.2 LiveCD.

Boot Option

Now boot from the LiveCD and type smp at the boot prompt.[Only applies to OLD Live CDs]

boot: smp

smp is a 2.6 kernel that will allow proc to be populated with information from a running 2.6 kernel rather than a 2.4 kernel like gentoo. This is necessary in order for glibc to be compiled with NPTL support. Refer to the Gentoo Handbook for options passable to the kernel during boot.

Hard Drive Preparation

Preparing your hard drive for Gentoo Linux: In this guide i will use fdisk to partition my hard drive.

fdisk /dev/hda

You will need atleast a / (root) and swap partition. Create filesystems and mount partitions.

mke2fs /dev/hda1
mke2fs -j /dev/hda5
mkswap /dev/hda6
swapon /dev/hda6
mount /dev/hda5 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/hda1 /mnt/gentoo/boot

Time Check

Check to ensure your PC has the correct time.


Installing the Gentoo installation files

Change to the /mnt/gentoo directory.

cd /mnt/gentoo

Use links to download a stage1 tarball from a gentoo mirror.


After downloading the stage1 tarball extract it.

/bin/tar -xvjpf stage?-*.tar.bz2 && rm stage?-*.tar.bz2

Configuring make.conf

Open make.conf for editing.

File: /mnt/gentoo/etc/make.conf

Included as an example:

CFLAGS="-O2 -march=athlon-xp -pipe" 
USE="nptl nptlonly"


Selecting mirrors.

mirrorselect -a -s4 -o | grep 'GENTOO_MIRRORS=' >> /mnt/gentoo/etc/make.conf

This command will populate GENTOO_MIRRORS in /etc/make.conf.

Note: I prefer using mirrorselect -i -o >> /mnt/gentoo/etc/make.conf. In my opinion choosing the mirror(s) closest to you manually will bring better results than a small, one time test done by mirrorselect -a -s4 -o

Before we chroot into the new Gentoo environment you may want to run passwd to change the root password so it is possible to log into another vt.


cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
mount -t proc none /mnt/gentoo/proc

If you want to change virtual terminals (Alt-F1 through Alt-F6) to do other cmd-line tasks while installing gentoo, you need to do this command in order to be able to login. This only changes the root password for the LiveCD environment.

chroot /mnt/gentoo /bin/bash
env-update && source /etc/profile

Updating Portage

Sync the portage tree.

emerge sync

Note: To avoid killing rsync servers and avoid getting stuck forever on a slow rsync server it might be easier and faster if you download a snapshot of the portage tree and then sync it.

emerge-webrsync && emerge sync

Stage1 to Stage2

emerge --nodeps --oneshot linux26-headers
cd /usr/portage
scripts/ && env-update && source /etc/profile
echo ">=sys-libs/glibc-" >> /etc/portage/package.mask; scripts/ && 
env-update && source /etc/profile

"You should see 'Native POSIX Threads' in the output." the NPTL libraries are moved to a new dir refer to the ebuild to see the command you need to run.

Stage2 to Stage3

Building the system: (Stage2 to Stage3)

emerge system && env-update && source /etc/profile && etc-update

Configuring the Kernel

Configure timezone.

ln -sf /usr/share/zoneinfo/UTC /etc/localtime
Remember to use your own timezone!

Selecting and configuring a kernel:

emerge gentoo-sources
Refer to the Gentoo Handbook for other 2.6 kernels available and howto configure and install them.


emerge udev

Don't forget to take devfs support out of the kernel configuration, since udev does the job.

emerge hotplug && rc-update add hotplug boot
emerge alsa-utils && rc-update add alsasound boot && nano -w /etc/modprobe.d/alsa && update-modules
Refer to the ALSA Handbook for further information on configuring a sound card.

If your soundcard is directly supported by the kernel, just emerge alsa-utils.

Configuring your System:

Refer to the Gentoo Handbook on editing fstab, network configuration files, and rc.conf.

Installing Necessary System Tools

emerge metalog && rc-update add metalog default
emerge vixie-cron && rc-update add vixie-cron default


emerge gentoolkit
Contains tools for working with portage.
emerge ufed
An application to simplify selecting/deselecting USE variables.

Configuring the Bootloader:

Installing grub.

emerge grub

Refer to the Gentoo Handbook on configuring grub.

useradd username -m -G users,wheel,audio,tty -s /bin/bash
passwd username

You can now safely exit and restart your PC and boot into your new Gentoo installation.

cd /
umount /mnt/gentoo/boot
umount /mnt/gentoo/proc
umount /mnt/gentoo

Getting NPTL to work on already running systems

This is already covered in HOWTO Migrate to NPTL, however, for completeness, we will also discuss it in this article.

So, begin by editing your /etc/make.conf

File: /etc/make.conf
nptl nptlonly

If you use not-so-recent binary only commercial applications (for example Matlab 6.5) that don't work with NPTL, re-emerge glibc without the nptlonly USE flag, so you will be able to use linuxthreads with

export LD_ASSUME_KERNEL=2.4.1
emerge -C linux-headers
emerge gentoo-sources
emerge linux26-headers
emerge glibc

Restart, and you're done.


Original Forums Post by Snooper

Retrieved from ""

Last modified: Sat, 19 Jul 2008 08:46:00 +0000 Hits: 60,277