Tutorials

▷ Repair grub after grub rescue error when removing linux

Table of contents:

Anonim

When we do dual boot on our computer with the Windows system and another Linux system, it happens that, when deleting the partition of the latter system, the error of “ No such partition ” or another “ unknown filesystem ” problem appears and a command line appears With grub, make sure that we recover the grub and we can continue working with the system that remains on our hard drive. But how can we recover the grub or the mbr ? Deleting is very easy, but to recover it we must know how to perform certain tasks in command mode in order to reinstall it.

Index of contents

That is why in this article we will see how to repair the grub or mbr of our computer using grub rescue and other methods of Windows. This is the small disadvantage of having a dual boot and then removing one of the operating systems.

Repair grub with grub rescue if we have not uninstalled Linux

This solution is applicable if the message that we will find on the screen when starting the computer will be the following: " Error: unknown filesystem entering rescue mode..."

If the case at hand is having obtained this error after reinstalling the Windows operating system, and we still have Linux installed on our computer, it will be possible to repair the grub using grub rescue

To do this we must write the following commands in the grub rescue promt:

ls

It shows us the hard drives and partitions of our computer. We must identify the hard drive as (hd0) and each of the partitions as (hd0, msdos1), (hd0, msdos2), etc.

It is possible that depending on the version of the grub this representation changes, for example, we could see (hd0, 1).

So we should write the following command:

ls (hd0, msdos )

We will repeat this process until we identify Linux's own file system. In the case a message will appear like “ Filesystem is ext4

When we have identified it, we will write the following command:

Set root = (hd0, msdos )

Then:

set prefix = (hd0, msdos ) / boot / grub

Now:

normal insmod

And finally:

normal

Now we will have recovered the Linux grub to boot our operating systems. But this is not all, now we will have to boot our Linux system and enter a command terminal to write the following:

sudo update-grub

And then:

I upload grub-install / dev / sda

We put our users password to reinstall the grub and it does not give us any problems again

Repair grub with Windows 10 USB

When we directly format the partition where our Linux operating system was, when booting from our computer we will get a nice message on a black screen that says the following: " error: no such partition entering rescue mode grub rescue ".

This will normally be accompanied by a countdown and an explosion of our computer… or perhaps not.

The case is that this has a solution without the need to completely format our hard drive and therefore also eliminate the Windows operating system.

We could try to follow the previous section on how to fix it directly from the grub rescue promt, but we have an important detail, and that is that when formatting the Linux partition we have also deleted the grub files, so using grub rescue is not going to serve for nothing.

This is why what we will have to do is create a bootable Windows 10 DVD or USB and be able to boot it on our computer. We already have tutorials that explain these two actions very well. As is logical, the USB will have to be done from another friend's computer or another one we have.

Once this is done we can correctly boot our USB and we will get the following screen:

Repair MBR to boot Windows 10 or any other version of Windows

We are going to use a USB with Windows 10, but in the DVDs of previous versions like Windows 8 or Windows 7 we will also have a repair mode where we can do the same.

  • Click on " Repair equipment " Then click on " Solve problems " Next, a menu will appear where we will have to select " Command Prompt "

  • We could select “ Startup Repair ” but it will rarely do anything useful for us.

Already inside the command console we will have to write a series of commands and press Enter to execute each one of them

bootrec / fixmbr

Now:

bootrec / fixboot

Now we will restart the computer and check if the boot has been restored. It is possible that this was not the case, or that when placing the last command, the notice "Access denied" appears. In which case we will have to do the following.

Repair MBR with diskpart (recommended option)

Once again we will start our Windows 10 USB and enter the command prompt, access the command prompt from the Windows recovery menu

  • Now we put the following command

diskpart

  • We will enter the Windows disk management tool.

list disk

  • We list the hard drives and choose the one with the installation with:

sel disk

  • For example, if it is disk 0 we will put " sel disk 0 "

list vol

  • We list the partitions of the selected disk. Here we must identify a partition of approximately 500 MB in which case it has the distinctive "Reserved" We must also locate which is the letter where the Windows system is installed, in our case it is the letter "D: " we will know because it is of type NTFS and it will have more than 20 GB for sure. It is almost always drive D:

select volume

  • In our case it would be volume 1. If it does not have a letter, we assign it one, for example:

assign letter = R

  • Ours does have lyrics already. We now exit diskpart with the command:

exit

  • And we enter this unit with the letter just assigned:

A:

  • To be sure that it is the partition we are looking for, write " dir " and no content should appear. Now we enter the command that matters:

Bcdboot : \ Windows / l en-us / s R: / f all

  • Now it only remains to exit the command prompt and restart the equipment. We will see if the error has been solved.

In this way we will have managed to repair the boot of our computer and we will be able to boot our Windows operating system as normal.

These are the possible scenarios that we can find when our grub broke. Obviously not everyone will be here.

You might also be interested in these tutorials:

  • What to do when Windows 10 does not start errors other than those in this article

Have you managed to fix the error? If not, write us and tell us what problem you have, we will try to help you in everything

Tutorials

Editor's choice

Back to top button