Changing The Default Boot Preference

Recently , I have installed Fedora 26 , and as a new user to Red Hat Linux Enterprise, I am trying to learn it, though the basics that I used on ubuntu still exist the same. Till now , I’ve missed Ubuntu for it’s shortcuts and Loved Fedora for it’s ease of operation. But some boot error like “BOOT IMAGE=vmlinuz … ” keeps on coming at every boot , do tell me if you guys are able to help me out with this one.

When I installed Fedora , another change was that the windows operating system appeared at 3rd position , i.e Fedora was default.

Okay, with me until and unless somebody else doesn’t use the pc. I share it with my lovely family , and I feel it bad at times when they are put at some unnecessary difficulty. Here it was boot order of the operating systems available. Moreover the default time was 5 seconds to select the OS , a guy unaware with such things would easily miss out and land on the fedora login page . It might take time to find the restart option , if you aren’t frequent computer user.

So today let’s learn how to change the default booting preference in Fedora 26 :

Firstly , open up the terminal (The most common step in simple solutions )

If you remember the order number of the os you wish to make default , then this step is not required .

To list the menu entry at the boot time , type :


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

But I prefer


cat /boot/grub2/grub.cfg | grep ^menuentry

Notice the “^” symbol before the search string “menuentry” . This symbol called caret is a regex i.e a regular expression way to show start of  a line.

regex are very handy at times , a must’ve skill if you’re upto something big with data.

(It’s grub2 for Fedora , ubuntu *might work with just grub)

(You, need to count the entry number of your required os)

Now, if your required os is at no. 4 , then it’s entry number is 3 , since the actual entry numbers start from 0

For example in my case the windows os is at number 3 in the boot menu , and in the above commands output . So, the actual entry number is 2 .

Now , we’ll change the default booting preference.


sudo vi /etc/default/grub

Now , change the GRUB_DEFAULT value from saved (or it might be 0 ) to the actual entry number we found , that is , 2 in my case.

And since this is a read only file , and we’re editing using vi ( or vim both open vim mostly) , so we need to save the changes forcefully , hence an ! mark is required. so type :wq! or x! to save and exit.

Now , for ubuntu it’s simple( it also has a GUI for this purpose , in it’s software center) . Ubuntu uses ‘$ sudo update-grub’ . But Fedora doesn’t have this command so we’ve to do it manually.

Type


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

We’ve now changed the file responsible for boot preference , and updated it .

If you’re required to use su command , it sometimes doesn’t work .

so you can do sudo bash and then type the su command , though there seems to be no use of it , since the sudo command does mostly the same thing , like the above grub command works well with both the ways.

Now , do a restart and It shall have default preference according to the entry number you filled.

But , If you update Fedora , you have previous kernels plus the new one , and the booting preference is reset .

BONUS:

I found an extension that gives option to boot into specific os from the restart button at fedora login screen.

It’s called GRUB Reboot . Search for it in the Software center of Fedora .

 

Keep learning something.

 

storymode7

Advertisements

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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s