2012-07-29

HOWTO: GRUB 2 rescue mode

Sometimes (e. g., after some disk re-partitioning) your GRUB 2 installation may get corrupted, so after the power-on you get only a "grub rescue> _" command prompt.
In such cases you'll need to know which disk partitions Linux & GRUB are installed on. In our example, it's 'sda7' (the 7th partition of the 1st HDD).

Type the following commands into the GRUB rescue prompt:
set root=(hd0,7)
set prefix=/boot/grub
insmod linux
linux /vmlinuz root=/dev/sda7 ro
initrd /initrd.img
boot
Notes:
  1. instead of '(hd0,7)', '(hd0,msdos7)' can be used for root;
  2. an alternative prefix is '(hd0,7)/boot/grub';
  3. an alternative insmod command argument path is '(hd0,7)/boot/grub/linux.mod'.
After successfully booting your GNU/Linux system, you should repair your GRUB 2 installation (execute these command as root, use su, or even better, sudo):
# grub-install /dev/sda
# update-grub2
Note: some people like to execute not update-grub2, but update-grub or even grub-mkconfig.

On the next reboot, it should work fine.

Some more useful GRUB2 reading:
  1. GNU GRUB Manual
  2. GRUB2 - ArchWiki
  3. Grub2 - Debian Wiki
  4. Grub2 - Community Ubuntu Documentation
  5. How To Fix GRUB 2 [Linux] ~ Web Upd8: Ubuntu / Linux blog
  6. linux - Making "default saved" work with GRUB2...? - Super User
---
Last updated: 2013-08-31

No comments:

Post a Comment