Chroot/es

Chroot (Cambiar el directorio raíz) es una utilidad del sistema Unix que se emplea para cambiar el directorio raíz aparente de modo que se pueda crear un nuevo entorno separado lógicamente del sistema principal. Este nuevo entorno se conoce como una "jaula chroot". Un usuario que opere dentro de la jaula no puede ver ni acceder ficheros fuera del entorno en el que se le ha confinado.

Uno de los usos principales usos del enjaulamiento es crear un sistema Linux independiente encima del actual para realizar pruebas o compatibilidad del software. A menudo se ve como una alternativa ligera a la virtualización, ya que se puede correr sin la sobrecarga de un supervisor.

Configurar el entorno
Lo primero que necesita cuando realice una nueva instalación es crear el directorio en el que residirá su jaula, por ejemplo en "/mnt/mijaula"

If you want to mount an existing installation from a partition, you can do:

Replace DEVICE by the partition with your existing installation.

If you already have an installation in a sub directory of the root you are currently in, you don't need to do the above steps.

Unpacking system files & portage tree for a new installation
If you're building a new install, the next step is to download the stage3 and portage tarballs and set them up in the chroot location. For more information on this process please see sections 5a and 5b in the Gentoo Handbook.

Configuration
Before entering the chroot we need to mount a number of directories.

And will also need to copy over some basic configuration file from the host, do not copy over make.conf if you're using an existing installation.

Once done we can then enter the chroot environment.

When creating a new installation, you can sync portage to make sure everything is up to date.

The system is now ready. You can install software, mess with settings, test experimental packages and configurations without having any effect on your main system. To leave the chroot simply type "exit" or press Ctrl-D, this will return you back to your normal environment. Don't forget to umount directories you've mounted.

Init scripts
If you need to do this often, you can speed up the mounting of the directories needed for a chroot by using an init script:

If you use a different directory or partition, add the necessary mounting commands in start and change /mnt/chroot if you use a different name.