reorder GRUB to list Windows on top

16,986

Solution 1

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

GRUB_DEFAULT=0

to

GRUB_DEFAULT=4

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

GRUB_DEFAULT=0

into

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

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.

Solution 2

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
Share:
16,986

Related videos on Youtube

sunbabaphu
Author by

sunbabaphu

Updated on September 18, 2022

Comments

  • sunbabaphu
    sunbabaphu over 1 year

    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.

    • beginer
      beginer almost 10 years
      Gosh...linux 14?? When did it get released, moreover when was linux-13 released? moreover.... :D I guess you mean Ubuntu 14.
    • sunbabaphu
      sunbabaphu almost 10 years
      linuxmint.com/rel_nadia_whatsnew.php Linux 14 => Linux mint 14
    • beginer
      beginer almost 10 years
      Anthon Earlier in the question it was mentioned Linux 14 , which made me wonder when did Linux kernel version 14 get released.
    • Anthon
      Anthon almost 10 years
      @beginer sorry I missed that edit.
    • beginer
      beginer almost 10 years
      @Anthon hah :D cheers man....
  • derobert
    derobert almost 10 years
    Note that GRUB_DEFAULT can be a string as well, the full title of the menu entry. This will be much more robust than presuming Windows is always option #4.
  • Anthon
    Anthon almost 10 years
    @derobert that is good to know. The robustness of did vastly increase some time ago (at least on Ubuntu) when the sub-menus were used to stow the 'old' kernels, but explicit is better. The non-robustness of hard-coding was one of the reasons for me to use GRUB_SAVEDEFAULT
  • sunbabaphu
    sunbabaphu over 9 years
    Thanks! i tried only the second option, and it worked!.. just one thing: i used sudo update-grub instead of sudo update=grub... i dont know if both will work.
  • Anthon
    Anthon over 9 years
    @sunbabaphu update=grub was a typo, I corrected it, thanks for pointing it out.