PDA

View Full Version : grub rescue> Boot fails: Example commands to boot+fix Windows 10 + Linux dual boot



Jeff72
20th December 2015, 10:45 PM
grub rescue> Boot fails: Example "grub rescue" commands to boot and fix (Windows 10 update broke Windows 10 + Linux dual boot):
--------------------------------------------------------------------------------------------------------------==---------------
Explanation:
------------
Windows 10 "Upgrade to Windows 10 Home, version 1511, 10586" (sent out in November/December 2015) creates an additional Windows partition and can break grub2 from booting a dual boot Windows 10 and Linux system.

The example below has hd0 as the primary boot hard drive. Windows was originally on the first partition, with linux /boot on the 2nd partition, and the rest of the Linux LVM partition(s) on 3rd partition.

The example below was using the following partitions setup prior to applying "Upgrade to Windows 10 Home, version 1511, 10586":
-------------------------------------------------------------------------------------------------------------------------------
Dual boot Windows 10 and Fedora Linux system
Before Windows 10 1511, 10586 upgrade:
Partition 1 (hd0,msdos1) Windows primary partition
Partition 2 (hd0,msdos2) Linux /boot partition
Partition 3 (hd0,msdos3) Linux LVM partition (/ and possibly other partitions)

Windows 10 "Upgrade to Windows 10 Home, version 1511, 10586" created a new partition right after partition 1, between partition 1 and 2, which created the following:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
Partition 1 (hd0,msdos1) Windows primary partition
Partition 2 (hd0,msdos2) Windows rescue/upgrade/whatever partition
Partition 3 (hd0,msdos3) Linux /boot partition
Partition 4 (hd0,msdos4) Linux LVM / and other partition(s)
etc...

So, Windows 10 "Upgrade to Windows 10 Home, version 1511, 10586" breaks grub2 because boot block grub2 still thinks it should boot grub2 from (hd0,msdos2) when it now needs to boot from (hd0,msdos3).

Also NOTE: You may have to disable "Secure Boot" in BIOS to allow Linux to boot. Windows may re-enable "Secure Boot" with this upgrade 1511.
----------------------------------------------------------------------------------------------------------------------------------------------

Output you see on boot after starting to install Microsoft "Upgrade to Windows 10 Home, version 1511, 10586"
---------------------------------------------------------------------------------------------------
.
error: unknown filesystem.
Entering rescue mode...
grub rescue>

Show current partitions:
------------------------
grub rescue> ls
(hd0) (hd0,msdos4) (hd0,msdos3) (hd0,msdos2) (hd0,msdos1) (hd1) (hd1,msdos1)

Notes, for above example:
-------------------------
(hd0) is hard drive 0
(hd1) is hard drive 1
(hd0,msdos4) is hard drive 0 partition 4
(hd0,msdos3) is hard drive 0 partition 3
(hd0,msdos2) is hard drive 0 partition 2
(hd0,msdos1) is hard drive 0 partition 1
(hd1,msdos1) is hard drive 1 partition 1
etc...

Show current grub boot settings:
--------------------------------
grub rescue> set
prefix=(hd0,msdos2)/grub2
root=hd0,msdos2

Notes for above example:
------------------------
prefix = location of your /boot partition and path to /boot/grub2 directory (while being in /boot, so just /grub2)
root = location of your /boot partition

Find your current /boot partition containing /boot/grub2 (for example, you want the directory containing grub.cfg):
-------------------------------------------------------------------------------------------------------------------
grub rescue> ls (hd0,msdos2)/grub2
error: unknown filesystem.

grub rescue> ls (hd0,msdos1)/grub2
error: unknown filesystem.

grub rescue> ls (hd0,msdos4)/grub2
error: unknown filesystem.

grub rescue> ls (hd0,msdos3)/grub2
./ ../ grubenv themes/ device.map i386-pc/ locale/ fonds/ grub.cfg

Success, we see grub.cfg on the msdos3 partition now, so our new /boot partition is (hd0,msdos3)

Change current boot grub settings to use correct partition:
-----------------------------------------------------------
grub rescue> set prefix=(hd0,msdos3)/grub2
grub rescue> set root=hd0,msdos3

Verify new settings are pointing to your new grub2 partition:
-------------------------------------------------------------
grub rescue> set
prefix=(hd0,msdos3)/grub2
root=hd0,msdos3

Start grub2 back to "normal" and get the grub boot menu with new grub2 partition settings:
------------------------------------------------------------------------------------------
grub rescue> insmod normal
grub rescue> normal

You should now see the normal grub boot menu, including a boot timer.
Quickly select your Linux boot option and boot Linux, before the system boots Windows (if Windows is your default boot).
NOTE: You need to boot linux to make the new grub settings permanent for future system boots.

After logging into Linux:
Open a command line, then run the following to save settings on boot:
NOTE: This is assuming your Linux boot drive is /dev/sda
(To verify your Linux boot drive, run df /boot and look at the /dev/sd? setting for your system.)
--------------------------------------------------------------------------------------------------------------
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
sudo grub2-install /dev/sda

Your system should now be reconfigured to boot with your active partition table, using the new partition number for your Linux /boot partition.

Test your systems boot with:
sudo reboot

NOTE: When you next boot to Windows 10, Windows 10 will continue with it's upgrade (mine was at 30% complete) and will reboot at least one more time to finish the Upgrade to Windows 10 1511.

LinuxBlue
3rd May 2016, 07:49 AM
I had same trouble and easy fix was to get "Ultimate boot CD" which has boot recovey on it. It got me back up and running when nothing else worked. It is easy to use and works! Solved my problems fast and saved the trouble of re installing fedroa when disk failed to boot and just gave me "Grub rescue> prompt"

jimbim1
31st May 2016, 09:12 AM
Had similar issue with win7, 8 and 8.1 and found this article helpful:
http://twomorecents.com/cant-boot-linux-windows-boot-loader-has-taken-over/

mebrex
16th December 2016, 05:47 PM
my partitions are not msdos, they are gpt. therefore the ls command lists the following:
grub rescue>(hd0) (hd0,gpt8) (hd0,gpt7) (hd0,gpt6) (hd0,gpt5) (hd0,gpt4) (hd0,gpt3) (hd0,gpt2) (hd0,gpt1)

here is out put of set
grub rescue>set
prefix=(hd0,gpt7)/boot/grub
root=hd0,gpt

I think Ubuntu 12.04 uses grub2 bootloader but here set results grub. does it mean ubuntu is deleted?

I try to find my current /boot partition and typing the following results:

grub rescue>(hd0,gpt7)/boot/grub (i tried with all gpt 1,2..8)
err: unknown file system

I desperately tried different paths , but nothing found containing grub.cfg

I Installed ubuntu 12.04 alongside windows8 then updated to windows 10 in December 2015. windows is in UEFI mode and I installed ubuntu in Legacy BIOS mode in my acer machine. Windows 10 has been updated many times since then I dont remember the last time i used my ubuntu os.
now I try to Install it from a USB ISO file and it says no OS detected in this machine .

I am almost novice to ubuntu and I appreciate your help guys!

nobody
17th December 2016, 03:34 PM
http://forums.fedoraforum.org/showthread.php?p=1777611

_nobody_