Did you ever lost your grub bootloader after installing winblows on a dual boot system ? I bet you do 😀 , since winblows always re writing the MBR of the harddisk at the end of installation, then the grub bootloader will always lost after winblows installation. In KLIXs since 2007 version till now I always include the utility named as “redo-mbr” as a part of basic tool utility on each KLIXs release, to help user restoring the grub bootloader. The “redo-mbr” utility is using shell script and zenity / kdialog as the UI, it was easy to use just point and click, there are no point to explain. Rather than explaining how to use that redo-mbr, I will explain now how to restore the grub back using grub itself from konsole.
Here is the steps :
At konsole screen logon as root and enter the grub utility :
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>
then try to find the menu.lst along the available harddisk, you should see something like this :
grub> find /boot/grub/menu.lst
(hd0,0)
(hd1,0)
To make sure you point the “right” harddisk to restore the grub bootloader, do this command to see the partition on target :
grub> geometry (hd1)
drive 0x81: C/H/S = 30401/255/63, The number of sectors = 488395055, /dev/sdb
Partition num: 0, Filesystem type is ext2fs, partition type 0x83
Partition num: 1, Filesystem type unknown, partition type 0x82
Partition num: 2, Filesystem type is ext2fs, partition type 0x83
Yep, I grab the right harddisk partition to restore, so now I must select it :
grub> root (hd1,0)
Filesystem type is ext2fs, partition type 0x83
Now I grab the first partition on my second harddisk and ready to restore the grub on that partition. Now restore the grub with this command :
grub> setup (hd1,0)
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 (hd1,0)”… failed (this is not fatal)
Running “embed /boot/grub/e2fs_stage1_5 (hd1,0)”… failed (this is not fatal)
Running “install /boot/grub/stage1 (hd1,0) /boot/grub/stage2 p /boot/grub/menu
.lst “… succeeded
Done.grub>
Succeed, and now reboot to see the fruit of my labour.
More Information
At this point you should be fully ready to head off into restoring your grub bootloader. However, it should be noted that this is just the tip of the iceberg. What we’ve now constructed is a “Trivial Steps”, and a rather bare-bones one at that. While more than adequate for most usages, some users will have more complicated requirements and conditions. For these users I may refer the following resources:
- The grub manual –> type man grub on konsole
- http://www.gnu.org/software/grub/manual/grub.html