Enter Chroot Environment in Arch Linux
When things go wrong to the point where recovering from the operating system is not possible chroot may the only practical way to recover a broken system. Chroot or change root gives access to otherwise inaccessible system and allows execution of commands within the system. To chroot into the system you will first need to Boot Arch Linux from USB or CD.
Find the system partitions that you will need to mount.
lsblk
Create a directory to mount the root partition.
mkdir /mnt/arch
Mount the root partition.
mount /dev/sda1 /mnt/arch
Mount any other system partitions.
mount /dev/sda2 /mnt/arch/boot mount /dev/sda3 /mnt/arch/home
You may just have one partition or several additional partitions like /boot
and /home
.
Change current directory to the new system directory.
cd /mnt/arch
Mount the virtual file systems.
mount -t proc /proc proc/ mount --rbind /sys sys/ mount --rbind /dev dev/
The -t
proc option sets the type in this case it is proc
. --rbind
argument forces to mount recursively meaning all sub-directories will also be mounted. The proc
, /sys
and /dev
arguments specifies the device
that is to be mounted. proc/
, sys/
and dev/
sets the the directory where the device is to be mounted.
Enter chroot environment.
arch-chroot /mnt/arch
The first argument is the mounted root directory of the system.
At this point you should be able to run commands to diagnose or fix problems like “Unable to find root device” Error. If something didn’t quite work as expected you may need to refer to additional documentation such as change root Arch Linux wiki.