Difficulty: ★★★☆☆
Step 1: Mount your system.
This works for both GRUB and EFI systems/installations
Okay, the first thing to do is to be root. To do so, open a terminal and type in sudo -i
then hit the Enter key. You may then give in your password if prompted.
We then need to create a directory where we will mount the target system. In this case, let’s make a directory named “chroot”, by entering mkdir /chroot
in the terminal.
Time to find where is your system located!! To do so, you may enter lsblk
into the terminal, then determine the matching drive letter of the system you want to chroot into.
It should looks like /dev/sdX, where X is simply a placeholder here for the example. Most of the time, if you are chrooting from a live session (e.g. from a USB), your system may be installed on the /dev/sda drive.
May also find the partition number where your Linux system is installed on that drive. For example, say something as /dev/sda2 .
When you have found the right partition, we shall now mount it by executing mount /dev/sdX# /chroot
, and replace the X with your drive letter and # with the partition number.
–Great, now / is mounted!
If your system is not EFI, you may skip to Step 3, otherwise let’s continue!
Step 2: Mounting the boot partition!
Your EFI partition should be about 300 to 512mb in size.
Using lsblk
, you can determine which is the boot partition, or we may find your boot partition easily by entering fdisk -o Device,Size,Type -l /dev/sdX
in the terminal, and making sure to replace X with the same drive letter as in step 1. Most of the time it is something as /dev/sda1 , but your system may vary.
Alright! Now let’s mount it! If the system is using GRUB, Enter mount /dev/sdX# /chroot/boot/efi
in the terminal. Otherwise, If the system is using systemd-boot, enter mount /dev/sdX# /chroot/boot
into the terminal.
Step 3: Binding system directories.
We now need to mount specific directories from the current live session, to the target system.
This process is relatively straight forward and universal. Start by executing the following commands into the terminal:
mount --bind /proc /chroot/proc
mount --bind /dev /chroot/dev
mount --bind /sys /chroot/sys
Step 4: Enabling networking when chrooting!
Important steps if you want to do system updates or repairs.
Simply enter cp /etc/resolv.conf /chroot/etc/
into the terminal, and we are ready to chroot!
Step 5: Chroot!
Easiest step!
Let’s chroot by entering chroot /chroot
into the terminal!
You have then successfully chrooted into the system!!
Oaah, that’s a lot of chroot in a single paragraph…
To exit from chroot, simply type exit
.