A few days ago I was telling you about rebooting in Windows from Linux with GRUB 2 (or any other OS for that matter) by running a command which simply selects (highlights) a different entry in the GRUB menu for your next restart only.
Here is how to permanently change the selected boot entry in GRUB2 (so when the GRUB menu is displayed, the first menu entry won't be selected anymore and instead, you'll be able to make GRUB automatically select a different entry, be it Windows, a Linux distribution or whatever).
This could be used for automatically selecting a custom Linux Kernel, Linux distribution or some other OS in GRUB, without having to modify the actualy GRUB menu order (which has become a bit more complicated with GRUB 2).
Set a new default boot entry for GRUB
A) GUI way - using StartUp Manager
Install Startup Manager. In Ubuntu, simply run:
sudo apt-get install startupmanager
Then go to System > Administration > StartUp-Manager and select whatever menuentry you want to set as default (you can also use this to change the GRUB menu timeout and other settings)
B) Command-line way
1. Firstly, follow steps 1 and 2 from THIS post.
2. Now, to set a new GRUB menuentry to be selected each time your computer boots, run the following command:
sudo grub-set-default X
where X is the menuentry position (starting with 0 as the first entry) of the OS / Kernel you want GRUB to select ("highlight" - so the GRUB menu will still be displayed - unless you set a 0 timeout - and you will still be able to select other operating systems in the GRUB menu) when your computer boots. You can also use the exact menu entry text instead of the menuentry position (like "Windows 7 (on /dev/sda1)").
To see the exact GRUB menu entries without having to reboot, see the /boot/grub/grub.cfg file - you can open it with Gedit and look for the exact menu entries:
gedit /boot/grub/grub.cfg
Do not edit this file - only use it to see your exact GRUB menu entries! It is automatically generated and will be overwritten each time the "update-grub" command is used.
If you want to go back to the initial settings, simply run the above command replacing "X" with "0" (without the quotes) - that will make the first GRUB menu entry as default.
If you want to go back to the initial settings, simply run the above command replacing "X" with "0" (without the quotes) - that will make the first GRUB menu entry as default.
Thanks to Sheldor42 for the Startup Manager tip!