Friday, October 2, 2009

Boot Directly into Windows Using GRUB

I'm using the Ubuntu linux distribution for my project and I also run Windows Vista for other work that I do.  As a result, I'm dual booting my computer.  Most of the time I work in Windows so I want to be able to boot into Windows as the default setting.  When Ubuntu gets installed, the bootloader GRUB uses Ubuntu as the default operating system.  I changed this and here is how.

Boot into Ubuntu and open up a terminal window.

Start off by creating a backup of the file that we're going to change just in case things get messed up.  Type the command

sudo cp /boot/grub/menu.lst /boot/grub/menu.lst.bck

Next, type in the command
sudo gedit /boot/grub/menu.lst
This will open up a gedit window where you can modify the file.  The part we need to get to is at the bottom of this file.  All the way down at the bottom you should see a block of text that looks something like this

# This is a divider, added to separate the menu items below from the Debian
# ones.
title        Other operating systems:
root


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sdb1
title        Windows Vista (loader)
rootnoverify    (hd1,0)
savedefault
map        (hd0) (hd1)
map        (hd1) (hd0)
chainloader    +1
 The information may be different inside but the key part is that you're grabbing the Windows loader.  We want to move this block above the Ubuntu loader because what happens is when Ubuntu is updated a new entry is added to the list of Ubuntu loaders.  So move this block to just before the following

### BEGIN AUTOMAGIC KERNELS LIST
At this point you can either keep the block of text that has "Other Operating Systems", or delete it.  Just keep this:

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sdb1
title        Windows Vista (loader)
rootnoverify    (hd1,0)
savedefault
map        (hd0) (hd1)
map        (hd1) (hd0)
chainloader    +1

If you elect to keep the divider you will need to change the default number in the text
## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not use 'savedefault' or your
# array will desync and will not let you boot your system.
default        0
Change the last line from a 0 to 1 if you kept the divider.

Be sure to save the new file and now your computer will default boot into Windows.

No comments:

Post a Comment