how to set grub2 default boot choice to windows 7

Asked by John Coumbe on 2012-05-08

I have been using a dual boot system for Ubuntu Ver 11.1 and Windows 7, I just upgraded to ver 12.04 and I have not been able to set the boot seq so that Windows 7 is the automatic choice. There used to be a way I could set it to boot to the OS I prefered but I have not been able to find it anyplace.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu grub2 Edit question
Assignee:
No assignee Edit question
Last query:
2012-05-08
Last reply:
2012-05-08
Wyatt Smith (wyatt-smith) said : #1

There are two approaches to doing this

You can edit /etc/default/grub as superuser and set this which grub entry is load by default by modifying the following line
GRUB_DEFAULT=0

You can change this the index number corresponding to position of the grub entry you would like to load by default. Note it counts the first entry as 0. After updating this file, from the command line, run
update-grub

After kernel updates, the position of the windows entry will change and will need to redo your edits.

For a more robust solution, leave /etc/default/grub alone and modify the naming of the shell scripts located in /etc/grub.d
Grub2 relies on the alphabetical sequence of these shell scripts to generate the grub.cfg file. If you rename the 30_os-prober file to say 09_os-prober it will alphabetically be executed before the 10_linux and 20_linux_xen. After you rename run update-grub. This will always make windows appear first in your grub list.

Hope this helps

use the robust solution above but remember to run:

sudo update-grub

to apply the change

Can you help with this problem?

Provide an answer of your own, or ask John Coumbe for more information if necessary.

To post a message you must log in.