How do I set the bootloader so that in my dualboot with Windows 7/Ubuntu 11.04, Windows start up as standard instead of Ubuntu?
16 Answers
Customizing the /etc/default/grub file
There are two ways of doing this using editing a grub file. These are described in the Ubuntu Community Documentation Grub2 page
The two ways are:
- Boot which ever operating system you booted last time, the "saved method"
- This is the one I use. It lets me decide which one I going to use and will allow me to reboot into that system, handy when I'm updating.
- Boot a specific operating system by default.
- The answer to your exact question.
Finding the menuentry to set as the new default
To start we need to find out what we are booting or want to boot. Open a terminal with Ctrl+Alt+t and type in
sudo grep menuentry /boot/grub/grub.cfg
user@YourComputer:~$ grep menuentry /boot/grub/grub.cfg
[sudo] password for user:
menuentry 'Ubuntu, with Linux 2.6.35-31-generic' --class ubuntu --class gnu-linux --class gnu --class os {
menuentry 'Ubuntu, with Linux 2.6.35-31-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
menuentry 'Ubuntu, with Linux 2.6.35-30-generic' --class ubuntu --class gnu-linux --class gnu --class os {
menuentry 'Ubuntu, with Linux 2.6.35-30-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
menuentry "Memory test (memtest86+)" {
menuentry "Memory test (memtest86+, serial console 115200)" {
menuentry "Windows NT/2000/XP (loader) (on /dev/sda1)" {
menuentry "Ubuntu, with Linux 2.6.32-34-generic (on /dev/sdb1)" {
menuentry "Ubuntu, with Linux 2.6.32-34-generic (recovery mode) (on /dev/sdb1)" {
menuentry "Ubuntu, with Linux 2.6.32-33-generic (on /dev/sdb1)" {
menuentry "Ubuntu, with Linux 2.6.32-33-generic (recovery mode) (on /dev/sdb1)" {
menuentry "Windows Vista (loader) (on /dev/sdc1)" {
You can see that the "saved" method can come in handy when booting multiple operating systems. Save the name of the entry you want e.g. Windows NT/2000/XP (loader) (on /dev/sda1), we need it later.
Editing the /etc/default/grub file
Type in the terminal
sudo nano -B /etc/default/grub
and your password if asked. The nano editor will open.
A. Saved method - In my preferred way, I made the following changes from the standard grub file.
I changed the value of
GRUB_DEFAULTtosaved:GRUB_DEFAULT=savedI enabled the SAVEDEFAULT functionality by adding the following line:
GRUB_SAVEDEFAULT=true
B. Specific menuentry - In the way you are asking for
Change the value of
GRUB_DEFAULTto the name of the Windows system you want to always boot. The name of the corresponding Grub menuentry can be found as described in the previous section.I wanted to have Window XP always set as default at boot, I would set
GRUB_DEFAULTto"Windows NT/2000/XP (loader) (on /dev/sda1)":GRUB_DEFAULT="Windows NT/2000/XP (loader) (on /dev/sda1)"
Note: Some versions of Ubuntu require single quote (') vice double quote (").
You could also set GRUB_DEFAULT to the line number in the menu entry list (with 0 being the first), but when the kernel in Ubuntu is updated grub adds the new kernel to the top of the list, you would have to change the number, since Windows is the last one in the menu entry list. You can see this in my menu entry list.
Update the boot configuration
Now you have to run
sudo update-grub
to update the system generated grub.cfg file in the /boot/grub/ directory.
user@YourComputer:~$ sudo update-grub
Generating grub.cfg ...
Found background: /usr/share/images/grub/Apollo_17_The_Last_Moon_Shot_Edit1.tga
Found linux image: /boot/vmlinuz-2.6.35-31-generic
Found initrd image: /boot/initrd.img-2.6.35-31-generic
Found linux image: /boot/vmlinuz-2.6.35-30-generic
Found initrd image: /boot/initrd.img-2.6.35-30-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Windows NT/2000/XP (loader) on /dev/sda1
Found Ubuntu 10.04.3 LTS (10.04) on /dev/sdb1
Found Windows Vista (loader) on /dev/sdc1
done
Addendum
Notes on nano
nano is especally easy to use in the terminal. Move around with the arrow keys. Type in you addtions, delete the unwanted.
The -B or --backup option backs up the previous version of it to the current filename suffixed with a ~. Very handy in case of the dreaded Fat pfinger effect.
When you are through, Ctrl+o will allow you to save your edits by hitting Enter and Ctrl+x will close. These and other options are shown at the bottom of the terminal screen with the ^ indicating Ctrl.
^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos
^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Text ^T To Spell
Notes about nano, sudoeditor and other editors
Some in the Ubuntu community suggest sudoedit instead of nano. I recommend nano — which is the default sudoedit editor in later distributions of Ubuntu — instead of sudoedit, because the default can be overridden in non-obvious ways, unless you are an administrator. sudoedit is safer in that it automatically saves a backup copy of the edited file, but the -B command line option in nano does the same thing. nano is more intuitive than editors like vi or emacs, which are very flexible but require learning a lot of commands, shortcuts or different modes.
If you prefer not to use the nano editor and prefer the Gnome Text Editor, instead of sudo nano -B use gksu gedit. I generally do this for large files, and /etc/default/grub could easily be considered a large file. Thus type in gksu gedit /etc/default/grub instead of sudo nano -B /etc/default/grub. Note that the Gnome text editor does not automatically make a backup!
Notes on my grub file
I made some changes to grub for my personal needs. Such as the background picture of the moon launch. How to do these are discussed at the Ubuntu Community Documentation page on Grub2, recommended.
Good luck!
- 44,031
- 6,795
With a bit of command line trickery, you can get the default of grub to always be a particular grub entry - for example Windows - no matter when a new kernel is installed.
In a terminal type:
fgrep menuentry /boot/grub/grub.cfg
This will display all your grub entries - for example

Highlight the entry you want to default to - for example Windows 7 in the screen-shot. Right click and choose copy
Type
gksu gedit /etc/default/grub
Change the entry
GRUB_DEFAULT=0
to
GRUB_DEFAULT="Windows 7 (loader) (on /dev/sda2)"
i.e. paste the entry you want (including the quotes)
Save, then type
sudo update-grub
- 174,526
You need to edit the /etc/default/grub file to set Windows as your default OS.
First Step. Determine the Windows OS' position in the grub menu. To do this, open a terminal by pressing Ctrl+Alt+T and type the following:
grep menuentry /boot/grub/grub.cfg
This will list the grub menu entries. I'll use my grub menu as an example:
menuentry 'Ubuntu, with Linux 2.6.38-8-generic' --class ubuntu --class gnu-linux --class gnu --class os {
menuentry 'Ubuntu, with Linux 2.6.38-8-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
menuentry "Memory test (memtest86+)" {
menuentry "Memory test (memtest86+, serial console 115200)" {
menuentry "Windows 7 (loader) (on /dev/sda1)" --class windows --class os {
You will then select the Windows partition, in my case "Windows 7 (loader) (on /dev/sda1)" including the double quotes and copy it.
Second Step. Open the /etc/default/grub file. To do this, type the following on the terminal:
gksudo gedit /etc/default/grub
It will open the /etc/default/grub file with gedit. Look for the GRUB_DEFAULT=0 line and change it's value from 0 to the selected Windows menu entry by pasting it. .
GRUB_DEFAULT="Windows 7 (loader) (on /dev/sda1)"
Alternatively, you can use an integer value specifying the index position of the Windows OS, take note that index starts counting at 0, so in my example, the Windows OS value would be 4, therefore you can also set
GRUB_DEFAULT=4
After which, you need to update grub by typing
sudo update-grub
You can follow this nitstorm answer here ,
You will have to add Grub-customizer through
sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo apt-get update
sudo apt-get install grub-customizer
Then launch it from dash , application lens.

the above menu will be different to yours, so choose wisely and select the Windows 7 entry and from the top Menu bar , select the ^ arrow to move it upward to have the top position , while booting.
For booting into Windows directly select the preference and reduce the boot-time to load windows.

It can be done easily with a GUI tool called "Grub Customizer".
What is Grub Customizer?
Grub Customizer is a graphical interface to configure the grub2. The application allows the user to add, remove, freeze, rename and reorder boot menu items
How to install?
Hit Alt+Ctrl+T to open terminal and run following commands one by one:
sudo add-apt-repository ppa:danielrichter2007/grub-customizer sudo apt-get update sudo apt-get install grub-customizer
How to use?
- Once installed, Hit Super key (Windows key) to open Unity dash and search for "" and open it.
- Select the Linux group by clicking on Linux and move it down by clicking on down arrow in toolbar. Once done, Click on save. That's it!

Remember that you can't move single entries out of their respective group like Ubuntu can't be moved out of Linux group.
- 24,156
Use startup manager, which you can start from the dash. There you can use the OS to start with in the dropdown menu.

- 2,384
Change the value of GRUB_DEFAULT in /etc/default/grub to whatever windows is on grubs list of available operating systems when you boot. For example in my case I would have to change that line from
GRUB_DEFAULT=0
to
GRUB_DEFAULT=5
After that, run sudo update-grub.
- 2,911
Identify the name of the Windows entry
On the GRUB, there should be an entry like Windows 7 (loader) (/dev/sda1). We need to know what's that name on your machine, so open a Terminal and run the following command:
$ fgrep menuentry /boot/grub/grub.cfg
The output should be something like this:
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
menuentry_id_option=""
export menuentry_id_option
menuentry 'Linux Mint 14 Cinnamon 64-bit, 3.5.0-17-generic (/dev/sda6)' --class linuxmint --class gnu-linux --class gnu --class os {
menuentry 'Linux Mint 14 Cinnamon 64-bit, 3.5.0-17-generic (/dev/sda6) -- recovery mode' --class linuxmint --class gnu-linux --class gnu --class os {
menuentry "Memory test (memtest86+)" {
menuentry "Memory test (memtest86+, serial console 115200)" {
menuentry 'Windows 8 (loader) (en /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-06B66EA8B66E97C7' {
menuentry 'Microsoft Windows XP Embedded (en /dev/sda4)' --class windows --class os $menuentry_id_option 'osprober-chain-7246B3A846B36C0B' {
Look at the line we were talking about! In my machine, it is Windows 8 (loader) (en /dev/sda1). Write the name of your entry somewhere, and now let's set is as the default.
Setting the Windows entry as the default
That's easy!
First, open our configuration file with gedit (a text editor) as root, running this command:
$ gksudo gedit /etc/default/grub
Search for this line:
GRUB_DEFAULT = 0
And modify the 0 with the name of your Windows entry. In my computer:
GRUB_DEFAULT = "Windows 8 (loader) (en /dev/sda1)"
Now just save the file, close gedit, and update grub.
Updating GRUB
Just run this command:
$ sudo update-grub
Now just restart, and the Windows entry should be highlighted as the default!
- 3
- 3
- 1,113
Is a very easy to use graphical GRUB2 settings manager. For now, it only allows you to edit the GRUB2 menu entries: reorder, rename or add/remove entries. It will also allow changes to background image and menu timeout. Since these are actually scripts which generate the boot.cfg file, Grub Customizer changes the actual script order and then generates a new boot.cfg so if you then run "sudo update-grub", your customization won't be overwritten.
- 1,945
edit the file /etc/grub/default
there you find the entry
GRUB_DEFAULT=0
when you first start your computer and get the grub menu the first entry in your boot menu is 0 so if the second entry in your boot menu is Windows change this digit to 1
save, quit, run the: update-grub command and reboot to behold your new changes!
- 15,370
You don't need to install the grub-customizer!!!
i do not know what ubuntu you have installed, so I am not sure that your OS is using grub2 or the old grub, but it is more likely that you have grub2.
So, this is what you have to do for grub2:
grep menuentry /boot/grub/grub.cfg
This command gives you an output saying what startup possibilities / OSes you have.
this is a sample output:
menuentry 'Ubuntu, with Linux 2.6.38-8-generic' --class ubuntu --class gnu-linux --class gnu --class os {
menuentry 'Ubuntu, with Linux 2.6.38-8-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
menuentry "Memory test (memtest86+)" {
menuentry "Memory test (memtest86+, serial console 115200)" {
menuentry "Windows 7 (loader) (on /dev/sda1)" --class windows --class os {
As you may can observe, Windows 7 is on the 5th line of the output.
Next, you open the /etc/default/grub file with your text editor and sudo priviledges and modify the GRUB_DEFAULT value to (the number of the line where you have Windows 7 minus one, because the grub option index starts from 0)
So, if windows 7 is on the 5th line, you need GRUB_DEFAULT=4
if windows 7 is on the 7th line, you need GRUB_DEFAULT=6
To save the changes, type sudo update-grub.
AND this is everything.
- 3,756
From my experience, I noticed that it's not so easy to change boot priority for Win7/Ubuntu 11.04. Utility, like Startup Manager seems like isctrying to change the default boot system, yet nothing happens after restart (11.04 continue to boot by default). I such case I suggest Grub Customiser Grub Customised on WebUpd8, which works well with Grub2. I just removed all absolete boot options (there are many), leaving only 11.04 and Win7. And then changed a boot priority. Now, everything works well :)
Good luck.
- 2,685
This is actually quite easy to do. First, you need to find out what Grub names your Windows entry. You can do that by looking in /boot/grub/grub.cfg or by running this command:
sudo cat /boot/grub/grub.cfg | grep -i Windows | sed -e 's/^.* "//g' -e 's/".*$//g'
What that command does is search for Windows in /boot/grub/grub.cfg and remove the text outside of the " characters.
The command will output something like Microsoft Windows XP Professional (on /dev/sdb2).
Now, open /etc/default/grub by running:
gksudo gedit /etc/default/grub
and change:
GRUB_DEFAULT=0
to
GRUB_DEFAULT="Name of your Windows menu entry"
Lastly, run:
sudo update-grub
to regenerate the Grub menu. And that's it! Future upgrades won't mess this up. Your Windows menu entry will always be selected by default.
- 4,438
I use grub customizer to do that. You can have it automatically boot into a certain OS every time or just boot into whichever OS was booted last. It is easy to install and use.
In ubuntu, open your package manager; under settings you should find "Configure Software Sources." Click on that and enter your password. Now click on the second tab entitled "Other Software" and press the add button toward the bottom. Enter in the PPA for grub customizer :
ppa:danielrichter2007/grub-customizer
Click OK and a couple of new lines will show up; close the Software Sources dialog now and push the check for updates button on your package manager if it didn't already start to update the available packages. Type into the search function : "grub-cus" and you will see the grub customizer at the top of the list. Mark it for installation then click apply to start the process. Agree to install any dependencies so they get installed automatically as well.
After installation, you can find grub-customizer by typing "grub" into the search dialog or you can also find it in the menu under Applications>Settings>Grub-Customizer.
Alternately you could just open a terminal and run the following commands:
sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo apt-get update
sudo apt-get install grub-customizer
You may want to pick out a pretty picture to use as background to your grub boot menu.
Here are some links if you want to learn more before starting:
- 177
Next time you boot your machine, count in shich position Windows 7 is placed in GRUB menu. (remember you have to count from 0 - i.e. if Windows is in the third row, then its position is 2 and so on). Boot into ubuntu, open a terminal and write
sudo gedit /etc/default/grub
then modify the line
GRUB_DEFAULT="0"
to
GRUB_DEFAULT="N"
where N is the position (starting from 0) of Windows7 entry in grub menu. Tell me if you need more info about this.
Normally when I have to "mess up" the Grub I use "Grub Customizer", it has a GUI so you can see easily what you are changing. Just type this into the terminal:
sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo apt-get update
sudo apt-get install grub-customizer
Then search in the Dash for grub customizer and change the predefined entry to Windows.