Fixing GRUB on Arch Linux

Return to the OS whence you came!

Fixing GRUB on Arch Linux
Share on:

We’ve all done it! We did an update to our system and somehow manage to break GRUB! Now your system won’t boot and your probably feeling a bit lost as to what to do to fix it.

In this guide, I hope to show that all is not lost, and that there is a way to salvage your system back to a bootable state.

First, don’t worry. Secondly, before you panic and try “Balrog your way past GRUBdolf!”, and reinstall your OS - don’t! You’ll only fall deeper into a chasm of despair. There is a way to fix this, but there are a few things you need to do first.

Boot from an Arch Linux USB flash drive

  1. Reboot your PC with the Arch Live USB you used to install Arch Linux.
  2. Boot into the Live USB stick, selecting the “Arch Linux archiso x86_64 UEFI CD” option.

Now we are in the Arch Live USB stick, we need to mount the partitions of our borked system.

List Devices

We need to take a look at our device layout to determine our root and EFI partitions. To list the block devices and show partition names, we’ll use the lsblk command:

lsblk

You should now see the output of lsblk. From here, you need to look at the available partitions and determine your EFI and root names from the list. The EFI partition is normally around 512MB in size, but your root partition will be at the size you chose when you created your Arch Linux install.

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda      8:32   0 111.8G  0 disk 
├─sda1   8:33   0   511M  0 part /boot
└─sda2   8:34   0 111.3G  0 part /

I can see that my /boot is located on partition sda1 and my system root / is located on partition sda2.

📝 For those of you who use NVMe, you will most likely see your /boot and root / on, nvme0n1p1 and nvme0n1p2. If this is the case, then for the rest of this guide, replace my labels sda1 and sda2 with your correct NVMe partition names.

Mounting Partitions

We now need to mount the partitions, so we can gain access to them.

Let’s first mount the root partition:

mount /dev/sda2 /mnt

Next we need to mount the boot partition to the boot folder:

mount /dev/sda1 /mnt/boot/

Access Your Root Partition

Next we are going to change our shell from the Arch Linux Live USB to the newly mounted root partition:

arch-chroot /mnt

Install And Generate GRUB

You are now root in the partition with your broken grub. From here we can reinstall grub to try and fix the problem:

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

If all went well, then the grub installation will have finished, and we need to simply generate the grub configuration file:

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

Everything should be ok now, and you can exit your root partition and go back to the Arch Live USB stick shell by typing:

exit

Reboot

Reboot your pc, and you should see that your GRUB is working again.

For additional information, visit the Arch Wiki GRUB page.