Warning: filemtime(): stat failed for /var/websites/whoopis.com/howtos/howto_restore_mbr_grub.php in /home/mbates/whoopis.com/functiondefs.php on line 56
Last modified: December 31 1969 16:00:00
Scenario: After installing a kernel upgrade via yum, rebooting the server resulted in a blank screen with blinking cursor in the upper-left corner, right after BIOS. No grub menu or anything else. Turns out that what had happened was, the MBR got corrupted or erased. We're not sure if it was caused by the kernel upgrade or if that was a coincidence. Anyway, using another howto as a framework, we did the following.
If your grub.conf is missing or corrupted, you're kind of on your own. Here's a sample:
default=0 timeout=5 splashimage=(hd0,1)/boot/grub/splash.xpm.gz title Red Hat Linux (2.4.18-14) root (hd0,1) kernel /boot/vmlinuz-2.4.18-14 ro root=LABEL=/ hdc=ide-scsi initrd /boot/initrd-2.4.18-14.img title Red Hat Linux (2.4.18-openmosix3) root (hd0,1) kernel /boot/vmlinuz-2.4.18-openmosix3 ro root=/dev/hda2 hdc=ide-scsi initrd /boot/initrd-2.4.18-openmosix3.img title WindowsME rootnoverify (hd0,0) chainloader +1
Tell grub where to find the requisite files. If you know where they are, enter something like:
(hd0,1) means primary controller master, second partition. If you DON'T know where they are, type:
find /boot/grub/stage1and then enter the root command with the correct parameters. Note: If you are using a separate /boot partition , as the official documentation says: "... if you have the partition /boot and you install GRUB images into the directory /boot/grub, GRUB recognizes that the images lies under the directory /grub but not /boot/grub.' Thus, if 'find /boot/grub/stage1' does not find the file, try 'find /grub/stage1'."
setup (hd0)This command will install grub on the MBR of the first drive.
In our case, the details were all identical except that we used (hd0,0) in place of (hd0,1) because our /boot was on the first partition of the first drive.
NEW -- the "magic/more magic" light switch cover!