Skip to content

Restore the GRUB Bootloader

Syed Sayem edited this page May 16, 2019 · 1 revision

If the Grub is corrupted and you are not able to boot from your existing Arch Linux system you will need an Arch Linux Bootable USB stick to restore the Grub bootloader.

After you boot into the Arch Linux, run the following command to locate Arch Linux / partition:

# fdisk -l

will show up the following partitions:

Device          Start        End    Sectors   Size Type
/dev/sdc1          40     409639     409600   200M EFI System
/dev/sdc2      409640 1172546783 1172137144 558.9G unknown
/dev/sdc3  1172547584 1319348223  146800640    70G Linux filesystem
/dev/sdc4  1319348224 1323542527    4194304     2G Linux swap
/dev/sdc5  1323542528 1465245695  141703168  67.6G Linux filesystem
/dev/sdc6  1465245696 1465278463      32768    16M Microsoft reserved
/dev/sdc7  1465278464 1952535901  487257438 232.4G Microsoft basic data
/dev/sdc8  1952536576 1953521663     985088   481M Windows recovery environment

In my case Arch Linux filesystem is on /dev/sdc5.

mount -t ext4 /dev/sdc5 /mnt

FYI /dev/sdc5 is the partition where Arch Linux is installed.

After this step you need to run this command in order to chroot into your Arch Linux installation:

arch-chroot /mnt

This command only works with Arch Linux, but you can replace it with the correct chroot command if you’re using a different Linux distribution.

Now we need to locate the EFI partition. Run the following command again to locate EFI partition:

# fdisk -l
Device          Start        End    Sectors   Size Type
/dev/sdc1          40     409639     409600   200M EFI System

We need to check the partition marked as EFI System

After that, we need to mount this partition, for example, on /boot/efi:

# mount /dev/sdc1 /boot/efi

Finally, we reinstall the corrupted Grub the following command:

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

Now we need re-generate the grub

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

Reboot the system

Exit chroot environment by pressing Ctrl + D or typing exit

Unmount system mount points:

# umount -R /mnt

Reboot system:

# reboot

Remember to remove USB stick on reboot

 

After rebooting the system the Grub should be fine.
Clone this wiki locally