Fixing GRUB
From Smop.co.uk
Ever had an install go a bit pear shaped and not install grub correctly? In my case this meant that grub was in a half-installed state. But it's useful to be able to fix this from the grub command line (assuming it boots that far).
If you have a graphical version of grub, you will need to hit "Esc" in order to go to the text version (you don't seem to have any power at the GUI level.
Now hit "c" for command-prompt mode.
First you will need to type "geometry (hd0)" - this will tell you the drive geometry for the first disk. Remember, grub uses a different notation from Linux. hd0 is what Linux would normally call /dev/hda.
This will list the current partitions - in my case:
drive 0x80: C/H/S = 1023/240/63, The number of sectors = 78140160, LBA Partition num: 4, Filesystem type is ext2fs, partition type 0x83 Partition num: 5, Filesystem type is reiserfs, partition type 0x83
So these map to /dev/hda5 and /dev/hda6 in Linux terminology. Now one of these is / and one is /boot, but which one?
This is when grub becomes quite powerful (despite the fact that it didn't list partition sizes). Try "find /etc/fstab" (note, you must specify a full path - including the leading slash):
(hd0,5)
Aha - so (hd0,5) aka /dev/hda6 is /. If we repeat this with vmlinuz we get (hd0,4). Note that since that is inside /boot once linux is booted we are really talking about /boot/vmlinuz.
So let's reinstall grub to the MBR (master boot record) just to be safe:
root (hd0,4) setup (hd0)
So now we can quite from the command line ("Esc" again), edit the selected boot entry (by pressing "e") and set it up like this (notice that the kernel image is specified as /vmlinuz not /boot/vmlinuz since (hd0,4) is /boot):
kernel (hd0,4)/vmlinuz root=/dev/hda6
Exit the editor by pressing return, edit the initial ramdisk image by the same technique if required (press "down" then "e") then press "b" to boot the image.
