Saturday, November 14, 2009

chroot : Enter in a new environment

chroot is a unix command which permits to change root dir.

It permit to enter in a new environment in your terminal.So you can add an other system just in other window.For example, I launch my experimental gentoo in a terminal and I make a chroot. My terminal is similar to that : (chroot) localhost / #
The major advantage is I can compile and make update easily without having restart my computer.


Here is how you can do to enter in a new environment :


1) Mount experimental partition (depends on your system):

mount /dev/sda6 /mnt/gentoo

2) Mount /proc and /dev


Mount file system /proc in /mnt/gentoo/proc permit at the installation to use information provide by the kernel.Same things for /dev.

mount -t proc none /mnt/gentoo/proc

mount -o bind /dev /mnt/gentoo/dev


3) Enter in a new environment :

You can do it in three steps.First you change the root directory by making a chroot.Then you create the environment variable whit env-update.And to finish, you load this variable in memory wy using source.

chroot /mnt/gentoo /bin/bash

env-update
source /etc/profile

export PS1="(chroot) $PS1"

No comments:

Post a Comment