Project:X86/Chroot Guide

This guide Article description::provides instructions on how to create chroots to assist in testing Gentoo packages for stabilization.

What is a chroot?
A chroot is a operation to change the root directory of the current process and the children spawned from it. In the simplest terms, it allows one to setup a completely separate operating system installation inside the one that is already running.

Setting up a chroot for a new install
First create a directory for the chroot to reside; the filesystem that contains this directory must have enough space for a second Gentoo installation.

The next step is to download a stage three tarball to the chroot and untar it. The stage file name shown below is an example, actual file name may vary:

To proceed with the install it is necessary to mount a few directories from the live system to the chroot.

Mount the following directories to their appropriate area within the chroot:

Finally, if to share a /tmp directory between both systems:

This is by no means a secure chroot but for what is accomplished in this guide a secure chroot is not needed. With all of the filesystems mounted, proceed into the new setup. Enter the Chroot:

Hurray! The chroot has been entered! Continue by starting a standard install from Configuring Portage.

Running X apps inside the chroot
In order to be able to launch applications with a GUI from inside the chroot when the X session was started outside the chroot, there are a few extra steps to be followed.

First, use the directory from outside the chroot (see above). Second, since is a separate filesystem to, it will need to be mounted as well.

Mount :

The the file will need to be copied to the home directory of the user in the chroot environment:

Finally, when inside the chroot, set the DISPLAY environment variable.