How To Recover GRUB & GRUB2 in Linux Systems

This comprehensive tutorial is designed to guide users through the process of recovering GRUB and GRUB2, which are essential components for booting Linux systems. In situations where both Linux and Windows are installed on the same hard drive and Windows is reinstalled or installed alongside Linux, the Windows Master Boot Record (MBR) may delete GRUB, rendering the Linux system unable to boot. 

What is GRUB?

Fortunately, this tutorial provides a step-by-step solution for recovering GRUB and GRUB2. Before getting started, it is important to understand that GRUB is a boot manager developed by the GNU project that allows users to have multiple operating systems on their PC and boot from each of them. 

To begin the recovery process, users will need to have a Linux Live CD on hand. With the help of this tutorial, users can rest assured that they will be able to successfully recover GRUB and GRUB2, ensuring that their Linux system is up and running smoothly once again.

How to recover GRUB

We will start by recovering the GRUB.

Insert the CD or USB with Linux and restart the PC, start in BIOS mode and configure the boot so that your external device is first. When you finished, save and reboot.

How to recover GRUB

When you start again, you will do it through our Live CD.

Now, we execute the following commands, first:

sudo fdisk -l

How to recover GRUB

Write down the device that has Linux type. In my case sda1. Now it’s time to execute:

 

sudo grub

And in this case, we have to take into account what was seen in the fdisk command. If Linux is in sda the X will be 0, if it is sdb, it will be 1…, and the Y will be the number that appears next to sda, but subtracting 1.

root (hdX,Y)

Note: In my case, it would be roo (hd0,0)

And finally:

setup (hd0)

When we finish we close the terminal and restart (do not forget to change the boot order or remove the external device) and we can access our Linux.

How to recover GRUB 2

Now let’s see how to recover the GRUB 2 from Ubuntu.

Follow the first to steps in the previous section.

Now, execute:

sudo fdisk -l

How to recover GRUB 2

We will get information, look where it says in Type Linux and write down the Device column, in this case, /dev/sda1.

Now we have to mount the partition, for this we execute:

sudo mount /dev/sda5/mnt

The GRUB bootloader files are installed, execute the following, keep in mind that sda is the boot disk, put yours, mine, in this case, is sda:

sudo grub-install --root-directory=/mnt/ /dev/sda

How to recover GRUB 2

Restart the PC, without forgetting to change the boot order or remove the external device. This will make us start the Ubuntu that we had installed.

Now we have to execute a few more commands, so reopen the terminal and execute:

sudo grub -mkconfig

It helps us to avoid errors in partitions and that we can start Windows from the GRUB. You’ll see many letters come out on screen, quiet is usual, wait until it’s over.

Now we execute a command to update the GRUB:

sudo update -grub2

How to recover GRUB 2

You’re done, you should be able to start your PC on both Windows and Linux.

It might be interesting

GitHub plans to close Atom open source editor

The free Github Atom code editor will be discontinued in December 2022. The appointed CEO of Github, after Microsoft's purchase of the service in 2018, has in the past been extremely positive about the project and promised that it would live on and grow.

New Twitter Video Application for BlackBerry

TwitVid is a new application from Twitter that brings you easy ways to share videos on Twitter. This is quite an interesting application that makes Blackberry App World quite free.

MySpace near to launch its Webmail Service

During the last month, there were reports that MySpace had reached quite near to launch its new webmail service.

Mount Linux Partitions Ext4, Ext3, Ext2 in Windows 8, 10, 11

If you're a tech enthusiast, you may have come across the challenge of accessing Linux partitions in Windows 10. This can be a common issue for those who use dual boot devices or those who tinker with Raspberry Pi memory cards. Unfortunately, Windows only allows working with partitions in Fat32, NTFS or exFAT format, which can make it difficult to access other file systems such as Ext2, Ext3, Ext4 or even ReiserFS.