02 December, 2009

Ubuntu and making Windows default boot

I recently installed Ubuntu on my Dell Studio 17, dualbooting Windows 7 and I wanted to make windows 7 the default boot. I did this by changing the "default=0" setting in "/etc/default/grub" to "default=4", then running "update-grub". This basically tells GRUB to use menu-entry number 5 (0, 1, 2, 3, 4) as the default boot option. Since Ubuntu by default have 2 Linux kernels (regular and recovery) as well as 2 Memtest, this would select Windows 7.

A little while later I upgraded several applications in Ubuntu as well as the kernel. Updating the kernel added 2 extra menu-entries to GRUB, which t hen meant that menu-entry 5 ("default=4") would be one of the 2 Memtest entries. This would mean I actually had to update GRUB manually every time I upgraded kernels? Nah, I didn't want that. The way I did this was rather simple.

First I ensured that the "default" setting in "/etc/grub/default" were set to "0" ("default=0") which is first menu-entry. Second I renamed "/etc/grub.d/30_os-loader" to "/etc/grub.d/09_os-loader". If you notice there are several numbered files in "/etc/grub.d". These determines the order of selection (or rather order of compilation) when running the "update-grub" command. By putting the "os-loader" entry below the "linux" entry it puts Windows 7 before the Linux entries in the GRUB menu.

No comments:

Post a Comment