Fedora – How to change boot sequence -Grub2

Works with Fedora 20
Works with Fedora 17

This is for dual boot os users, there are many who prefers dual boot to keep another OS optional. For any reason if you wish to change boot sequence unlike grub, grub2 requires couple of commands to run.

Here will take example to keep Windows as default boot.
First of all find menuentry for Windows

cat /boot/grub2/grub.cfg |grep Windows


menuentry "Windows 7 (loader) (on /dev/sda1)" --class windows --class os {

Set Windows menuentry as default (only entry mentioned in either " or ' from above command)

grub2-set-default "Windows 7 (loader) (on /dev/sda1)"

Verify default entry

grub2-editenv list

Generate updated grub.cfg

grub2-mkconfig -o /boot/grub2/grub.cfg

Below is to set Fedora as default boot

cat /boot/grub2/grub.cfg |grep Fedora
grub2-set-default "Fedora Linux, with Linux 3.1.0-5.fc16.i686"
grub2-editenv list
grub2-mkconfig -o /boot/grub2/grub.cfg

Update 2011-12-29
This one is dirty way to achieve purpose. Especially if above does not works.
e.g following err faced by one of commenter.

grub2-mkconfig -o /boot/grub2/grub.cfg
/sbin/grub2-probe: error: cannot stat `/dev/root’.

You need to do this after every new kernel installation, as it may change default entry.

vim /boot/grub2/grub.cfg
set default="${saved_entry}"
set default="2"

Now check on reboot, third boot entry should be default for booting.
for grub first entry is 0, second is 1, third is 2 & so on.

To keep default=2 permanent even after new kernel installation
vim /etc/default/grub

if you find any missing point in here, please let us know in comment section or tweet us at @linuxreaders. To get more articles like this, subscribe to our RSS feeds / Mails.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  1. It’s not working for me. (the 1st method) I’m using fedora 20. No errors are reported however, the default choice is still ‘Fedora’.

  2. Pingback: How to change boot sequence -Grub2 | Virtualize the World

  3. Pingback: /dev/blog » Change GRUB2 default boot target

  4. Pingback: Compiler Kernel 3.4.2 Stable on Fedora Core 17 | IT水電工-哆啦胖虎

  5. I believe the last step is wrong (but will usually work by accident). The default entry is set in the file /boot/grub2/grubenv which is changed with the grub2-set-default command and is available at bootup when processing grub.cfg . There is no need to rebuild grub.cfg in order to set this.  In fact when I followed these instructions grub.cfg ended up rebuilt with slightly different menuentry names and it broke the default.. resorting to the default default of 0. So skip the last grub2-mkconfig

    •  hi, I am not sure how it works for you, for me this boot sequence does not change unless grub.cfg is rebuild. Can someone pl confirm this?

  6. Pingback: grub2 change default boot partition | wsinw.com

  7. Pingback: grub2 change default boot partition | wsinw.com

  8. You explanation is very helpful and it helped me to set default kernel version on my Fedora 16 laptop. Thank you!!!

  9. I got this error,what to do? i begins to discover fedora just days ago and i dont know what it means. can u introduce some pdf-book for learning linux fundamental and fedora specially? THX ——My Error—————–:-(————————- [root@localhost /]# grub2-mkconfig -o /boot/grub2/grub.cfg /sbin/grub2-probe: error: cannot stat `/dev/root’.

    • they is bug filed for exact err. https://bugzilla.redhat.com/show_bug.cgi?id=737370 for now, try running yum update also check updates on bottom of the post

      • Dear Dhaval Thakar Two days after i reported my problem to you, i turned on my laptop for doing some work. when the GRUB2 loaded i saw that Win7 has highlighted in boot menu and after that my Acer AS 4741G booted from win7. So the first solution worked for me, however there was some error with generating updated grub.cfg. XOXO

  10. Pingback: Fedora- How to change the boot order in Grub2 to Windows 7 « flyingpengwin

  11. It does not work for me, although grub2-editenv list states the Windows entry correctly, grub selects the Fedora recovery mode kernel as default on my computer which is the last before the windows menu entry. I suspected that behind “Windows 7 (loader) (on /dev/sda1)” a wrong number but even giving the number 4 or 5 did result in grub2 only selecting the last entry before windows… Did it work for you?

      • I figured out that I forgot that I played with /etc/default/grub before I found your solution. I left the number 3 there instead of ‘saved’. Your solution works perfectly well now, thanks a lot! Stefan

  12. Nice tutorial. Done the same thing in ubuntu via changing order in /etc/grub.d/. See this for more info http://www.techienote.com/2011/08/changing-default-boot-os-in-ubuntu-11-04.html