Gentoo Logo

Disclaimer : This handbook has been replaced by a newer version and is not maintained anymore.


[ << ] [ < ] [ Home ] [ > ] [ >> ]


6. Chrooting into the Gentoo Base System

Content:

6.a. Chrooting

Mounting the /proc and /dev Filesystems

Mount the /proc filesystem on /mnt/gentoo/proc to allow the installation to use the kernel-provided information within the chrooted environment, and then mount-bind the /dev filesystem.

Code Listing 1.1: Mounting /proc and /dev

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

Optional: Copy over DNS Information

If you configured your network to fetch the appropriate stage file later on from the Internet, you need to copy over the DNS information stored in /etc/resolv.conf to /mnt/gentoo/etc/resolv.conf. This file contains the nameservers your system will use to resolve names to IP addresses.

Code Listing 1.2: Copy over DNS Information

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

Entering the new Environment

Now that all partitions are initialized and the base environment installed, it is time to enter our new installation environment by chrooting into it. This means that we change from the current installation environment to your installation system (namely the initialized partitions).

This chrooting is done in three steps. First we will change the root from / (on the installation medium) to /mnt/gentoo (on your partitions) using chroot. Then we will create a new environment using env-update, which essentially creates environment variables. Finally, we load those variables into memory using source.

Code Listing 1.3: Chrooting into the new environment

# chroot /mnt/gentoo /bin/bash
# env-update
>>> Regenerating /etc/ld.so.cache...
# source /etc/profile
# export PS1="(chroot) $PS1"

Congratulations! You are now inside your own Gentoo Linux environment. Of course it is far from finished, which is why the installation still has some sections left :-)

Creating the Portage cache

You have already installed the Portage tree, but you should now build the Portage cache to speed up future emerges. emerge --metadata does this for you.

Code Listing 1.4: Creating the Portage cache

# emerge --metadata

6.b. Configuring the USE Variable

What is the USE Variable?

USE is one of the most powerful variables Gentoo provides to its users. Several programs can be compiled with or without optional support for certain items. For instance, some programs can be compiled with gtk-support, or with qt-support. Others can be compiled with or without SSL support. Some programs can even be compiled with framebuffer support (svgalib) instead of X11 support (X-server).

Most distributions compile their packages with support for as much as possible, increasing the size of the programs and startup time, not to mention an enormous amount of dependencies. With Gentoo you can define what options a package should be compiled with. This is where USE comes into play.

In the USE variable you define keywords which are mapped onto compile-options. For instance, ssl will compile ssl-support in the programs that support it. -X will remove X-server support (note the minus sign in front). gnome gtk -kde -qt will compile your programs with gnome (and gtk) support, and not with kde (and qt) support, making your system fully tweaked for GNOME.

Modifying the USE Variable

Warning: Do not make any modifications to the USE variable yet if you plan to use our prebuilt packages (GRP set). You can alter the USE variable after having installed the packages you want. Gremlins are known to attack your system if you ignore this warning!

The default USE settings are placed in /etc/make.profile/make.defaults. What you place in /etc/make.conf is calculated against these defaults settings. If you add something to the USE setting, it is added to the default list. If you remove something from the USE setting (by placing a minus sign in front of it) it is removed from the default list (if it was in the default list at all). Never alter anything inside the /etc/make.profile directory; it gets overwritten when you update Portage!

A full description on USE can be found in the second part of the Gentoo Handbook, USE flags. A full description on the available USE flags can be found on your system in /usr/portage/profiles/use.desc.

Code Listing 2.1: Viewing available USE flags

# less /usr/portage/profiles/use.desc
(You can scroll using your arrow keys, exit by pressing 'q')

As an example we show a USE setting for a KDE-based system with DVD, ALSA and CD Recording support:

Code Listing 2.2: Opening /etc/make.conf

# nano -w /etc/make.conf

Code Listing 2.3: USE setting

USE="-gtk -gnome qt kde dvd alsa cdr"

[ << ] [ < ] [ Home ] [ > ] [ >> ]


Print

View all

Page updated February 22, 2006

Summary: Now that the stage3 file is extracted, we chroot into the new system and modify the USE variable.

Sven Vermeulen
Author

Roy Marples
Author

Daniel Robbins
Author

Chris Houser
Author

Jerry Alexandratos
Author

Seemant Kulleen
Gentoo x86 Developer

Tavis Ormandy
Gentoo Alpha Developer

Jason Huebel
Gentoo AMD64 Developer

Guy Martin
Gentoo HPPA developer

Pieter Van den Abeele
Gentoo PPC developer

Joe Kallar
Gentoo SPARC developer

John P. Davis
Editor

Pierre-Henri Jondot
Editor

Eric Stockbridge
Editor

Rajiv Manglani
Editor

Jungmin Seo
Editor

Stoyan Zhekov
Editor

Jared Hudson
Editor

Colin Morey
Editor

Jorge Paulo
Editor

Carl Anderson
Editor

Jon Portnoy
Editor

Zack Gilburd
Editor

Jack Morgan
Editor

Benny Chuang
Editor

Erwin
Editor

Joshua Kinard
Editor

Tobias Scherbaum
Editor

Xavier Neys
Editor

Grant Goodyear
Reviewer

Gerald J. Normandin Jr.
Reviewer

Donnie Berkholz
Reviewer

Ken Nowack
Reviewer

Lars Weiler
Contributor

Donate to support our development efforts.

Copyright 2001-2014 Gentoo Foundation, Inc. Questions, Comments? Contact us.