Changing GRUB boot order to boot Windows XP before Ubuntu
April 29, 2007
One goal of installing Ubuntu is to help ease my wife and kids onto it – not to create a huge problem with the family. After the Ubuntu install the default boot ed OS was Ubuntu – not Windows. That’s going to be a problem.
So I went on a mission to figure out how to change the boot order to load XP by default.
I knew that Ubuntu was using the GRUB boot loader. I wasn’t familiar with GRUB so I don’t know why I knew this – it must have been stated during the install sometime. But anyway – I knew it was GRUB.
I Googled for “change GRUB boot order” and the first hit was exactly what I needed. I needed to edit /boot/grub/menu.lst.
I copied the file into my home dir and used chmod (it’s been so long since I’ve used a *nix CLI that I had to lookup chmod – I knew it was “ch” something) so I could write to it then opened it in xemacs.
I simply copied the XP settings ahead of the Ubuntu settings in the item list and left everything else the same.
The relevant parts of the original menu.lst were:
—————————- /boot/grub/menu.lst —————————————-
## ## End Default Options ##
title Ubuntu, kernel 2.6.20-15-generic
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=12de9aee-c011-429e-b2a9-0ed83b3eb727 ro quiet splash
title Ubuntu, kernel 2.6.20-15-generic (recovery mode)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=12de9aee-c011-429e-b2a9-0ed83b3eb727 ro single
title Ubuntu, memtest86+
### END DEBIAN AUTOMAGIC KERNELS LIST
# This is a divider, added to separate the menu items below from the Debian ones.
title Other operating systems:
# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title Microsoft Windows XP Home Edition
I referred to the online GRUB manual (http://www.gnu.org/software/grub) and confirmed that the “0” in default was the list item to boot by default (zero-indexed) and that if it were changed to “saved” the previously loaded item with a “savedefault” entry would be used. I didn’t want that. I want it to boot to XP by default regardless of what I used most recently.
I had two choices – change the default value to 4 (the menu divider is an option as well) or leave it at 0 and reorder the items.
I decided to reorder the items for one reason – I want the top menu item to be the default because that is how my family will expect it to work.
There are some notes about an automatically generated section that could be over-written so I did back up the file before making the change and I decided it was worth the hassle of losing the customizations I made (and possibly the Window’s item) to make it work the way we need for now. I don’t plan to change it often.
So I simply moved the XP section to the top, moved the divider below it, saved the local copy and copied it over the original.
Rebooting brought up XP after a 10 second delay – just as I had hoped.
Note – I reverted the changes and used a simplier approach that kernel updates won’t overwrite.