Make GRUB Remember Your Last Booted Operating System

November 24, 2025

On my laptop I dual-boot between Windows and Ubuntu. Because I switch back and forth quite often, one of the recurring frustrations is that the system rarely boots into the OS I actually need at that moment. For example, when the default is set to Ubuntu and I am running Windows updates, the laptop might reboot several times. If I am not there to press the arrow keys before GRUB loads, it will end up booting Ubuntu instead of continuing the update process.

A simple way to improve this situation is to tell GRUB to remember the last selected boot option. Fortunately, GRUB supports this out of the box.

To enable this behavior, edit /etc/default/grub and set GRUB_DEFAULT to saved. Then add GRUB_SAVEDEFAULT=true. It should look like this:

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

Then run the following command to apply the changes:

sudo update-grub

The GRUB documentation explains GRUB_DEFAULT as follows:

If you set this to saved, then the default menu entry will be that saved by GRUB_SAVEDEFAULT or grub-set-default.

It also describes GRUB_SAVEDEFAULT with the following:

If this option is set to true, then, when an entry is selected, save it as a new default entry for use by future runs of GRUB. This is only useful if GRUB_DEFAULT=saved; it is a separate option because GRUB_DEFAULT=saved is useful without this option, in conjunction with grub-set-default.

In short, when GRUB_DEFAULT=saved is enabled, GRUB loads the default entry from a stored configuration. You can set this default manually with grub-set-default, or you can let GRUB update it automatically every time you select a boot option by enabling GRUB_SAVEDEFAULT=true.

Tags

= [, , , , ]
Comments

No comments yet

Leave a comment

// Your email address will not be published.