Arch-chroot for EFI/UEFI systems
by </joekamprad> Edited by Bryanpwo 24 March 2021
If your machine doesn’t boot because of issues with GRUB, there is a way to get into your system through the terminal with ‘Change of root’ or also known as Chroot. All you need is the ISO with our live-environment to get the job done.
To be able to chroot, you need to know on which partition your boot and your root partition reside. To uncover that information, boot up our ISO, open the terminal and type:
sudo fdisk -l
Now your terminal displays the partition schemes of the disks it is connected with. This means, it also displays the partition scheme of the USB key (/dev/loop in the example), your machine info usually looks like this:
In this case, the system partitions are on
/dev/sda but in your case it can be marked with another letter followed by another number, also the hierarchy can be different in your case.
And keep in mind what in your case is your setup!
It could be encrypted or using BTRFS subvolumes.
For BTRFS subvol schemes:
you need to know your subvol names and their associated mountpounts inside the systempath. You can find the info in systems /etc/fstab and the subvolumes can be listed with:
sudo btrfs subvolume list -p /
In case you have p.e. subvols vor / (root) , /home, /var/cache, and /var/log on uefiy systems you will have the ESP (fat32) partition in addition. Make sure to mount the volumes in the right directories under /mnt…
sudo mount -o subvol=@ /dev/sdXn /mnt
sudo mount -o subvol=@log /dev/sdXn /mnt/var/log e.t.c.
On encrypted systems:
In this case /dev/sda2 is the encrypted root partition you need to unlock:
sudo cryptsetup open /dev/sda2 mycryptdevice
It will ask for your luks passphrase and unlocks the device into
This path can be used to mount the device.
With this information, you are able to arch-chroot, and to be able to do that you need to have root permissions, so type the following command:
The first thing we’re going to do is to mount the root partition by entering the following:
mount /dev/sdXn /mnt
The place that says Xn should be replaced by the letter and the number corresponding to your situation – the one where the system is installed.
The next step is to mount the boot partition into the already mounted filesystem, in most setups, there isn’t a separate boot partition, if that is the case you can skip this step.
mount /dev/sdXn /mnt/boot
Now we’re going to mount the ESP UEFI (FAT32) partition
mount /dev/sdXn /mnt/boot/efi
Then type the following:
Now you’ve chrooted into your installed system, and you are able to access your files, install packages, or alter scripts to rescue your system.
To make sure arch-chroot is working check after your users home folder
ls /home that should give your username from the installed system.