<< Back to man.ChinaUnix.net

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

6. Chrooting into the Gentoo Base System


6.a. Chrooting

Mounting the proc Filesystem

Mount the /proc filesystem on /mnt/gentoo/proc to allow the installation to use the kernel-provided information even within the chrooted environment.

Code listing 1: Mounting /proc

# mount -t proc none /mnt/gentoo/proc

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 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 3: Chrooting into the new environment

# chroot /mnt/gentoo /bin/bash
# env-update
 * Caching service dependencies...
# source /etc/profile

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 :-)

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 4: 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 5: Opening /etc/make.conf

# nano -w /etc/make.conf

Code listing 6: USE setting

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

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