Grub
There are two methods two reinstall grub:
Note: the grub bootloader is always 32-bit code, so you don't have to ensure you get an amd64 livecd just because you have an amd64 system.
Method 1
This method will install the grub bootloader from the live cd onto your hard drive.
1. Acquire a live cd with grub on it.
2. Boot the live cd.
3. Open a terminal
4. Become root (from now on being root is implied for this guide)
sudo -i
5. Create a temporary working area. I like to use /target, its a debian habit.
mkdir /target
6. Mount your root partition. I'll be assuming its the first partition on sda for my examples
mount /dev/sda1 /target
7. If you have a seperate boot partition (the 2nd partition on sda in my example) then you have to mount that as well. Skip this step otherwise.
mount /dev/sda2 /target/boot
8. I don't want to catch anyone not drinking
cd /pub; more beer
0. Run the grub installation command (If this command isn't found then see method 2)
grub-install --root-directory=/target /dev/sda
10. Unmount your boot partition if you had one
umount /target/boot
11. Unmount your root partition
umount /target
12. Reboot (make sure to remove the livecd at some point)
Method 2
This method creates a fakeroot containing your actual installed linux distro and then installs the grub from that to your hard disk.
1. Acquire a live cd
2. Boot the live cd.
3. Open a terminal
4. Become root (from now on being root is implied for this guide)
sudo -i
5. Create a temporary working area. I like to use /target, its a debian habit.
mkdir /target
6. Mount your root partition. I'll be assuming its the first partition on sda for my examples
mount /dev/sda1 /target
7. If you have other partitions you'll want to mount them now at the appropriate places under /target. You must have atleast /usr and /boot mounted if they are seperate partitions:
mount /dev/sda2 /target/boot mount /dev/sda3 /target/usr
8. Now we need to mount some extra virtual partitions
mount -o bind /dev /target/dev mount -o bind /dev/shm /target/dev/shm mount -o bind /dev/pts /target/dev/pts mount -o bind /sys /target/sys mount -o bind /proc /target/proc mount -o bind /proc/bus/usb /target/proc/bus/usb
9. Enter the fakeroot
chroot /target
10. Run the grub installation command (If this command isn't found then see method 2)
grub-install /dev/sda
11. Exit the fakeroot
exit
12. Unmount the virtual partitions
umount /target/proc/bus/usb umount /target/proc umount /target/sys umount /target/dev/pts umount /target/dev/shm umount /target/dev
13. Unmount your other partitions if you have them
umount /target/usb umount /target/boot
14. Unmount your root partition
umount /target
15. Reboot (make sure to remove the livecd at some point)