The GRUB (Grand Unified Bootloader) is an integral part of your Linux system. It’s the boot loader that makes it possible for your system to boot into your Linux OS. However, if something goes wrong with it, it can be a little intimidating to fix. But don’t worry! In this blog post, we will walk you through the steps to repair your Linux GRUB.
What You’ll Need
You’ll need a live CD or USB of Ubuntu or any other Linux distribution. This will help us access the system without needing to boot into the Linux OS itself.
Steps to Repair the GRUB
1. Boot From Your Live CD/USB
Insert your Live CD or USB into the computer and reboot. Make sure your BIOS is set to boot from the CD/USB. Once you boot up, choose the option to “Try Ubuntu without installing” or a similar option if you’re using a different distro.
2. Find the Root Partition
Next, we need to locate the root partition. Open a terminal and type the following command:
sudo fdisk -l
This will list your partitions. Look for the one that is marked as / (root).
3. Mount the Root Partition
The root partition needs to be mounted so we can work on it. Replace X with your root partition:
sudo mount /dev/sdaX /mnt
4. Reinstall GRUB
Now that we have mounted the root partition, we can reinstall GRUB. Simply type:
sudo grub-install --root-directory=/mnt /dev/sda
Replace /dev/sda with your actual hard drive. This will reinstall GRUB.
5. Reboot
Finally, reboot your system, remove the live CD/USB, and check if your GRUB is working properly now.
Conclusion
Repairing Linux GRUB might seem like a daunting task, but with these steps, you should be able to get your system up and running in no time. Remember to be careful while handling partitions and commands and feel free to refer to this guide whenever you face any issues related to GRUB.