[SOLVED] Ubuntu Startup-manager killed my windows partition entry in GRUB2

The issue

I had a scary thing happen the other day: the windows xp entry on GRUB2’s boot screen went missing!  This happened shortly after the windows partition had been encrypted with a McAfee product.  Ubuntu didn’t remove the entry itself; it was actually only after I tried to make a change to the startup configuration using a program called Startup-manager (you may have it in System > Administration) that the windows entry was removed. It was bad enough that Ubuntu could no longer see any files on the windows partition (mounted as /windows), but now I had no way to boot into windows to retrieve files.

The fix

And of course, I had no freaking clue how to manually modify GRUB2’s startup screen.  But after some digging, I figured out how to do it.  This worked for me in Ubuntu 9.10 Karmic Koala.  Hopefully it will save someone else’s day:

  1. Figure out where windows is.  Is it /dev/sda1 (very likely)? /dev/sda2?  To do this:
    1. System > Administration > Disk Utility
    2. Click each partition and find the one which matches the size of your bootable windows parition and which, when selected, shows a partition type of HPFS/NTFS. Example:
    3. Note the location of the partition; it is the last line of the descriptors of the partition. In the screenshot above, mine is /dev/sda1.
  2. Press ALT+F2
  3. enter the command gksudo gedit /etc/grub.d/40_custom
  4. below the comments in this file, and below any other entries which may have been added by one thing or another, add the following:
    [sourcecode language=”plain”][/sourcecode][/sourcecode]

    echo “Adding Windows XP on {LOCATION OF YOUR WINDOWS PARTITION}” >&2
    cat << EOF
    menuentry “Windows XP Professional (on {LOCATION OF YOUR WINDOWS PARTITION})” {
    insmod ntfs
    set root=(hd0,{JUST THE LAST NUMBER OF THE LOCATION OF YOUR WINDOWS PARTITION})
    drivemap -s (hd0) ${root}
    chainloader +1
    }
    EOF[/shortcode]

  5. Replace {LOCATION OF YOUR WINDOWS PARTITION} in the code above with the location of your windows partition.
  6. Replace {JUST THE LAST NUMBER OF THE LOCATION OF YOUR WINDOWS PARTITION} with the last number of the location of your windows partition. E.g. /dev/sda1 would be 1.Your file will now look something like this:
  7. Save the file and close the editor.
  8. Press ALT + F2.
  9. enter the command gksudo grub-mkconfig

That should be it.  When you reboot, you should see your windows as a bootable option again.

Morals

The moral of this tale is to avoid startup-manager for grub configuration changes unless you’ve not got funky partitions. Keep in mind that future versions of start-up manager may fix this issue; the version i’m using is 1.9.12-ubuntu1.

Credits

I would not have been able to troubleshoot this issue if it weren’t for the following gracious contributions to the global knowledgebase.

2 thoughts on “[SOLVED] Ubuntu Startup-manager killed my windows partition entry in GRUB2”

  1. Thank you very match for your time and your help. Although i had the same problem (lost my windows vista entry). The cause was different. While i was trying to remove older kernels from grub2 i set the 30_os-prober file non-executable (by accident while running a command copy paste….) the solution : run chmod a+x 30_os-prober while being in /etc/grub.d/

Leave a Comment

Your email address will not be published. Required fields are marked *