3 Ways Setting XP/Vista/Windows 7 as default bootup OS In Grub 2

This post was written by admin on November 19, 2009
Posted Under: General

This tutorial shows how to set default boot up OS in Grub 2 in 3 ways.And in my opinion the third one should be the best one,also the easiest one.
Following use XP as example.
Method 1:
Edit /boot/grub/grub.cfg and change XP to the first entry in grub 2.
By default this is read-only file,so change its permission in terminal(Applications/Accessories/Terminal):

sudo chmod 755 /boot/grub/grub.cfg

Then open this file:

sudo gedit /boot/grub/grub.cfg

Cut this section:

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Microsoft Windows XP Professional (on /dev/sda1)" {
	insmod ntfs
	set root=(hd0,1)
	search --no-floppy --fs-uuid --set 48142b45142b34fa
	drivemap -s (hd0) ${root}
	chainloader +1
}
### END /etc/grub.d/30_os-prober ###

Paste it between following two sections:

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry “Ubuntu GNU/Linux, with Linux 2.6.31-14-generic” {
insmod ext2
set root=(hd0,6)
search –no-floppy –fs-uuid –set ff848303-508a-46d6-b275-0c263f7b8938

Close and save this file.
Note:If you run update-grub for some reasons,all things you do will back.You need to do again to set this default OS.
Mathod 2:
Count in /boot/grub/grub.cfg(start number 0),and in my case XP is 4.
grub2_default
So edit /etc/default/grub

sudo gedit /etc/default/grub

change Grub_default=0 into Grub_default=4

Note:This method won’t change grub menu order.However,when you upgrade kernel,the previous number will change and you need to set this again.
Method 3:edit /etc/grub.d/30_os-prober
/etc/grub.d/30_os-prober could be found in following section in /boot/grub/grub.cfg

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Microsoft Windows XP Professional (on /dev/sda1)" {
	insmod ntfs
	set root=(hd0,1)
	search --no-floppy --fs-uuid --set 48142b45142b34fa
	drivemap -s (hd0) ${root}
	chainloader +1
}
### END /etc/grub.d/30_os-prober ###

First,make a backup:

cd /etc/grub.d
sudo cp 30_os-prober 30_os-prober_backup

Then,change “30″ in filename to the number bewteen “5″ and “10″ (without 5 and 10).For instance:

sudo mv 30_os-prober 08_os-prober
sudo update-grub

Related posts:

  1. How to restore Grub 2 after reinstalling Windows XP/Vista/Win7
  2. Set Windows as Default OS in Grub
  3. Manually adding/removing entries to Grub 2 Menu
  4. Add Windows into grub menu after install Ubuntu
  5. Grub missed after reinstall Windows,or Grub error17 after delete Ubuntu partition

    Tags:

    Reader Comments

    In order to make it work with the third method, this command “sudo mv 30_os-prober 8_os-prober” should be
    “sudo mv 30_os-prober 08_os-prober”, the name of the new file should be 08_os-prober.

    [Reply]

    admin Reply:

    Oh,thanks Chris! I’ll has this update!

    [Reply]

    #1 
    Written By Chris on December 18th, 2009 @ 12:37 am

    but still, the most natural way to complete the task would be setting

    GRUB_DEFAULT=”xxxx”

    where “xxxx” is an exact menu entry. In this case, location in the menu will not matter.
    Example:

    GRUB_DEFAULT=”Windows 7 (loader) on /dev/sda1″

    see
    http://ubuntuforums.org/showthread.php?t=1195275
    for more

    [Reply]

    ragnar Reply:

    SET GRUB_DEFAULT=”Windows 7 (loader) on /dev/sda1″

    IN WHICH FILE !!!!!

    Why most natural ???

    Moreover, I found something called startupmanager to install with synaptic.

    Is this not compatible with 9.1 ?

    [Reply]

    #2 
    Written By v7 on January 19th, 2010 @ 8:05 am

    Trackbacks

    1. Set Windows as Default OS in Grub  on December 16th, 2009 @ 6:03 pm

    Add a Comment

    required, use real name
    required, will not be published
    optional, your blog address