26

I have a Win 7/11.10 dual boot system with Grub 2 as the default bootloader. However, I want to make Windows bootloader the default bootloader (grub 'dos' like interface scrares the hell out of my sister) so when I start the PC I will have the following boot options: 1. Windows 7 2. Ubuntu

NB: A process to reverse this operation so Grub can be the default bootloader again will also be appreciated

8
  • 6
    Don't miss Burg: goo.gl/w0msb Your sister may like it :-)
    – Ivan
    Oct 14, 2011 at 9:30
  • I don't know if the MBR can be moded to show Linux, but, if you want an attractive, not DOS-like console replacement for Grub, you can try burg. Also Burg Screenshots of various themes Oct 14, 2011 at 9:31
  • As for me, I have a very related question: how to make Windows a default option in a standard Grub menu.
    – Ivan
    Oct 14, 2011 at 9:32
  • 1
    @mikewhatever: Last time I checked Startup Manager it was only working for GRUB and not recommended for use with GRUB2. I'm not sure if that's still the case though. Mysterio, you can use GRUB themes to make it less look like an ancient stone.
    – Lekensteyn
    Oct 14, 2011 at 9:39
  • 1
    possible duplicate of Is it possible to boot Ubuntu using the Windows bootloader?
    – fossfreedom
    Nov 16, 2011 at 20:55

8 Answers 8

17

Edit that file, from terminal run

 sudo gedit /etc/default/grub 

(file has comments to help you). Find that line and set Windows number (number of Windows line in Grub, starting from 0). In my case that will be

GRUB_DEFAULT=2

Then save file and close gedit. Run that command to update grub:

sudo update-grub 
4
  • Please could you be specific. I am a newbie
    – Mysterio
    Oct 14, 2011 at 10:40
  • 1
    Ok, when I will be at home with my ubuntu box
    – Extender
    Oct 14, 2011 at 10:43
  • 1
    Thanks for your answer i will like to know if i use your answer i will only get two options during the boot screen 1. Windows 7 2. Ubuntu. This way i only get to see Grub2 if i choose the Ubuntu option
    – Mysterio
    Oct 14, 2011 at 16:00
  • 6
    This makes GRUB2 treat boot Windows as the default operating system. That is not what Mysterio was asking. Mysterio was asking how to make the Windows boot loader load first, before GRUB2, so that GRUB2 loads for the first time when the Ubuntu option is selected in the Windows boot loader. Nov 16, 2011 at 20:46
8

There is a programm for windows called easy bcd. Install it when running windows and the proceed a described in the following link:

how to use easy bcd

Nevertheless I think also the other answers are valid as the question was basically how to avoid that the sister is scared by grub to choose windows if necessary.

4
  • 1
    Why do we want a Windows-based "download an app." type solution, when this can be easily resolved from within Ubuntu?
    – david6
    Dec 1, 2011 at 19:33
  • 2
    First of all we are here to answer questions and not to question the questions.
    – dago
    Dec 1, 2011 at 20:09
  • I tried installing EasyBCD to use with a broken grub2, but it requires Vista/Win7 to install. Dec 1, 2011 at 20:29
  • Googlers: First of all: Anno 2019 BcdEdit is Windows10 and (U)EFI ready. And if command line is good enough for you, look at bcdedit
    – Frank N
    Aug 27, 2019 at 6:50
5

PART 1:

Make Windows (ANY variant) the default Grub2 menu option.

Description: This sets Windows as the default boot option, and (with NO user action) the PC will auto-launch Windows on startup.

STEPS:

A. List your current menu items

sudo update-grub 

B. Edit setup file

sudo gedit /etc/default/grub 

Set the boot default to your Windows boot partition (eg.)

GRUB_DEFAULT=”Windows 7 (loader) on /dev/sda1″

WARNING: Just setting 'GRUB_DEFAULT=n', will NOT work after kernel updates, etc.

(Save the file and close.)

C. Update grub settings

sudo update-grub 

Now, on boot, you will AUTOMATICALLY default to MS Windows.

PART 2: (Optional Extra)

Hide the Grub2 menu, and use the default menu option.

Description: This both hides the startup menu, and shortens the (usually 10 second) timeout. The PC will auto-launch whatever the default option is on startup.

NOTE: The user just needs to hold down the Shift key (on startup), to again see the Grub2 menu.

