How to chroot Garuda Linux

From Grub fails after update - #3 by librewish
Some unlucky times that your system is not bootable and the only advised option is to use chroot from a Live ISO to repair the installed system (for example, to (re)install the bootloader), here is the suggested method:

steps required to chroot to your installed Garuda installation (btrfs)

  • Boot to a Garuda usb Live ISO
  • Start a terminal and
  • Find your installed system (btrfs) partition, you need the /dev/<something> part.
lsblk -f

Warning: Remember that your Live booted system partitions will be included (mounted) in the above report.

  • Mount and chroot into the installed system (example partition /dev/nvme0n1p2)
sudo mkdir -p /mnt/broken
sudo mount /dev/nvme0n1p2 /mnt/broken
sudo garuda-chroot /mnt/broken/@
  • Your terminal will enter in the installed system.

Whatever you do there is applied to the installed system.
You will have root rights/privileges, so you don't need to add sudo when you run system level commands.
Your $HOME (and other active environment variables) are those from su/root user account.

In case you want to install the bootloader

  • If the system is installed in Legacy BIOS/MBR
    Find your device that holds MBR and install grub
lsblk -no PKNAME /dev/nvme0n1p5
# nvme0n1  <== use this in next command (/dev/nvme0n1)

grub-install /dev/nvme0n1
  • If the system is installed in UEFI
    Find existing $esp partitions if more than one
parted -l | grep -iE "^Disk /|esp" | grep -B1 esp
Disk /dev/nvme0n1: 256GB
 1  1049kB  274MB   273MB   fat32   EFI system partition  boot, esp
 4  87,4GB  87,9GB  537MB   fat32   EFI system partition  boot, esp

In this example (my PC) there is /dev/nvme0n1p1, used for Windows and /dev/nvme0n1p4 used for my Linux system.
Select the proper $esp partition (you may check your /etc/fstab if you are not sure) and mount it inside chroot

mount /dev/nvme0n1p4 /boot/efi

Then install grub bootloader and update grub

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=garuda --recheck
update-grub

Do not forget to exit chroot normally, before you close the terminal

Exit the chroot session with

exit

Warning: If there were any unusual or unknown errors in this procedure, it would be better to ask for some advice in the forum, or search Archwiki or the web for info.

Now you are ready to reboot to your system!

5 Likes