10 2011-08-22
Chrooting Copy DNS Info

One thing still remains to be done before we enter the new environment and that is copying over the DNS information in /etc/resolv.conf. You need to do this to ensure that networking still works even after entering the new environment. /etc/resolv.conf contains the nameservers for your network.

(The "-L" option is needed to make sure we don't copy a symbolic link)
# cp -L /etc/resolv.conf /mnt/gentoo/etc/
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.

# mount -t proc none /mnt/gentoo/proc
# mount --rbind /dev /mnt/gentoo/dev
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 (Installation CD or other installation medium) 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.

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

Configuring Portage Updating the Portage tree

You should now update your Portage tree to the latest version. emerge --sync does this for you.

# emerge --sync
(If you're using a slow terminal like some framebuffers or a serial
console, you can add the --quiet option to speed up this process:)
# emerge --sync --quiet

If you are behind a firewall that blocks rsync traffic, you can use emerge-webrsync which will download and install a portage snapshot for you.

If you are warned that a new Portage version is available and that you should update Portage, you should do it now using emerge --oneshot portage.

Choosing the Right Profile

First, a small definition is in place.

A profile is a building block for any Gentoo system. Not only does it specify default values for CHOST, CFLAGS and other important variables, it also locks the system to a certain range of package versions. This is all maintained by the Gentoo developers.

Previously, such a profile was barely touched by the user. However, there may be situations in which you may decide a profile change is necessary.

Since 2006.0, there has been a re-shuffle regarding the profiles for MIPS systems. These profiles set various options including USE flags, which affect what patchsets are enabled with various system-critical packages (notably, gcc and mips-sources).

Thus, care needs to be taken to ensure the correct profile is selected for your system type. As of Gentoo/MIPS 2007.0, the profiles are:

Cobalt Qube/RaQdefault-linux/mips/2007.0/cobalt/o3232-bit LinuxthreadsRecommended"default-linux/mips/2007.0/cobalt/o32/nptl32-bit NPTLIn Testing (1) Generic Big Endian
Including SGI Indy, Indigo2 (R4x00), Challenge S and O2
default-linux/mips/2007.0/generic-be/o3232-bit LinuxthreadsRecommended"default-linux/mips/2007.0/generic-be/o32/nptl32-bit NPTLIn Testing (1)"default-linux/mips/2007.0/generic-be/n32N32 LinuxthreadsHighly Experimental (2)"default-linux/mips/2007.0/generic-be/n32/nptlN32 NPTLHighly Experimental (1) (2)"default-linux/mips/2007.0/generic-be/n64N64 LinuxthreadsUnsupported (3)"default-linux/mips/2007.0/generic-be/n64/nptlN64 NPTLUnsupported (1) (3)SGI Origin 200/2000default-linux/mips/2007.0/ip27/o3232-bit LinuxthreadsRecommended"default-linux/mips/2007.0/ip27/o32/nptl32-bit NPTLIn Testing (1)"default-linux/mips/2007.0/ip27/n32N32 LinuxthreadsHighly Experimental (2)"default-linux/mips/2007.0/ip27/n32/nptlN32 NPTLHighly Experimental (1) (2)SGI Indigo2 Impact R10000default-linux/mips/2007.0/ip28/o3232-bit LinuxthreadsRecommended"default-linux/mips/2007.0/ip28/o32/nptl32-bit NPTLIn Testing (1)"default-linux/mips/2007.0/ip28/n32N32 LinuxthreadsHighly Experimental (2)"default-linux/mips/2007.0/ip28/n32/nptlN32 NPTLHighly Experimental (1) (2)SGI Octane/Octane2default-linux/mips/2007.0/ip30/o3232-bit LinuxthreadsRecommended"default-linux/mips/2007.0/ip30/o32/nptl32-bit NPTLIn Testing (1)"default-linux/mips/2007.0/ip30/n32N32 LinuxthreadsHighly Experimental (2)"default-linux/mips/2007.0/ip30/n32/nptlN32 NPTLHighly Experimental (1) (2)
System Profile Userland Status/Notes
       
       
       
       
(1) NPTL is in-testing on MIPS at this stage, requiring gcc-4.1 and glibc-2.4. It is believed that NPTL should be safe enough now for people to use, and is planned to be the default in future releases. Brave users are welcomed to try these profiles out and report back. (2) n32 Userland is highly experimental, a lot of software has problems with this ABI, and thus it is practically guaranteed that you will run into stability problems at some point. Work is being done to improve the situation, however, no support is offered if you use this profile, unless you're willing to help fix problems by submitting patches. (3) n64 Userland at present is completely unsupported on all systems. At this time there are no stages available that support n64, and this isn't likely to change in the near future.

You can see what profile you are currently using with the following command:

# ls -FGg /etc/make.profile
lrwxrwxrwx  1 48 Apr  8 18:51 /etc/make.profile -> ../usr/portage/profiles/

Having looked through the profiles above, and decided which one is the most appropriate, you need to adjust your make.profile symlink to reflect this. By default, the profiles are in /usr/portage/profiles, so if you've moved your portage tree elsewhere (not recommended), adjust the commands below accordingly.

(Delete the old profile symlink)
# rm -f /etc/make.profile

(Create a new symlink pointing to your chosen profile     )
(For example, this is what one would use on an Indy or O2.)
# ln -s /usr/portage/profiles/default-linux/mips/2007.0/generic-be/o32
A tip for those not familiar with the Bourne Again Shell... If you partially type a filename or command, then hit the TAB key, it will automatically fill out the command/filename until the last common character. E.g. typing /usr/portage/profiles/def<TAB>, bash will automatically put down default-. Pressing TAB a couple of more times will reveal the possibilities, default-linux, default-darwin and default-bsd. Give it a try, you'll find it very handy for navigating the command line.
Configuring 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 -qt4 will compile your programs with gnome (and gtk) support, and not with kde (and qt) support, making your system fully tweaked for GNOME.

The default USE settings are placed in the make.defaults files of your profile. You will find make.defaults files in the directory which /etc/make.profile points to and all parent directories as well. The default USE setting is the sum of all USE settings in all make.defaults files. 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.

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

# nano -w /etc/make.conf
USE="-gtk -gnome qt4 kde dvd alsa cdr"
Optional: GLIBC Locales

You will probably only use one or maybe two locales on your system. You can specify locales you will need in /etc/locale.gen.

# nano -w /etc/locale.gen

The following locales are an example to get both English (United States) and German (Germany) with the accompanying character formats (like UTF-8).

en_US ISO-8859-1
en_US.UTF-8 UTF-8
de_DE ISO-8859-1
de_DE@euro ISO-8859-15

The next step is to run locale-gen. It will generate all the locales you have specified in the /etc/locale.gen file.

# locale-gen

Now continue with Configuring the Kernel.