This applies to the situation that when Windows and Ubuntu coexist on a computer and we reinstall Windows for some reasons, the Grub loader is lost. However, Ubuntu is still there. Do the following to recover.
- Restart with Ubuntu LiveCD.
find /boot/grub/stage1to find where the Grub is installed. For example
- Restart the computer, and it’s done!
Update: with the introduction of Grub 2, the above method is not working. See here for a solution, adapted for my case below.
gpartedto figure out where the system has been installed. For my case,
- Mount the root directory.
mount /dev/sda11 /mnt
- Install the Grub 2 loader.
grub-install --root-directory=/mnt/ /dev/sda
- Restart the system and the Grub 2 loader is shown.
- Use the following to boot the system. <pre>grub>find /boot/grub/core.img grub>root (hdx,y) (previous command will output the x,y) grub>kernel /boot/grub/core.img grub>boot
- After the system is booted, install the bootloader.
sudo grub-install /dev/sda