How To Make Windows Default Boot In Grub2 In Fedora 21

If you are having a UEFI based system and are using fedora as your linux distro and its grub2 as default boot loader, here is how you can set any OS listed in grub2 menu as your default OS during boot. This is not only applicable for Windows but also for any OS installed currently on the system.

Note:- I’ve written this post keeping beginner’s and newbies in mind. Advance users please skip the text’s directly to the commands.

In fedora 21 the grub.cfg file has been moved from /boot/grub2/grub.cfg to /boot/efi/EFI/fedora/grub.cfg .

We will need to edit the settings file of grub that resides in /etc/default/grub.

Now for security purposes if you need to customize the grub you need to drop your settings into /etc/default/grub and then you need to grub2-mkconfig which will take a template from /etc/grub.d and use the settings from /etc/default/grub to generate new the grub.cfg file.

This process removes possibilities of errors to great extent.

Now, setting up your favorite OS as default boot in grub2.

Let’s get into superuser mode.

sudo su -

First,  we will need to find the menuentry for your OS from the actual grub.cfg file. Copy the command below into your terminal.

grep windows /boot/efi/EFI/fedora/grub.cfg

Here, I’ve searched for windows and the output was something like this

menuentry 'Windows Boot Manager (on /dev/sda2)' --class windows --class os $menuentry_id_option 'osprober-efi-E2FE-8BFE' {

You’ll need to copy the Windows Boot Manager (on /dev/sda2) inside the single quotes or whatever your output is. Use mouse to select and copy.

Second, We will need to paste the menu entry in the /etc/default/grub

gedit /etc/default/grub

That will open the file in gedit text editor, edit the line that reads

GRUB_DEFAULT="Windows Boot Manager (on /dev/sda2)"

to whatever you have copied, and remember to put that in double quotes.

Save the file and exit.

Third, Recreate the actual grub.cfg file using the current settings. -o option tells the command to put the output into the /boot/efi/EFI/fedora/grub.cfg file.

grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

All done. Reboot your system to see the effect.

Advertisements

Published by

Abhisek Padhi

Personal columnist at www.ScrollStory.com

Leave a Reply !

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s