Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I recently installed Ubuntu. It lets me to use GParted to let me take free space from Windows XP partition. After installing Ubuntu, it nicely presents a boot menu that lets me to boot either UBuntu or XP.

Now, my XP sucks and I need to remove/re-install it. Then how can I restore the boot menu of Ubuntu?

Thank you.

share|improve this question

migrated from serverfault.com May 10 '10 at 10:36

This question came from our site for professional system and network administrators.

1 Answer 1

You can re-install Windows, no worries. I assume in the following that you have at least Ubuntu 9.10, if not 10.04.

First step: boot on a live CD. Mount your ubuntu partition from Places menu, check with mount | tail -1 You should see something like

/dev/sda2 on /media/0d104aff-ec8c-44c8-b811-92b993823444 type ext4 (rw,nosuid,nodev,uhelper=devkit)

Go into this folder, /media/yourUUID (replace yourUUID with 0d104aaf etc, depending on what you got in the previous command). Type ls, you have to get config-2.6.22-2-686, grub, lost+found, etc. If you don't, try a different folder.

Once you get the correct UUID, you can re-install the grub:

sudo grub-install --root-directory=/media/yourUUID /dev/sda

(replace yourUUID with your own sequence)

You should get this message:

Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.
(hd0)   /dev/sda

Reboot, and voila, the grub menu gives you Windows and Ubuntu !

share|improve this answer
    
Ok, thank you. sudo grub-install --root-directory=/media/yourUUID /dev/sda I need to replace UUID that blogs to Linux/Ubuntun partition right? Thanks gain. –  jack May 10 '10 at 10:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.