Set Windows as the Permanent Default OS when Dual-Booting with Ubuntu

Ubuntu Linux is a great operating system, but one potential annoyance is how it automatically sets itself as the default OS when installed as a dual-boot with Windows. Fortunately, it’s easy to switch it back by editing GRUB (GRand Unified Boot Loader).

To modify GRUB, first boot into Ubuntu, then launch a Terminal (Applications → Accessories → Terminal). Type the following command:

sudo gedit /boot/grub/menu.lst

(Tip: if you don’t want to launch a full text editor, just substitute nano instead of gedit.)

Scan the file until you find this section:

## 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

The number that follows the word default at the bottom is the critical part. Conventional wisdom suggests that we just have to change the zero to a higher number (usually between 4 and 6). Sure, you can do it that way if you want. Just find the section in your GRUB file at begins with: ### END DEBIAN AUTOMAGIC KERNEL LIST.

Starting with 0, count the entry blocks below that marker to find what the appropriate number is for Windows.

Be warned: the above method is only temporary. The next time a new kernel is passed down through the Update system, GRUB will likely add a new entry for it, breaking your default OS. You may find your computer furiously trying to boot the GRUB divider!

The Permanent Method

To fix that annoying little problem permanently, just type saved instead of a number, so that your GRUB file looks like this (emphasis is mine):

## 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 saved

The saved option works because Ubuntu so kindly already specifies Windows as the default when this option is invoked. Don’t believe me? Take a look at the very bottom of your GRUB file (emphasis is mine):

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title Microsoft Windows XP Professional
root (hd0,0)
savedefault
chainloader +1

Save your GRUB file and reboot. Don’t be alarmed if your computer does not immediately default to Windows. I found that I had to manually switch it to Windows once, but then GRUB remembered my choice after that.

3 thoughts on “Set Windows as the Permanent Default OS when Dual-Booting with Ubuntu

  1. Thanks for the helpful description – it just has a little mistake.

    You write: “The saved option works because Ubuntu so kindly already specifies Windows as the default”.

    No, that’s not the point. It does exactly what it does in the comment/documentation you also posted: “You can specify ’saved’ instead of a number. In this case, the default entry
    # is the entry saved with the command ’savedefault’”.

    THAT’s what it does. It REMEMBERS the last option you chose (provided it is marked with “savedefault”) and uses the same one.
    That means you can add “savedefault” to one or more of your “Ubuntu options” as well and every time you boot, it takes the same one as last time. This is VERY useful in my opinion.

    It’s also the explanation for your last sentence: “Don’t be alarmed if your computer does not immediately default to Windows. I found that I had to manually switch it to Windows once, but then GRUB remembered my choice after that.”

    Exactly :-) The first time you do it, the (new) default option is saved/remembered. As long as no other option is marked with “savedefault”, it’ll stay that way forever…

    Other than that, great and helpful description :-)

  2. Thanks for this, I was about to get crazy after every kernel update. And thanks for Finch’s revision. I just mark windows as default, as the pc is used by many people here, and they may ask “what is this thing called tubuntu that shows up on screen and doesn’t let me use windows”

  3. I’m new to unbuntu linux and i have a question. How do I “scan” for that selection? Also, when I open the menu.lst file there is nothing in there. Help?

Comments are closed.