How to fix grub boot loader after a Windows update on dual boot systems

In this how-to we’ll see how to fix grub boot loader after a Windows update breaks it.

Why does Microsoft Windows tend to break my dual boot when updating?

Simple, Microsoft code quality is very low, extremely buggy and insecure. This is not an attack on Microsoft, I personally don’t have any problem with them but after so many years using their products (mostly Windows) I have come to the conclusion they have lost control of most of their code and simply cannot cope with all the challenges they have to face every day.

There is no need to break grub boot loader when updating Windows, so it’s just another buggy behaviour of Windows. If Windows really need to alter temporarily it’s boot process they can either use UEFI or alter the process within their boot partition. These should be possible even on secure-boot configured systems.

With that said my apologies to Microsoft for being so direct, but there is really no other way to clarify this.

How can I fix it?

If, after Windows updates, you reboot your system and get this error message:

error: unknown filesystem

Your grub boot sequence have been screwed up by Windows update process.

To fix it the first thing you’ll need to do is to find which partition on your disk contains the boot partition for your other Operating System (let’s say, for example, Linux).

  1. To find the boot partition you’ll have first to execute the ls command as follow (if you are not familiar with grub then please note “grub rescue>” is grub rescue mode prompt):
grub rescue> ls

this command should display an output similar to the following:

(If you have an old partitioning set)

(hd0) (hd0,msdos5) (hd0,msdos2) (hd0,msdos1)

OR (if you have a modern partitioning set)

(hd0) (hd0,gpt6) (hd0,gpt5) (hd0,gpt4) (hd0,gpt3) (hd0,gpt2) (hd0,gpt1)

Please Note: It may also show your other hd (like, for example hd1 etc… but we generally consider only hd0 for boot purposes, unless you have done a different configuration when installed your HD, OS and/or configured your BIOS)

It may also show you a different number of elements, it depends on the number of partitions you (or your OS installer) have created originally…

2. Next we need to find which of these partitions contains your OS boot partition, as we mentioned earlier in this article we’ll use as an example Linux which uses /boot/grub (or /boot/grub2) as boot partition (if you are recovering grub boot loader for a different OS please verify which boot partition it uses before continuing to read this how-to)

To find the boot partition among all the partitions listed previously we need to do a try and fail (in other words we need to try to display each partition and see if it contains our boot files). To do this let’s start using ls command for each of them:

grub rescue> ls (hd0,6)/boot/

If hd0,6 does not contain /boot then you’ll probably get an error message saying:

error: unknown filesystem

In this case repeat the command above using a different partition number between the ones grub displayed to you when you executed your first ls at point 1.

If, instead, grub displays you a list of files and directories then look at the and see if there is a subdirectory called grub or grub2 (certain Linux distros use grub2 while others use grub).

3. When you find your grub directory you can setup your variables and prepare your system to boot as follow:

For the sake of this how-to let’s assume that partition 2 had the /boot directory and grub sub-directory (in your case please replace partition number and grub sub-directory name as required with your system!)

grub rescue> set prefix=(hd0,2)/boot/grub
grub rescue> set root=(hd0,2)
grub rescue> insmod normal

After executing the last command (insmod normal) your grub prompt font generally will change aspect a little.

4. At this point it’s time to start grub boot menu and to do that we execute:

grub rescue> normal

Your old grub boot menu should appear now and you can boot your system as usual.

5. When your Operating System has completed its startup get to the console and rebuild your grub configuration. To do this on a Linux System use:

On Debian and Debian derived Linux like KALI, Ubuntu, PrometheOS etc:

# sudo update-grub

OR on RHEL and derived Linux like Fedora, PacketLinux, CentOS, Scientific Linux etc:

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

6. Then verify which disk was your boot disk in Linux. To do so a quick way is to run command:

# df -l

And check on which device you have /boot/efi for example. Here below in my output I see it’s on sda:

Filesystem   1k-blocks      Used    Available Use% Mounted on
/dev/sda6        97280     50180        47100  52% /boot/efi

So, let re-install grub bootloader on sda (in your case replace sda accordingly with what is your boot disk!)

On Debian and debian-based distros like KALI, Ubuntu, PrometheOS etc:

# sudo grub-install /dev/sda

On RHEL and RHEL-based distros like Fedora, PacketLinux, CentOS, Scientific Linux etc:

# grub2-install /dev/sda

7. You’re done, you can now reboot your system and verify that everything is back fully functioning correctly:

# sudo reboot

Thanks for reading and, if you enjoyed this post, please support my blog by visiting my on-line hacking and engineering merchandise shop on by clicking here, thank you!:)



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s