View Full Version : [ubuntu] 10.04, is there a way to re-arrange the Grub?

May 9th, 2010, 04:35 PM
Hello All,
I currently have Windows 7 with 9.10 installed but will be updating my ubuntu as soon as I get off work today.
I'm wondering though, as Win7 is my main system that I operate under, is there a way to change the order of the op systems in the grub? If so, how? I'm a complete noob on linux so all help is appreciated.

May 9th, 2010, 05:27 PM
As usual there are few ways to do it. I guess you want Win7 to be default, you could do that even without rearranging the positions. But any new kernel update would still "push" Win7 downwards.

The main Grub2 config files are in /etc/grub.d folder and the main are 10_linux (for ubuntu), 20_memtest86+ and 30_os-prober (for detecting other OSs). The number in front gives the order, so the grub menu by default looks like Ubuntu-Memtest-Win.

My preferred way:
Open terminal (Applications-Accessories)

Create new os-prober file with number between 06 and 09, with:
sudo cp /etc/grub.d/30_os-prober /etc/grub.d/06_os-prober

Remove the execute bit from the initial file:
sudo chmod -x /etc/grub.d/30_os-prober

If you want to remove memtest from the menu (if not skip):
sudo chmod -x /etc/grub.d/20_memtest86+

To update the grub.cfg:
sudo update-grub

You should now have:

Any kernel updates will add them after Win7 entry.

You control the default OS choice in /etc/default/grub (you can open it with sudo gedit), in GRUB_DEFAULT=n. If n is 0, it means the first in the menu, 1, the second, etc.
Instead of a number you can also use the full name like "Windows 7 loader...." and in that case it doesn't matter in which order they are in the menu.

With what I wrote above if you keep the default GRUB_DEFAULT=0 Win7 should be on top of grub menu and default OS.

May 9th, 2010, 07:13 PM
There is another way, which does not really change the order, but makes whatever you booted last the default. gksu gedit /etc/default/grub (or you can use sudo nano)


Then sudo update-grub

Then any time you make a selection from the grub menu, that selection is the default the next time you boot. So if you boot Windows, that will be the default for next boot or reboot. If you are in Linux, a reboot would reboot Linux.

May 10th, 2010, 03:08 AM
Thanks guys (or gals), worked like a charm!