Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

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
add comment

marked as duplicate by Eliah Kagan, Eric Carvalho, Seth, Thomas W., hhlp Mar 18 '13 at 9:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

5 Answers

Two possibilities:

(1) Boot-Repair

(2) Super Grub Rescue Disk

See: http://linuxnorth.wordpress.com/2012/02/07/repairing-grub/

share|improve this answer
add comment

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
add comment

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
add comment

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
1  
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
add comment

When you get a grub rescue prompt, it means that the grub bootloader cannot locate it's 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 it's main purpose is to locate and load the rest of the bootloader code. Once it's loaded it's 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 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
add comment

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