Repair Linux boot failures in GRUB 2 rescue mode

 Basic commands available.

boot (Initiate the boot, also F10 or CTRL-x)
cat (view the contents of config or txt files; cat (hd0,1)/boot/grub/grub.cfg)
configfile (Load a GRUB 2 configuration file such as grub.cfg; configfile (hd0,5)/boot/grub/grub.cfg.)
initrd (Loads the initrd.img, necessary for booting; initrd (hd0,5)/initrd.img.)
insmod (Loads a module; insmod (hd0,5)/boot/grub/normal.mod, or insmod normal.)
linux (Loads the kernel; insmod /vmlinuz root=(hd0,5) ro.)
loop (Mount a file as a device; loopback loop (hd0,2)/iso/my.iso.)
ls (lists the contents of a partition/folder; ls, ls /boot/grub, ls (hd0,5)/, ls (hd0,5)/boot.)
lsmod (List loaded modules.)
normal (Activate the normal module, if loaded.)
search (Search for a device. Type help search for the available options.)
set (Review current settings, or set XXX to set a variable such as colors, prefix, root.)
vbeinfo (Display GRUB 2 available resolutions.)

The Rescue Shell.


You will probably have an output more or less like this:

Your output may differ but you get the information required. Find out which devices are available:


Set to the correct value, which might be something like this:

set prefix=(hd0,1)/grub

(this has to be done according to your own drive name)

set root=(hd0,1)

(this has to be performed according to your own drive name.)

insmod normal

The above commands will get you out of the rescue mode to the normal terminal mode. In the terminal mode you have more commands with increased functionality.
After the above commands you can go ahead and start the rest of the settings.

insmod linux
* linux /vmlinuz root=/dev/sdXY ro

(if this doesn't work try this)

linux /boot/vmlinuz-3.2.0-14-generic root=/dev/sda1 ro


initrd /initrd.img

(Selects the initrd image.)


After Booting the system.

Update the GRUB config file.

sudo update-grub

Reinstallation of Grub on the device:

sudo grub-install /dev/sdX