Recently I tried dual-booting FreeBSD and Arch Linux on my laptop. I already have Arch Linux installed and left a partition open for FreeBSD later. I hosed my Grub, and the machine wouldn’t boot.

It’s an easy fix, so I thought I’d share it. This is very similar to how to restore your bootloader after installing Windows. The only difference is, this laptop is 100% Arch Linux, and it’s a UEFI machine.

So, let’s say you’re like me and have Arch Linux installed and you’ve toasted your GRUB bootloader. Here’s what you do.

Boot from an Arch Linux ISO

The first step is to get an Arch Linux ISO, burn it to a USB stick, and boot it.

Select the first option:

How to reinstall boot loader Arch Linux

You’ll land on a prompt that looks like this:

How to reinstall boot loader Arch Linux

Know Your Disks

It’s important to know where your disks are and what partitions are where. You can do this by checking with:

fdisk -l

How to reinstall boot loader Arch Linux

As you can see on my machine, I have my hard drive (/dev/sda), an SDcard (/dev/mmcblk0), and the USB drive I booted into Arch with (/dev/sdb1). I’m most concerned with /dev/sda.

/dev/sda1 is my EFI system. /dev/sda2 is where my Linux installation is that I need to point to again.

Technically since I only have one operating system, I don’t need GRUB, but I have it set up because someday I’ll take the time to wrangle in FreeBSD or something else on there. I digress.

Mount Your Arch System

I need to mount the / partition of my Arch system.

mkdir /mnt/arch
mount -t auto /dev/sda2 /mnt/arch

Ok, now it’s mounted, and time to chroot into it.

arch-chroot /mnt/arch

Now my system is up and running on my root drive. Any changes made here will be as if I logged into my system.

Next, I’ll mount my EFI folder:

mount -t auto /dev/sda1 /efi

I’ll need that when running my update.

Updating GRUB

Now I need to update GRUB. First, I’ll run OS Prober:

os-prober

Obviously, I only have one, but it will update my GRUB config. If you have multiple operating systems, you should do this as well, it should find them.

Now I’ll copy over the new grub config:

grub-mkconfig > /boot/grub/grub.cfg

Cool! I’m ready to install it now.

Installing GRUB

Now I’ll need to install GRUB again, and I do that with the following command:

grub-install --efi-directory=/efi --target=x86_64-efi /dev/sda

Now, this is the string that’s tricky to find in the documentation. There are many options for grub-install, and I learned the above string works due to trial and error. Which is why I’m sharing it.

How to reinstall boot loader Arch Linux

Sweet! Now it’s time to reboot.

You’re Done!

How to reinstall boot loader Arch Linux

If you see this, you’re a happy camper! There’s the GRUB menu!

I’ve hosed my GRUB boot so many times I’ve become a pro at this. I hope it helps! Let me know if you have any questions!

Get notified when new tutorials are posted:



Published: Aug 14, 2020 by Jeremy Morgan. Contact me before republishing this content.