[HowTo] Chroot from or into any Linux distribution

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.

11 Likes
Interrupted update - Manjaro doesn't boot anymore
Manjaro wont boot after kernel switch
Dual booting Windows and Manjaro issues
Re-install manjaro xfce
Pacman error "invalid or corrupted package"
Can not boot into manjaro & Grub not showing
Update eingefroren chroot und wie weiter?
[Guide] Install manjaro ARM (all editions) headless on RPI4 (and other SBC) with WiFi
Install grub manually
Hide GRUB when booting
Failed to start kernel modules
Fails to boot after full system upgrade
Kernel panic after running an install script
Dropped into rescue mode, when trying to exit, it says “grub_debug_malloc” not found
Manjaro failed to load the kernel modules
My computer froze during an update
[Stable Update] 2021-12-10 - Kernels, Systemd, LibreOffice, Plasma, Browser, Thunderbird
Manjaro does't boot: "no filesystem type specified"
Manjaro not showing login icon after latest update
I nuked manjaro by removing dbus package
Manjaro doesn't start after kernel update
Cannot boot Manjaro from Ventoy in UEFI mode, but Ubuntu can
Linux Update Interrupted And Now Linux Broken
Computer freezes in middle of update
Cannot boot into Manjaro need to load kernel first (encrypted disk)
Unable to use Manjaro after windows update crash ( dual boot )
Boot error: Failed to start D-Bus System Message Bus
Installation from Live USB hangs on [ OK ] Reached target Graphical Interface
Manjaro-chroot command not found
Dual boot Ubuntu-Manjaro: cannot boot manjaro after motherboard change
Fresh install T14 ThinkPad: ACPI - Can't tag data node
After recent update, Manjaro doesn't boot up to desktop theme
External HDD not bootable after install
Dual booting Windows and Manjaro issues
Does merging partitions change sdb4 to sdb2?

from other linux, i use systemd-nspawn (-d) /run/media/$USER/

1 Like

While the above works in any GNU/Linux installation where everything (except perhaps /home) lives on the root partition, I would add a “Step 2.1” to your instructions for when this is not the case ─ and this is a scenario where the manjaro-chroot tool would fail just as well. :wink:

To give you an example, I always install my GNU/Linux distributions the tried and tested UNIX way. I’ll illustrate what I mean with a df listing of the partitions on my own system here. :wink:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       511M  544K  511M   1% /boot/efi
/dev/sda2       488M   63M  390M  14% /boot
/dev/sda3       1.0G   26M  767M   4% /
/dev/sda4        22G  6.5G   15G  31% /usr
/dev/sda5       512M  3.4M  499M   1% /usr/local
/dev/sda6       2.0G  101M  1.7G   6% /opt
/dev/sda8       400G   72G  328G  18% /srv
/dev/sda9       450G  2.8G  446G   1% /home
/dev/sda11       20G  3.2G   17G  16% /var

As you can see, the above layout would require a few extra steps, depending on what exactly the reason is why you’re chrooting into your installed system. :wink:

5 Likes

Indeed, Thank you for your suggestion!
My goal was not to achieve the new masterpiece, the new 1000 pages book entitled Chrooting. The new era of novel that the poor students in schools may be forced to read. The new best seller of the fantastic year 2020.

It was to present a quick and easy way to chroot in most cases. If the user may have setted up God knows how many partitions for each folders on his system, I assume the user knows that those are extra steps he must follow to reach the ultimatum.

Perhaps I could add the home step, since this is indeed a common setup on people’s majestic nuggets.

Thanks for the suggestion, may I wish you a wonderful say!

2 Likes

with any USB iso manjaro
if this not on btrfs you can use

sudo manjaro-chroot -a

and never forget ,
to Exit ( end-chroot )

7 Likes