HOW TO USE GRUB RESCUE MODE

There might be many reasons for your GRUB rescue mode to show up. Such as you accidentally deleted the Linux partition in multi-boot operating system environment or you messed up the grub configuration file, even worse you accidentally deleted it. If any of these things happen, you are presented with a rescue mode. Now grub rescue is a great way to get back into your system without the help of any external installation media just by typing in few commands.

GRUB rescue mode

GRUB rescue mode is a manual way to get into the system when you are put out of the system. Now the first step is to locate the partition with your Linux or whatever operating system you want to restore as your primary boot partition such as Windows partition. So issue ls command to list out all the available partitions. The ls command here is bit different than the Linux ls command which will list all the files and directory available. ls Command here will list all the available partition that grub can locate.
List Partition
List Partition
Now I have two partition system here. So it’s showing up the two partitions (You might see more). As shown above (hd0, msdos2) and (hd0, msdos1), one of these partition might have a working operating system which you need to boot from. Type in the following command
ls partition_name
grub rescue> ls (hd0,msdos1)
and
grub rescue> ls (hd0,msdos1)
Check partitions
Check partitions
As shown above, here I get the errors for both the partition “Filesystem is unknown”. That means none of these partitions are bootable. On the other hand if you get output something like “File system is ext3 or ext4.” then this is the partition you are looking for. But that’s not the case with us.
Now issue the set command on grub rescue shell. set command prints out the currently used boot settings.
grub rescue> set

GRUB rescue set
The set command review current boot settings and also used to set variables such as colors, prefix, root.
Output shown in the picture above reveals that there’s another partition (hd0, msdos5) that grub is set to boot from which contains the root file system along with all the grub files. Now we need to execute the following commands one by one to set the new boot parameters to get back to the normal grub boot loader screen.
grub rescue> set boot=(hd0,msdos5)
grub rescue> set prefix=(hd0,msdos5)/boot/grub
grub rescue> insmod normal
grub rescue> normal

GRUB rescue boot parameters
Voila! Now we are in the grub boot menu.
GRUB boot menu
GRUB boot menu

A few of the more important commands of grub rescue mode:

CommandDescription
bootInitiate the boot sequence, also F10 or CTRL-x
catDisplay the contents of readable files; cat (hd0,1)/boot/grub/grub.cfg
configfileLoad a GRUB 2 configuration file such as grub.cfg; configfile (hd0,5)/boot/grub/grub.cfg
initrdLoads the initrd.img, necessary for booting; initrd (hd0,5)/initrd.img
insmodLoads a module; insmod (hd0,5)/boot/grub/normal.mod, or insmod normal
linuxLoads the kernel; insmod /vmlinuz root=(hd0,5) ro
loopMount a file as a device; loopback loop (hd0,2)/iso/my.iso
lsLists the contents of a partition/folder; lsls /boot/grubls (hd0,5)/ls (hd0,5)/boot
lsmodList loaded modules
normalActivate the normal module, if loaded
searchSearch for a device. Type help search for the available options.
setReview current settings, or set XXX to set a variable such as colors, prefix, root
vbeinfoDisplay GRUB 2 available resolutions

0/Post a Comment/Comments

Previous Post Next Post
Probochon.Blog
Hire Us