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?
There are two ways of doing this using editing a grub file.
These are described in the Ubuntu Communuity Documentation Grub2 page
The two ways are
To start we need to find out what we are booting, open a terminal (dash, type terminal, … ) and type in grep menuentry /boot/grub/grub.cfg
From mine you can see why I prefer the "saved" method.
Now you are ready to edit the grub file…
Type in the terminal sudo nano -B /etc/default/grub and your password if asked
and the nano editor will open, thus (for mine)...
In my preferred way, I made these changes from the standard grub file:
In the way you are asking far to this
You could 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.
Important last step
Now you have to run update-grub to update the system generated grub.cfg file in the /boot/grub directory.
Type into your computer sudo update-grub and your password if asked…
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 though, Crtl-O will allow you to save your edits by hitting Enter. Closing nano without saving, Ctrl-X These and other options are shown at the bottom of the terminal screen with the ^ indicating Ctrl
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 "
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
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.
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:
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
Change the entry
i.e. paste the entry you want (including the quotes)
Save, then type
You need to edit the
First Step. Determine the Windows OS' position in the grub menu. To do this, open a terminal by pressing
This will list the grub menu entries. I'll use my grub menu as an example:
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
It will open the /etc/default/grub file with gedit. Look for the
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
After which, you need to update grub by typing
Use startup manager, which you can start from the dash. There you can use the OS to start with in the dropdown menu.
Change the value of
After that, run
You can follow this nitstorm answer here ,
You will have to add Grub-customizer through
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
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?
Remember that you can't move single entries out of their respective group like Ubuntu can't be moved out of Linux group.
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.
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 :)
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
What that command does is search for
The command will output something like
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.
edit the file /etc/grub/default
there you find the entry
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!
Identify the name of the Windows entry
On the GRUB, there should be an entry like
The output should be something like this:
Look at the line we were talking about! In my machine, it is
Setting the Windows entry as the default
First, open our configuration file with gedit (a text editor) as root, running this command:
Search for this line:
And modify the
Now just save the file, close gedit, and update grub.
Just run this command:
Now just restart, and the Windows entry should be highlighted as the default!
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
then modify the line
where N is the position (starting from 0) of Windows7 entry in grub menu. Tell me if you need more info about this.
|show 1 more comment|
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 :
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
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:
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:
This command gives you an output saying what startup possibilities / OSes you have.
this is a sample output:
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
if windows 7 is on the 7th line, you need
To save the changes, type
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:
Then search in the Dash for grub customizer and change the predefined entry to Windows.
protected by Community♦ Sep 22 at 22:17
This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.