Here is a quick HowTo using a Linux Live CD to get grub re-installed.
First of all you'll need a Linux Live CD, I used Parted Magic since I have it on a USB Thumb Drive which boot fairly fast.
Once you've booted into your Live CD of choice you'll need to mount your root filesystem, in my case it was /dev/sda6. Next we will need to bind /proc, /dev, and /sys to the root filesystem where grub resides, to acomplish this we will be using "mount -o bind" which re-mounts a subtree somewhere else so that its contents are available in both places.
mount -o bind /proc /ramdisk/media/sda6/proc/ mount -o bind /dev /ramdisk/media/sda6/dev/ mount -o bind /sys /ramdisk/media/sda6/sys/
Parted Magic mount its drives under /ramdisk/media
Next we need to chroot into the root filesystem in order to run grub. Since we binded /proc, /dev, and /sys the chroot environment should behave as if the we had booted directly into the root filesystem.
chroot /ramdisk/media/sda6 /bin/bash
The second parameter forces chroot to load bash as its shell, if this option is omitted /bin/sh will be loaded.
Now we can start working with grub.
root@PartedMagic:/# grub GNU GRUB version 0.97 (640K lower / 3072K upper memory) [ Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device/filename. ] grub> find /boot/grub/menu.lst (hd0,5) grub> root (hd0,5) Filesystem type is ext2fs, partition type 0x83 grub> setup (hd0) Checking if "/boot/grub/stage1" exists... yes Checking if "/boot/grub/stage2" exists... yes Checking if "/boot/grub/e2fs_stage1_5" exists... yes Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 17 sectors are embedded. succeeded Running "install /boot/grub/stage1 (hd0) (hd0)1+17 p (hd0,5)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded Done. grub> quit
Now grub is installed on /dev/sda and all we need to do is a little housekeeping and restart the system.
First we need to exit the chroot environment by typing exit. Next we need to unmount out binds
umount /ramdisk/media/sda6/dev umount /ramdisk/media/sda6/proc umount /ramdisk/media/sda6/sys
All done. Restart the system and you should have grub as your boot manager.
No comments:
Post a Comment