reorder GRUB to list Windows on top

I have win 7 and linux mint 14 installed. Is it possible to modify the GRUB Menu to show Windows as the first option instead of Linux, which it currently does. Mainly so that during boot it starts Windows by default.

Asked By: sunbabaphu


You can follow the steps given in Linux Mint itself. Linux Mint tutorials.

Answered By: beginer

If the order of your boot menu is important (and not just that Windows boots by default), and you don’t have anything bootable besides Linux Mint and Windows (like OSX, BSD) you can do:

cd /etc/grub.d
mv 30_os-prober 09_os-prober

as the alphabetical order of the files in /etc/grub.d, determines in what order they are processed. Then you run sudo update-grub¹ to generate the /boot/grub/grub.cfg file, which determines the menu ordering.

If you just want to have Windows boot you can also change /etc/default/grub and change the entry




and run sudo update-grub. 4 is the normal entry for Windows after 0 for Mint, 1 for the submenu with older versions of Mint, 2 for memcheck and 3 for memcheck via a serial interface. Your setup might be slightly different, but you can count (starting from 0) while in the grub menu, or just try and change if your guestimate is off.²

There is third alternative you might want to consider, and which I myself prefer. This is to to change your /etc/default/grub so that it will automatically boot the system you last selected, if you don’t select a different menu entry by hand. For that you change the line




and run sudo update-grub

¹ I tended to forget the name of the update-grub command often trying grub-TAB and hope the resulting expansions showed me the grub-something command I needed to run. That was until I realised that it says what to do at the top of /etc/default/grub file I was editing anyway. Of course once I found out how to look the command name up, I never forgot….
² As @derobert indicated, you can also use a string that matches the menu entry you want to select. This is the only documentation I have found about that feature.

Answered By: Anthon

It is pretty simple , first you have to locate the grub.cfg file, in Ubuntu it will be under /boot/grub/grub.cfg, make sure you take a back up of this file before editing.

Open the file with any text editor of your choice in sudo mode, eg sudo vi path/grug.cfg

In this file there will be menu entries , which represents each item in the boot menu. Find the menu entry corresponding to windows – note a menu entry is a set of lines.

Find a line called GRUB_DEFAULT. Now there are two ways of doing this.
1)change the value of GRUB_DEFAULT to corresponding position of windows menu item like 0 , 1 or what ever it is.
2)or cut paste the windows menu item to the corresponding position of the current value in grub_default.

CAUTION : Don’t corrupt this file, if something goes wrong , replace this file with the backup.

menuentry 'Ubuntu, with Linux 3.13.0-30-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.13.0-30-generic-recovery-3aaa1f6c-e78d-4b56-bb71-a250d1338ea6' {
                insmod gzio
                insmod part_msdos
                insmod ext2
                set root='hd0,msdos1'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  3aaa1f6c-e78d-4b56-bb71-a250d1338ea6
                  search --no-floppy --fs-uuid --set=root 3aaa1f6c-e78d-4b56-bb71-a250d1338ea6
                echo    'Loading Linux 3.13.0-30-generic ...'
                linux   /boot/vmlinuz-3.13.0-30-generic root=UUID=3aaa1f6c-e78d-4b56-bb71-a250d1338ea6 ro recovery nomodeset
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initrd.img-3.13.0-30-generic
Answered By: Abhilash

From the answer by Anthon, I’d replace the mv with dpkg-divert on Debian-like systems:

# dpkg-divert --add --rename --divert /etc/grub.d/09_os-prober /etc/grub.d/30_os-prober

Then run update-grub as usual.

If you wish to list the available diversions, then run:

# dpkg-divert --list | grep os-prober
Answered By: tonejito