STEPS:

D. Edit setup file

sudo gedit /etc/default/grub 

Uncomment the line '#GRUB_HIDDEN_TIMEOUT=0', to look like:

GRUB_HIDDEN_TIMEOUT=0

(Save the file and close.)

E. Update grub settings

sudo update-grub 

Now, on boot, you will AUTOMATICALLY boot to the default menu option, UNLESS you hold down the Shift-key at boot time. Then the grub2 menu will re-appear.

FURTHER DOCUMENTATION:

http://ubuntuforums.org/showthread.php?t=1195275

6
  • 2
    Like the other two answers so far, this tells how to make Windows the default system in GRUB2. But what Mysterio was asking for was how to make the Windows boot loader come up first, so that GRUB2 does not even run unless the user selects Ubuntu in the Windows boot loader. Nov 16, 2011 at 20:49
  • This does make Windows boot loader come up first, and hides the Ubuntu Grub2 menu. My solution avoids using a Windows-based solution (if that is what you are suggesting).
    – david6
    Nov 20, 2011 at 22:25
  • In this solution, GRUB2 still loads first. It doesn't display a menu, but it still loads and then hands off control to the Windows boot loader. This solution prevents Ubuntu from being loaded at all, unless it is separately added to the Windows boot loader, which would then become a "Windows-based solution" differing from dago's solution only by the addition of considerable unnecessary complexity. Nov 21, 2011 at 1:20
  • 1
    No. Simply hold down [Shift] key, and Grub2 menu appears. quote: "Hold down SHIFT to display the hidden menu during boot (formerly ESC is GRUB legacy)." from link (above).
    – david6
    Nov 21, 2011 at 1:58
  • Good point; I don't know if that was in your answer when I commented, but if it was, then I apologize for not noticing! This is still not what Mysterio had asked for ("I want to make Windows bootloader the default bootloader .... so when I start the PC I will have the following boot options: 1. Windows 7 2. Ubuntu"), but it might meet his/her needs. Nov 21, 2011 at 3:18
2

Grub2 can be set to boot any system by default, but to change the order they appear in would be difficult.

It is also possible to hide the grub boot menu (for your sister) and only show it by pressing the shift key. I recommend caution here. Details here.

There are two ways setting the default boot 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…

  • Note: If you would rather use a GUI editor like Gnome Text editor, see the note at the end.

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

  • 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.

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!

2
  • 1
    you didnt read the question
    – Jayo
    Dec 1, 2011 at 19:19
  • 1
    Well Jayo, I did read the question, but if you'll check askubuntu.com/questions/82928/how-to-make-windows-boot-first/… you'll see "closed as exact duplicate by fossfreedom, Jorge Castro, Javier Rivera, Marco Ceppi" along with the suggestion that answers to that question be merged here ⋯ along with my comment that they were not exact duplicate questions. Check it out. Dec 2, 2011 at 21:52
2

If you would rather use the bios to set this, reboot your computer and enter the bios (by pressing DEL in my case).

Go to Boot Options --> (This step may vary) Hard Disk Drive priority --> 1st Priority -> Windows Boot Loader

The second step may vary depending on how you installed Ubuntu / Windows

The key is that if ubuntu is set to a higher priority (HDD priority or boot device priority), you should replace that with the Windows Boot Loader

2

Most reliable way is to use Windows' own tool that Microsoft ships on every Windows CD

  1. Boot from Windows CD
  2. From title screen, open terminal (the button is usually in bottom left corner)
  3. Execute bootrec /fixmbr

If that didn't work, try bootrec /fixboot instead

2

Why has nobody mentioned Clover EFI bootloader? I got 5 OSs to boot, always the choice that I want to boot Windows 10, macOS High Sierra, macOS Mojave, Linux, Ubuntu 19.04 and last but not least Phoenix OS aka Android OS distributed over one hard drive.

I can even trugh mine hackintosh, my Windows 10 existing HDD virtualizes all data including the OS in front of me without restarting macOS, so I would definitely recommend Clover to any of you.

1

The problem of using grub to dual boot Windows 10 and Ubuntu, is that Windows update would refuse to run. If you are OK with not being able to update Windows 10, then grub is the best bootloader.

If otherwise, Windows update is needed for your work (Windows Defender etc...), then BCDEdit is the way to go.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .