Changing The Default OS to Boot in Grub (Ubuntu, etc.)

Dual booting Ubuntu with some version of Windows is highly desirable for many of us. It allows you have the ability to revert to the legacy Windows operating system when you want to run a video game or some other application that hasn’t been implemented on Linux yet. Some of us with domestic partners, or pets/children, have the need to make the default O/S that boots Windows. For example, my pet gerbil designs websites for a living, but has has trouble with Ubuntu.

With the release of Natty (Ubuntu 11.4) startupmanager no longer works to select the O/S to boot. While there are alternative applications, it would be nice to have a simple way to configure this. After spending some time researching the matter, I have found the answer (for those using Natty Ubuntu, or an installation of Linux with Grub2 1.99 or possibly later):

sudo grub-set-default 4

The number 4 is the position in the list of actions Grub displays during boot. The first entry, usually the most recent Linux kernel you’ve installed, is entry0. On my machine, Windoze XP was the 4th (again, starting from 0).

Note that if a new kernel is installed, or if for any reason other entries are added to the Grub list, then your change will be broken, and you’ll need to enter the new position of the desired entry. But now you know a one-liner that will fix it.

If grub-set-default doesn’t work on your machine, then it probably won’t work on your machine: know what I’m sayin’ ?