make grub default to last boot

Issues related to applications and software problems and general support
Post Reply
Posts: 1
Joined: 2019/11/02 22:15:06

make grub default to last boot

Post by » 2019/11/02 22:25:15


I have just installed centos 8 alongside windows 10, and grub shows a menu with three centos entries and windows, with first entry as default.
I want grub to always pre-select the entry I used last boot, e.g. if at some point I boot windows I want the fourth entry in the grub menu (the windows entry) to be pre-selected and the same with centos.
I read here: that this could be achieved by having the next two lines in the /etc/default/grub file:

Code: Select all

and than re-creating the grub boot menu using the command:

Code: Select all

grub2-mkconfig -o /boot/grub2/grub.cfg
but I must be misunderstanding something because it doesn't work.
here is my /etc/default/grub:

Code: Select all

GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_CMDLINE_LINUX="crashkernel=auto resume=/dev/mapper/cl-swap rhgb quiet"
hopefully someone can help me find out how to make my grub always default to load last used os.

User avatar
Forum Moderator
Posts: 27384
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: make grub default to last boot

Post by TrevorH » 2019/11/03 02:39:36

That doesn't look like a wise thing to run. What do you think it is going to do?
CentOS 6 will die in November 2020 - migrate sooner rather than later!
CentOS 5 has been EOL for nearly 3 years and should no longer be used for anything!
Full time Geek, part time moderator. Use the FAQ Luke

Posts: 163
Joined: 2009/09/19 19:21:36
Location: Paris, France

Re: make grub default to last boot

Post by nouvo09 » 2019/11/03 16:30:35

Just be carefull what you are talking about.

BLSCFG=enable means that the fedora boot informations are no more picked up from the grub.cfg file but in the /boot/loader/entries directory where every version stores its boot information.

By the way the grub loader does not take care of the last boot also if corresponding options are in the /etc/default/grub file. Instead, grub reads these entries sorted by ALPHABETIC ORDER and as you can see, the corresponding names always begin with the UUID.

So, starting with BLS enabled, grub displays the menu choices by alphabetic order of UUID.

The only way to fix that is to change GRUB_ENABLE_BLSCFG to false and regenerate the grub. cfg file.
Member of centos-FR forum

Post Reply

Return to “CentOS 8 - General Support”