Andrew Maddison

Flowerchild.

Configuring Windows as Default in GRUB 2 in Ubuntu

I had a little trouble getting GRUB 2 configured in recent versions of Ubuntu linux (10.4 or 11.* at least). We needed some work machines to default to windows.

You can do it two ways, first is setting the boot order number - effectively the number of the OS you want in the menu Grub presents when you power up your machine. The problem is, when you update your kernal, you get new entries in the menu, so the number changes. Boo!

Alternatively, you can do it by OS name, you just have to find the precise string necessary. Command line chants follow.

First, find the exact name of the OS you want to be default (in my case Windows)
grep Windows /boot/grub/grub.cfg

Then edit grub’s default boot:
sudo gedit /etc/default/grub

Find the following line:
GRUB_DEFAULT=0

And replace “0” with the exact line (including quotes) which was output from grep. Mine looked something like this:
GRUB_DEFAULT="Windows 7 (loader) (on /dev/sda2)"

Finally, update grub to seal in the magic.
sudo update-grub

And that should be that.

Comments