Skip to content

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!

In general you need to mount the Root File System under /mnt and in case the ESP UEFI fat32 partition inside the RFS under /boot/efi what will be /mnt/boot/efi in this case to have it mounted inside the right place on your RFS.

in the most common way you will have two partitons involved only:

  1. ESP (fat32 UEFI) boot partition mostly (default) mounted on /boot/efi
  2. / RFS root file system per default it would be ext4

in this case you need to mount RFS under /mnt and ESP under /mnt/boot/efi:

sudo mount /dev/sdXn /mnt

sudo mount /dev/sdXn /mnt/boot/efi

There are different was to create filesystems and partitions on install process so you need to know what you have there.

It could be encrypted or using BTRFS subvolumes, encryption added or xfs .. .. using partions over differnt drives e.t.c.

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 after mounting the BTRFS filsystem:

sudo mount /dev/sdXn /mnt

sudo btrfs subvolume list -p /mnt

/ must be changed to the mountpont for the BTRFS device…

In case you have p.e. subvols for / (root) , /home, /var/cache, and /var/log on uefiy systems you will have the ESP (fat32) partition in addition.

After checking your subvol list you need to unmount the device again to mount it for usage on arch-chroot with the proper subvols:

sudo umount /mnt

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

sudo mount -o subvol=@cache /dev/sdXn /mnt/var/cache

sudo mount -o subvol=@home /dev/sdXn /mnt/home

And your ESP needs to mounted also .. as it is not inside your BTRFS scheme and using its own fat32 partition:

sudo mount /dev/sdXn /mnt/boot/efi

where in all cases /dev/sdXn needs to be changed and /boot/efi is what we use per default to mount ESP UEFI partition. Now you will be able to arch-chroot into your BTRFS system at the bottom under: Do the arch-chroot: on how to start the chroot.


For encrypted systems:

use lsblk -f to find encrypted devices

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 /dev/mapper/mycryptdevice

This path can be used to mount the device.

arch-chroot:

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:

Then type the following:

arch-chroot /mnt

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.

Connect with us:

Arch-chroot for EFI/UEFI systems

  • by
%d bloggers like this: