Over the years there have been many GNU/Linux bootloaders (I remember using loadlin, and syslinux), and these days most distributions are settling on Grub2 (https://www.gnu.org/software/grub/).
If you’re like me and have multiple OS installed on a machine, you can find yourself getting intimate with your bootloader to make it behave in a way that will suit your workflow, or sometimes missing that menu to make your selection.
I multi-boot Ubuntu, Windows 10 (yes, there are some things I need to do here), Arch, and sometimes something else. 9 times out of 10, I just want the bootloader to boot the last selection I made, but this one isn’t always Grub’s default. Yes, I could change the default value, however I find the offset-model here a little annoying, especially when you get “Advanced options for X Linux…” in the menu list.
Today I discovered a Grub2 setting that makes Grub remember and boot your last selection. Very useful!
I made my edits under Ubuntu (as that’s the OS that I consider owns my grub settings):
sudo nano /etc/default/grub
Change your GRUB_DEFAULT setting to be saved:
GRUB_DEFAULT=saved
Add in the GRUB_SAVEDEFAULT value to make this work:
GRUB_SAVEDEFAULT=true
Save, and then run the stub for grub-mkconfig:
sudo update-grub
Et voila! I can now reboot, and it rememvers what I selected last time. Great for when testing a change to your main-driver OS – as I’m doing with Arch currently.