How to Repair GRUB Bootloader on Arch Linux

How to Repair GRUB Bootloader on Arch Linux

The GRUB bootloader is a critical component of the boot process on Linux systems, including Arch Linux. It serves as the bridge between the BIOS/UEFI firmware and the operating system. If GRUB becomes corrupted or overwritten—for instance, after installing Windows alongside Arch Linux or due to a failed kernel upgrade—your system might fail to boot.

This article provides a comprehensive guide on how to repair the GRUB bootloader on Arch Linux. Whether you use BIOS or UEFI firmware, this guide covers both environments with clear steps to help you recover your Arch Linux system without a full reinstall.


🧰 Prerequisites

Before proceeding with GRUB repair, ensure you have:

  • An Arch Linux installation medium (USB/DVD).
  • A basic understanding of your system’s partition layout, including:
    • Root partition (e.g., /dev/sda2)
    • EFI system partition (ESP) if using UEFI (e.g., /dev/sda1)
  • Internet connection (optional but helpful).
  • Administrative (root) privileges after chrooting into your system.

🔍 Step 1: Boot into Arch Linux Live Environment

Start by booting your system using the Arch Linux installation media. When the boot menu appears, select:

Arch Linux install medium (x86_64, UEFI or BIOS)

Once booted into the live environment, open a terminal.


🧭 Step 2: Identify Your Partitions

You’ll need to know where your root and EFI (if applicable) partitions are located.

Use the lsblk or fdisk -l command:

lsblk

Look for partitions like:

  • /dev/sda1 — likely the EFI partition (if using UEFI)
  • /dev/sda2 — your root partition (Arch Linux)

If you’re unsure which is which, check partition types with:

blkid

EFI partitions usually show up with TYPE="vfat" or FAT32.


🔩 Step 3: Mount Your System

For BIOS Systems

If your system uses legacy BIOS:

mount /dev/sdXn /mnt

Replace /dev/sdXn with your actual root partition (e.g., /dev/sda2).

For UEFI Systems

Mount your root partition:

mount /dev/sdXn /mnt

Then create and mount the EFI system partition:

mount --mkdir /dev/sdX1 /mnt/boot/efi

🧱 Step 4: Mount Required Virtual Filesystems

These mounts are necessary to simulate a normal running environment when you chroot.

mount --types proc /proc /mnt/proc
mount --rbind /sys /mnt/sys
mount --make-rslave /mnt/sys
mount --rbind /dev /mnt/dev
mount --make-rslave /mnt/dev
mount --bind /run /mnt/run

🧙 Step 5: Chroot into Your Installed System

Now that the environment is ready, chroot into your Arch Linux system:

chroot /mnt /bin/bash

You’re now operating inside your installed Arch system as if it were booted normally.


⚙️ Step 6: Reinstall GRUB

You can now reinstall GRUB.

For BIOS Systems

grub-install --target=i386-pc /dev/sdX

Replace /dev/sdX with the entire disk (e.g., /dev/sda), not a partition.

For UEFI Systems

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB

Make sure the efibootmgr package is installed:

pacman -S efibootmgr

📝 Step 7: Regenerate GRUB Configuration File

This step is crucial to ensure all kernel and initramfs entries are properly detected.

grub-mkconfig -o /boot/grub/grub.cfg

This command scans for installed kernels and operating systems (like Windows, if dual-booted) and generates a complete grub.cfg file.


🔄 Step 8: Exit and Reboot

You’re almost done! Exit the chroot and unmount all filesystems properly:

exit
umount -R /mnt
reboot

Remove the installation media and allow your system to boot normally. GRUB should now appear and allow you to boot into Arch Linux again.


🛠 Troubleshooting Tips

GRUB Still Not Found?

Ensure the correct --target option was used (i386-pc for BIOS, x86_64-efi for UEFI), and that the proper partitions were mounted.

Boot Entry Missing in UEFI?

Sometimes, the firmware doesn’t automatically detect the new bootloader. Use efibootmgr to manually create one:

efibootmgr --create --disk /dev/sdX --part Y --label "GRUB" --loader /EFI/GRUB/grubx64.efi

Replace /dev/sdX with the disk and Y with the EFI partition number.

GRUB Shows Blank Screen or Errors?

Try adding verbose output by editing the boot entry (press e in GRUB) and remove quiet or add nomodeset.


🧰 Optional: Reinstall GRUB and Kernel Packages

Sometimes, regenerating the config isn’t enough—especially if your kernel was misconfigured. Consider reinstalling them:

pacman -S grub linux linux-firmware

Then repeat the grub-install and grub-mkconfig steps.


🪪 Understanding GRUB Components on Arch

  • /boot/grub/grub.cfg: Main GRUB configuration file.
  • /etc/default/grub: Template used to generate grub.cfg.
  • /boot/efi: Mount point of the EFI partition (UEFI systems only).
  • grub-install: Installs GRUB to the disk or EFI partition.
  • grub-mkconfig: Regenerates GRUB’s configuration file.

🛡 Best Practices to Prevent Future Issues

  1. Avoid overwriting the bootloader: Especially when installing another OS like Windows.
  2. Keep backup of /boot and /etc/default/grub: You can restore settings more easily.
  3. Use Timeshift or Snapper with Btrfs: Rollback your system if a kernel or GRUB update fails.
  4. Document your partition layout: Having a note of your /, /boot, and /boot/efi partitions can be a lifesaver.

🏁 Conclusion

Repairing the GRUB bootloader on Arch Linux might seem daunting at first, especially for users who’ve never worked with chroot or UEFI partitions. However, once you understand the underlying process—mounting, chrooting, reinstalling GRUB, and regenerating its config—the steps become straightforward.

Whether you’re using BIOS or UEFI, the most important parts are correctly identifying your partitions and executing the proper grub-install and grub-mkconfig commands. With a bit of patience and careful command execution, you can get your Arch Linux system back up and running smoothly—without a full reinstall.