3 Ways Setting XP/Vista/Windows 7 as default bootup OS In Grub 2
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.

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:
- How to restore Grub 2 after reinstalling Windows XP/Vista/Win7
- Set Windows as Default OS in Grub
- Manually adding/removing entries to Grub 2 Menu
- How to install Windows 7 from Ubuntu without burnning a disc
- Add Windows into grub menu after install Ubuntu

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:
December 18th, 2009 at 3:21 am
Oh,thanks Chris! I’ll has this update!
[Reply]
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:
January 24th, 2010 at 6:14 am
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]
Best way is this !!
Login as “root” or get access to root-group to edit files…
Alternative
if you don’t get added yourself as root user
- Use Terminal (Applications/Accessories/Terminal)
and type this parameter to get access edit file:
sudo chmod 755 /etc/default/grub
1)- Open this file in gedit-text editor (we start edit this file !!):
sudo gedit /etc/default/grub
2)- Open the other file where we can look our boot-os-names (we not edit this file !!):
sudo gedit /boot/grub/grub.cfg
3)- Read /boot/grub/grub.cfg bottom of list and look those:
menuentry ” ”
- You find windwos os boot name like windows 7:
menuentry “Windows 7 (loader) (on /dev/sda1)”
- Copy text with “quotes”:
“Windows 7 (loader) (on /dev/sda1)”
4)- Now go edit file /etc/default/grub line 4:
change GRUB_DEFAULT=0 to GRUB_DEFAULT=”Windows 7 (loader) (on /dev/sda1)”
- Save file
5)- Finally update this grub using Terminal:
sudo update-grub
Reboot and enjoy <3
[Reply]
HI all
I do that and it is working but now I can’t access the GRUB menu because I made the default time is zero.
I try to access it by pressing shift and it is not work
I need help to to access menu grub so I can select ubuntu
thx alot
[Reply]