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?

share|improve this question
    
Two possibilities: (1) Boot-Repair (2) Super Grub Rescue Disk See: http://linuxnorth.wordpress.com/2012/02/07/repairing-grub/ – CentaurusA Sep 25 '12 at 0:49
    
The steps listed in the question to boot worked for me. One should remember linux's partition correctly though. – TheCrazyProgrammer Sep 12 '14 at 2:31
    
As others have said doing update-grub and then grub-install /dev/sda solves the problem. – TheCrazyProgrammer Sep 12 '14 at 2:34
    
See Karthik's answer for "file not found": askubuntu.com/questions/443241/… – samusarin Jun 9 '17 at 2:01

I would try running update-grub in order to build grub.conf / grub.cfg again.

You can try also using grub-install, but I think this one won't help.

If you want to read more, check first which version you have (GRUB 1 or 2) by running:

dpkg -l | grep grub

If you have GRUB 2, you can use the following tutorial: http://www.dedoimedo.com/computers/grub-2.html

Of course be careful dealing with GRUB as we are talking about the boot process, which is a sensitive mechanism.

share|improve this answer
1  
grub-install <correct-drive, i.e. /dev/sda> and update-grub2 finally did it for me on Ubuntu 15.04 – Greg Kramida Jun 28 '15 at 11:39

It seems to me that update-grub assembles the grub.cfg, but you also need to (re-)run grub-install (or grub-setup?) to update the MBR / boot sectors with the basic info -- on which partition to find the grub.cfg file & apparently these modules.

share|improve this 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 u see such 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

share|improve this answer
    
The OP already knows how to boot into his OS. This answer could be more concise. – Elder Geek Nov 3 '16 at 14:06
    
This answer was helpful to me. My problem was not exactly the same as the original question, so the additional information became useful. – retroj Feb 10 '17 at 15:09
    
+1 This fixed by problems on a failed KDE Neon install. – Darren Lewis Nov 20 '17 at 19:39

When you get a GRUB rescue prompt, it means that the GRUB bootloader cannot locate its modules from the partition that contains them in /boot/grub. The reason for this is that the code that fits in the drive MBR record is tiny, and so its main purpose is to locate and load the rest of the bootloader code. Once it's loaded its modules it can present the GRUB menu and handle the rest of the boot process. If it can't find the modules, it presents a very limited rescue prompt.

So, what you are seeing is totally normal if you repartitioned, thereby breaking the reference the bootloader had to the partition containing the boot modules.

Since you can boot manually, the simplest fix is to manually boot and reinstall the bootloader in the MBR so that it has the correct reference to your partition. The way to do that is:

sudo grub-install /dev/sda

This assumes you boot from /dev/sda (most cases, but if not, replace it with the correct drive).

This solution is far simpler than using the boot-repair, but if you are unsure this may be more suitable.

share|improve this answer
    
+1 for explaining what's going on in easy-to-understand terms. – monotasker Apr 25 '14 at 13:57

The simplest way would be:

sudo apt-get purge grub-pc grub-pc-bin

Then:

sudo apt-get install grub-pc grub-pc-bin
share|improve this answer
2  
This is a sledgehammer approach that will likely work, but it's simpler just to reinstall the bootloader to update the reference to the partition (which was broken by repartioning). – bcbc Dec 15 '12 at 17:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.