Oct 8, 2012

How To Manually Add Windows 7 To Grub2 in Ubuntu

A few weeks ago I wrote a post about how to fully encrypt your dual boot computer running Windows and Ubuntu. That is how I currently have my laptop set up. It's great for security in the event my laptop gets stolen.

Well I did run into one problem with my setup though. On the Ubuntu side I ran all of the latest updates and after a reboot my Windows 7 option was missing from the Grub menu. The Truecrypt boot loader was still there, just the option to boot from Windows 7 was missing.

No problem though, I just had to add the Windows 7 entry manually. The first thing you should know is that Windows is installed on my /dev/sda1 partition. For the rest of this post I'll assume you have the same setup. Here is how I did it:
  • Create a script called 11_Windows in /etc/grub.d/ 

    sudo nano /etc/grub.d/11_Windows
  • Paste the following in 11_Windows

    #! /bin/sh -e
    echo “Adding Windows” >&2
    cat << EOF
    menuentry "Windows 7" {
    set root=(hd0,1)
    chainloader +1
    }
    EOF


  • Make the script executable

    sudo chmod a+x /etc/grub.d/11_Windows
  • Now update grub

    sudo update-grub
That's it, now after a reboot you should see Windows 7 as an option when you boot up.

[Via  Eric's Notes]




Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | stopping spam