Grub defaults to 'saved_entry' after update

I added a new and bigger HDD to my Tri-boot (Manjaro, Linuxmint and Windows10) system recently, which is used to store media and backup files. I want my system to boot into Manjaro as the default OS. However after Manjaro has a kernel update this changes. If I boot into any of the other OS on startup, when I shutdown the PC, the next time the PC is switch-on it boots to the last used OS.
How can I stop this from happening, such that it always boot the default OS (Manjaro) without having to make this change manually.
What I have to do everytime this happens, I would edit the grub.cfg file and make a change from this

if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="${saved_entry}"
fi

to

if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

You will have to apply the change to both Linux installations as the active grub will vary depending on which one you started last time.

Change both /etc/default/grub and

  • disable the option to save the last used entry
  • set timeout-style to menu
  • set a reasonable timeout
  • disable submenu
#GRUB_DEFAULT=saved
GRUB_TIMEOUT=15
GRUB_TIMEOUT_STYLE=menu
GRUB_SAVEDEFAULT=false
GRUB_DISABLE_SUBMENU=true

Update grub in both systems

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

Another option could be to distinctively select your Manjaro EFI partition as the primary EFI partition - (done in system firmware or using efibootmgr) - and hope the other Linux don’t change it :grin:

Of sourse the above is only valid if you are using EFI cause if you are using MBR then your grub is written to the primary disk defined in BIOS - and you will have nothing but trouble.

normally, you only make changes to
/etc/default/grub
and then run
update-grub
or
grub-mkconfig ....
this will re-generate the file that you edited

ps:
see what @linux-aarhus said while I was replying :point_up:

I would make those changes…
PS what should i use to wrap the text in for correct formatting.

Sorry I over wrote your formatting of my entry

I suggest you modify the grub as I described - start with your Mint installation - and generate grub.cfg - then proceed to reboot your system - loading Manjaro - then doing the same.

This is the linuxmint /etc/default/grub file current entry

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=lsb_release -i -s 2> /dev/null || echo Debian
GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash”
GRUB_CMDLINE_LINUX=""

I have made the changes to the grub file and it works perfectly. Now it always default to Manjaro at boot-up

I guess this file will change only on re-install of manjaro.

Thank you for your help.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.