Chroot/fr

Chroot (Change root) is a Unix system utility used to change the apparent root directory to create a new environment logically separate from the main system's root directory. This new environment is known as a "chroot jail." A user operating inside the jail cannot see or access files outside of the environment they have been locked into.

Une des utilisations principales du changement de racine est de créer un système Linux séparé au dessus du système courant dans un but de test ou de compatibilité logicielle. Chroot est souvent considéré comme une alternative légère à la virtualisation parce que le système peut fonctionner sans la surcharge d'un hyperviseur.

Setting up the environment
When creating a new chroot setup, the first thing needed is a directory for the chroot to reside in. For example, a chroot could be created in :

To mount an existing installation from a partition the following command can be ran. Be sure to replace the  string in the example below with the drive and partition of the existing installation:

If an installation has been previously created in a sub directory of the current root file system the above steps can be skipped.

Unpacking system files and the Portage tree (new installations)
When 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 Downloading the stage tarball and Unpacking the stage tarball in the Gentoo Handbook.

Configuration
Avant d'entrer dans le nouvel environnement, un certain nombre de répertoires doivent être montés.

Des fichiers de configuration basiques doivent être recopiés de l'hôte, ne recopiez pas quand vous utilisez une installation existante.

Usage
Une fois ces opérations terminées, entrez dans le nouvel environnement chroot en exécutant ces commandes:

Lors de la création d'une nouvelle installation, Portage doit être synchronisé pour être sûr que tout est à jour.

The system is now ready; feel free to install software, mess with settings, test experimental packages and configurations without having any effect on the main system. To leave the chroot simply type or press +. Doing so will return the console back to the normal environment. Do not forget to the directories that have been mounted.

Init scripts
If setting up chroots is a task that is needed to be performed often, it is possible to speed up the mounting of the directories by using an init script. The script could be added to the default runlevel and therefore set up automatically on system boot:

When using a different directory or partition, add the necessary mounting commands in the  function and change  to the appropriate name.

Voir aussi

 * Chroot Guide
 * Chrooting proxy services