Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

So when I turn my computer on, Grub rescue boots up. I have finally figured out how to get into Windows, but now I want to skip the step of entering the information into Grub to get into windows. How do I make Windows boot before Grub does?

share|improve this question
    
I'm not sure what you want to do. If Windows boots "before Grub", Grub will never boot (as Grub is a boot loader, i.e., it allows you to choose what you want to boot). Or maybe you want to boot Windows' boot loader? It seems someone asked it before at askubuntu: askubuntu.com/questions/66070/…. –  bruno nery Aug 1 '12 at 22:41
    
I saw his post and didn't understand any of the answers. I'm resorting to restore my computer to factory settings now, hoping it will delete grub and everything else so i can start fresh. –  C.s. Aug 1 '12 at 22:54
    
If you wanted to delete GRUB, you should have said so. It's a bit different from simply changing the order, which is, above anything else, probably impossible (the PC BIOS looks for something in the disk MBR, then the first (bootable?) partition). GRUB usually goes on the MBR, the Windows' bootloader usually goes on the windows partition. So if you just wanted to uninstall GRUB, that would actually be a lot easier than just "booting Windows first", which makes other people think you want to keep GRUB around. A pretty detailed example of how to delete it: askubuntu.com/a/168517/44104 –  njsg Jan 9 '13 at 9:58
    
And I get the feeling that restoring the entire computer to factory settings is a bit of a too bold overreaction for a simple problem like this... –  njsg Jan 9 '13 at 10:00

1 Answer 1

You probably don't want to skip grub and boot direct to Windows - that will prevent you from booting into linux. Instead, you want to make Windows the default boot entry.

The following works on debian (and derivatives like ubuntu). The procedure is conceptually similar but differs significantly in the details on RH/Centos and other distros.

  • apt-get install os-prober (a package which adds support to grub for detecting other operating systems and adding them to the grub menu)

  • edit /etc/default/grub so that it has:

    GRUB_DEFAULT=saved  
    GRUB_SAVEDEFAULT=true  

Optionally set GRUB_TIMEOUT=5 or =10 to give you enough time to choose a menu entry.

Delete or comment out all lines mentioning HIDDEN, such as GRUB_HIDDEN_TIMEOUT - Ubuntu likes to hide the grub menu for some reason.

This will configure grub so that whatever you select from the menu becomes the default until you select something else.

  • run update-grub

  • next time you boot, choose Windows. It will now be the default option.

You can also use grub-set-default as root from the linux command line to manually select which grub menu entry will be the default. e.g. if Windows is the 5th menu entry in the list, then grub-set-default 5 will make it the default.

You can list grub menu entries with a simple grep like:

egrep 'submenu|menuentry' /boot/grub/grub.cfg | cat -n

or something a bit fancier like:

sed -r -n -e '/submenu|menuentry/{s/(["'\'']) .*/\1/;p}'

Be warned: numbering becomes complicated if there are any grub sub-menus. A simple grep | cat -n won't get the numbering right, you'd have to write a script to parse the grub.cfg file. it's easier in this case to use grub-set-default with the full name of the menu entry instead of a number.

e.g. given the following,

# sed -r -n -e '/submenu|menuentry/{s/(["'\'']) .*/\1/;p}' /boot/grub/grub.cfg | cat -n
     1  menuentry 'Ubuntu, with Linux 3.2.0-27-virtual'
     2  menuentry 'Ubuntu, with Linux 3.2.0-27-virtual (recovery mode)'
     3  submenu "Previous Linux versions"
     4  menuentry 'Ubuntu, with Linux 3.2.0-24-virtual'
     5  menuentry 'Ubuntu, with Linux 3.2.0-24-virtual (recovery mode)'
     6  menuentry "Memory test (memtest86+)"
     7  menuentry "Memory test (memtest86+, serial console 115200)"

grub-set-default 4 won't work because the numbering is distorted by the fact it is in a submenu. Use grub-set-default 'Ubuntu, with Linux 3.2.0-24-virtual' instead.

There is also a grub-reboot command which sets the entry-to-boot for the next reboot only - after that, it reverts to the previous default. This is useful for, e.g., testing a new kernel.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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