Gentoo Logo

Gentoo Prefix Bootstrap Process for x86-linux on Gentoo Linux host

1.  Bootstrapping for x86-linux or amd64-linux


Note: This guide is explicitly written as a quick reference guide to getting Gentoo Prefix installed and running on a Gentoo Linux host, NOT Ubuntu, Debian, etc... ONLY Gentoo.

Warning: If you are new to Gentoo Prefix or not a Gentoo developer, please use the more general instructions at - This document is not supportable in any way.

Here we are going to exploit binary packages to speed up the process. A certain level of trust is required here because you are using binary packages built by someone other than you. The binary packages are hosted on my personal server, built by myself.


The first step is to choose a path to install into. We refer to this path as "Prefix path", stored in the variable EPREFIX. Some suggestion for your Prefix path is $HOME/gentoo. Make sure your EPREFIX is less than 96 chars, because that is how large the EPREFIX is of the binpkgs. Whatever you chose, make sure you set it in your environment:

Code Listing 1.1: Export EPREFIX variable

$ export EPREFIX="$HOME/gentoo"

Next, add the following paths in your soon to be Prefix to your PATH environment. $EPREFIX/bin, $EPREFIX/usr/bin, $EPREFIX/tmp/bin and $EPREFIX/tmp/usr/bin. Adding these paths makes sure that they will be available later on in the process.

Code Listing 1.2: Add Prefix and utility paths to your PATH

$ export PATH="$EPREFIX/usr/bin:$EPREFIX/bin:$EPREFIX/tmp/usr/bin:$EPREFIX/tmp/bin:/usr/bin:/bin:$PATH"

Now the path is set, start with downloading the bootstrap script from From the directory where the bootstrap script was stored execute the following commands:

Code Listing 1.3: Use the bootstrap script

$ wget -O
$ chmod 755
$ ./ $EPREFIX portage
$ ./ $EPREFIX latest_tree

Note: This is only assuming that your host has recent bash/python as deps for portage. If not, you will need to refer to the more in-depth instructions at . A recent Gentoo Linux host will have the deps needed.

The script will setup the $EPREFIX directory, download a portage tree snapshot, unpack it and download and install portage. Afterwards it will try to setup some sane defaults.

Next, build up the system.

Code Listing 1.4: emerge system

$ # or: export PORTAGE_BINHOST=""
$ FEATURES="-collision-protect" emerge -avg1 --nodeps bash eselect eselect-python python portage
$ time emerge -avg system

real    6m31.551s
user    313m18.297s
sys     428m4.885s

Note: You should see 79 packages being installed, 78 of which are binaries (binpkgs). The one package build from source is portage itself because it hardcodes your UID/GID. Luckily, portage doesn't take too long to merge.

Code Listing 1.5: binutils-config

$ binutils-config 1

To use your bootstrapped Prefix environment, you best start a shell from the Prefix, such that your path and other environment variables are set correctly. To facilitate in this, a small helper script can be created by the bootstrap script.

Code Listing 1.6: Creating a start-script

$ cd $EPREFIX/usr/portage/scripts
$ ./ $EPREFIX startscript

After running this, a script startprefix will be present in $EPREFIX. You can freely move the script to e.g. your homedir for convenience. Running the script will drop you into a Prefix shell, where for example emerge is directly at your disposal. Enjoy your Prefix!

Now, you have all the system packages that were compiled at the time of this writing. If you choose to, you can sync the tree and emerge other tools that you might need from there. Be warned, there will not be binpkgs except for the system set. Also remember that the Gentoo Prefix tree is not that same as the Gentoo Linux tree.

Code Listing 1.7: Updating the tree

$ emerge --sync


Page updated October 18, 2011

Summary: How to bootstrap Gentoo Prefix on your Gentoo Linux system.

Jeremy Olexa

Donate to support our development efforts.

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