Wiki Table of Contents

chroot

A chroot is an operation that changes the apparent root directory for the current running process and its children. Its many uses include recovery: should a system be rendered unbootable, a chroot can be used to move back into the damaged environment after bootstrapping from an alternate root file system (such as from installation media or other Live medium). (Wikipedia)

For recovery purposes, use the Live medium, boot to the desktop, open a terminal and become root. After you are root you need to first mount the root partition sda2 (assuming sda2 is root partition of the installed system you need to get into).

mkdir /mnt/sda2
mount /dev/sda2 /mnt/sda2

After you mount root you need to do some mounting.

cd /mnt/sda2
mount -o bind /dev /mnt/sda2/dev
mount -o bind /sys /mnt/sda2/sys
mount -o bind /proc /mnt/sda2/proc

In order to use an internet connection in the chroot environment copy over the DNS details

cp /etc/resolv.conf /mnt/sda2/etc/

Then you should be able to chroot to /mnt/sda2, run

chroot /mnt/sda2

After that is successful, you can carry out whatever operation is necessary on the installed system.

When finished with the chroot, you can exit it and unmount the temporary file systems.

exit
umount /mnt/sda2/proc /mnt/sda2/sys /mnt/sda2/dev; umount /mnt/sda2

Links

Arch Wiki

Leave a Comment

Do NOT follow this link or you will be banned from the site!