How do i set the bootloader so that in my dualboot with Win7/Ubuntu 11.04, Windows start up as standard insted of Ubuntu?

link|improve this question
feedback

8 Answers

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

enter image description here

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

source

link|improve this answer
Wow, I posted an identical answer to yours at the same time :) – Chen Xiao-Long Jul 13 '11 at 20:56
Is there a way to make this happen just once? So that when I boot into Windows, all I need to do is the reboot in order to be back in Linux? – Mild Fuzz Apr 2 at 16:46
feedback

Grub-Customizer:

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.

link|improve this answer
feedback

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.

link|improve this answer
I have used Startup Manager on my parents' desktop dual-booting Windows XP and Ubuntu 10.04 LTS, and aside from the fact that you have to re-run it every time you upgrade to a new kernel, it has worked nicely. – WarriorIng64 Jul 14 '11 at 18:54
Hi ! I suppose it's a matter of how Grub2 treat new kernel installs. It does not take in account new grub2 menu inserts :) – Vincenzo Jul 16 '11 at 8:28
feedback

This answer has already been accurately given by fossfreedom (http://askubuntu.com/users/14356/fossfreedom), and I answered essentially the same question elsewhere. I'm pretty sure it's not kosher, but I have an additional option that might be useful⋯so here goes.

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

  • Boot which ever operating system you booted last time, the "saved method"

    This is the on 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, your exact question

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

user@YourComputer:~$ grep menuentry /boot/grub/grub.cfg
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)" {

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

user@YourComputer:~$ sudo nano -B /etc/default/grub

and the nano editor will open, thus (for mine)...

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT=saved
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
#GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX_DEFAULT="delayacct"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480
GRUB_GFXMODE=1280x800
GRUB_GFXPAYLOAD_LINUX=1280x800x8

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_LINUX_RECOVERY="true"

# Uncomment to get a beep at grub start
GRUB_INIT_TUNE="480 440 1"

GRUB_SAVEDEFAULT=true
GRUB_BACKGROUND=/usr/share/images/grub/Apollo_17_The_Last_Moon_Shot_Edit1.tga

In my preferred way, I made these changes from the standard grub file:

  • I changed the value of GRUB_DEFAULT to "saved"

GRUB_DEFAULT=saved

  • and I added this line…

GRUB_SAVEDEFAULT=true

In the way you are asking far to this (e.g. fossfreedom )

  • Change the value of GRUB_DEFAULT to the name of the Windows system you want to always boot. This will be found in the previous grep … output prior. For my system if I wanted to only allways boot my Window XP, I set GRUB_DEFAULT to "Windows NT/2000/XP (loader) (on /dev/sda1)", everything between the "'s.

GRUB_DEFAULT="Windows NT/2000/XP (loader) (on /dev/sda1)"

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…

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

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

^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 safer than other editors like vi or emacs because it doesn't have scary shell escapes.

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!

link|improve this answer
Thorough, accurate, and best practice. Thanks! – J.Money May 18 at 2:35
Just wanted to add, this actually fixed an unrelated issue I was having. A bonus. Thanks again! – J.Money May 18 at 2:39
feedback

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!

enter image description here

Remember that you can't move single entries out of their respective group like Ubuntu can't be moved out of Linux group.

link|improve this answer
Nice, didn't know there was a GUI for GRUB2 configuration. +1 on this one ;) – ruffEdgz May 17 at 13:43
feedback

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.

link|improve this answer
So if my windows is placed in position 2 then i will write "2" in the command where you wrote "N"? – Rasmus Peter Mathiesen Jul 13 '11 at 17:42
if it's in the second row, then you have to put 1 (the first row is numbered 0) – Juan Sebastian Totero Jul 13 '11 at 17:47
thus the formula for "N" is: <line its on in human numbering> - 1 – Thomas Ward Jul 13 '11 at 17:53
Right right, that´s what i ment ;) – Rasmus Peter Mathiesen Jul 13 '11 at 17:54
This will break each time ubuntu installs a new version of the kernel – David Oneill Jul 13 '11 at 21:54
show 1 more comment
feedback

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.

link|improve this answer
feedback

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!

link|improve this answer
@ Daniel Guzman You seem new to Linux/Ubuntu.(judging from your choice of keeping windows the default OS.I am sorry if i am wrong) So when you carry out the above procedure,be careful and take care that you do not mess up with anything other than what is written.You might get into trouble. :) – Nirmik May 16 at 20:12
I could be wrong but didn't 11.10 use grub2 and isn't the /etc/grub/default more of an older grub1 change? Just wondering. – ruffEdgz May 16 at 21:29
11.10 uses grub2, my examples are from 12.04. But it's the same – tomodachi May 20 at 13:22
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.