Restoring Grub: When All Else Fails, Reinstall
Table of Contents
Restoring Grub: When All Else Fails, Reinstall
When you've tried every trick in the book to fix Grub but to no avail, you might be left feeling at a dead end. However, there is still one option you can resort to: reinstalling Grub. Follow the steps outlined below to execute this process successfully.
Step 1: Identify your System Type and Partition Scheme
Are you Using UEFI or BIOS?
To determine if your system employs UEFI or BIOS, execute the following command in a live environment:
ls /sys/firmware/efi/efivars
If this command returns a list of files, your system is using UEFI. If it returns an error or the directory does not exist, your system likely operates on BIOS.
Are you Using GPT or MBR?
To identify the partition scheme utilized on the /dev/sda disk, for example, run this command:
sudo fdisk -l /dev/sda
Look for a line in the command's output that contains "Disklabel type". The value following this text indicates the partition scheme in use. If it is "gpt", your disk is using the GPT partition scheme. If it is "dos", your disk is using the MBR partition scheme (also known as the DOS partition scheme).
Step 2: Scenario: Your System Uses UEFI and Grub
In this case, you need to run the following command:
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
Note: –efi-directory refers to the EFI partition mounted under /boot/efi. If your EFI partition is also your boot partition, you need to execute –efi-directory=/boot instead.