Ubuntu – Grub rescue prompt, repair grub

bootgrub2grubrescue

I recently repartitioned my HDD and I have damaged GRUB on my system. On boot I get the GRUB rescue prompt and I have to go through the following steps in order to boot normally:

set root=(hd0,msdos6)
set prefix=(hd0,msdos6)/boot/grub
insmod normal
normal

(Those steps were found on another post on here!).

I'm very tired of repeating this on every boot, how do I permanently fix GRUB?

Best Answer

To fix grub rescue go with following steps:

  • First thing is we have to start our OS only then after we can fix grub.

    #to start OS-->
    error: unknown filesystem.
    Entering rescue mode...
    grub rescue>
    

    When you see such an error first we have to check for “Filesystem” is ext2'

    grub rescue> ls        # type 'ls' and hit enter to see drive partition.
    (hd0) (hd0,msdos6) (hd0,msdos5) (hd0,msdos4) ...   # you will see such things 
    

this are our drives now we have to check which one is ext2.

grub rescue>ls (hd0,msdos6)
error: disk 'hd,msdos6' not found.

go for another drives until you get “Filesystem is ext2”.

grub rescue>ls (hd0,msdos5)
error: disk 'hd,msdos5' not found.
grub rescue>ls (hd0,msdos2)
(hd0,msdos2): Filesystem is ext2        # this is what we want

now set the path

grub rescue>set boot=(hd0,msdos2)
grub rescue>set prefix=(hd0,msdos6)/boot/grub
grub rescue>insmod normal
grub rescue>normal
  • Now just fix grub by following command on any Ubuntu

    sudo grub-install /dev/sda
    sudo apt-get update
    # to update grub
    sudo apt-get upgrade
    

make sure you must update grub after login into OS

Related Question