Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!

Sunday, November 6, 2011

Fix grub 2 -rescue prompt without LiveCD

Source by Black God Sept 2011
In green my special example with diskmapper fakeraid /dev/dm-0 with ubuntu 11.04
You have a GRUB rescue prompt. I mean when you boot your laptop, you were not welcomed with GRUB menu, instead with a rescue prompt.
You will note that grub1 commands in this shell did not respond positively.
With the GRUB2 commands you can be able to get into your Linux installation (in my case: Debian wheezy) without any Live CD or other OS installation.
Enter the following command in sequence.
I have given (hdX,Y) as generic syntax, where
X is your hard disk number and
Y is the partition number.
set prefix=(hdX,Y)/boot/grub
insmod (hdX,Y)/boot/grub/linux.mod
For example, if your grub is in /dev/sda1 [/dev/dm-2] then it is (hd0,1). [(hd0,2)]
In linux command line, pass your appropriate boot and root device. I have mentioned it as /dev/sdZX. /dev/sda1 (boot in root partition)  
[/dev/dm-2 (boot) and /dev/dm-7(root)] (separate partitions)
set prefix=(hd0,2)/boot/grub
insmod (hdx,y)/boot/grub/linux.mod
set prefix=(hd0,2)/boot/grub

insmod (hd0,2)/boot/grub/linux.mod 
The above two command will put grub in regular command mode. This is the extra step you need in case of GRUB2. The below three steps are options, it may be needed – I am not sure.
insmod part_msdos
insmod ext2
insmod gzio
Now continue with GRUB2 commands.
set root=(hdX,Y)
 linux /boot/vmlinuz-xxxxx-generic root=/dev/sdAX ro
 initrd /boot/initrd.img-xxxx-generic
boot
set root=(hd0,7)

linux /boot/vmlinuz-2.6.38-12-generic root=/dev/dm-7 ro

initrd /boot/initrd.img-2.6.38-12-generic

boot
Guys, now you should see kernel and initial ram disk loading message. You are done!
Note: Here is how it can be done with Live CD.
Your comments are welcome on corrections and omissions.
Related content:
How to chroot Ubuntu using Live CD to fix GRUB rescue prompt
Boot CDROM through GRUB
Arch Linux: Kernel panic after update – a solution
Automated Data backup of Ubuntu Linux using Remote Backup software rsnapshot in Debian
How to safely remove ubuntu in dual boot installation

No comments: