IRC:grub-saved [2020-01-21*]


You can adjust grub to save your last manual selection of a kernel-version or an installed OS to be used as the new default for further sessions.

As long you do not select a different entry manually again, the last selection will be used as default on recurrent boots without the need to enter grub-menu.


The grub-saved feature requires, that /boot/grub does reside on a supported filesystem like ext4/3/2. If /boot/grub resides at a btrfs-volume for example, grub will deny to save the user-selection as new default.

To make use of the grub-saved feature, one has to adjust /etc/default/grub and recreate the grub-menu afterwards.

It's generally a good idea to create a backup of system config-files - like /etc/default/grub - before editing them.

If using commands with sudo, you will get asked for your users password. (with older mint-versions, your will get no feedback shown while entering it; newer mint-versions will show some asterisks * while entering it)

The tutorial does show the output and values of a mint 19.3 -version. If you are using a different version of linux mint, your default-values might differ in details (but the related entries should still be spotable).

Setup grub-saved feature

1) Check that /grub resides on an ext*-volume

Copy the following line to a terminal:

df -Th /boot/grub

This should show some similar output:

Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/sda5      ext4   61G   33G   25G  58% /

- where the column Type is important and should show preferable 'ext4', 'ext3' or 'ext2'.

If the shown type is 'btrfs', you can stop here, as grub does not support the grub-saved feature in this case.

2) Create backup

Copy the following lines to a terminal:

mkdir ~/backups
cp --parents --backup=numbered /etc/default/grub  ~/backups

This will create a folder backups at your users home-directory and place a copy of the original file, including it's parent folders structure there.

If the cp command is run repeatedly, older backups will be kept, but renamed to grub~1~, grub~2~ etc - the last recent version will keep the original name.

3) Edit /etc/default/grub

Copy the following line to a terminal and enter your password, when being asked (2 times on the first run):

xed admin:///etc/default/grub

Note: If you cant use xed for some reason or are limited to a text-console, you can use nano - see IRC:nano.htm - instead, to apply the required changes:

sudo nano /etc/default/grub

Replace the line showing GRUB_DEFAULT=0 with GRUB_DEFAULT=saved

Add a new line below GRUB_SAVEDEFAULT=true

Replace the line showing GRUB_TIMEOUT=0 with GRUB_TIMEOUT=3

If you want to display the grub-menu on boot without an user action, you can optionally replace GRUB_TIMEOUT_STYLE=hidden with GRUB_TIMEOUT_STYLE=menu

The final file will look similar to this (edit's are highlighted, leading and subsequent text is omitted)

# ... skipped text before
#   info -f grub -n 'Simple configuration'

GRUB_TIMEOUT_STYLE=menu		# optional to show the grub-menu without user action
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`

# Uncomment to enable BadRAM filtering, modify to suit your needs
# skipped text after ...

Save your changes and close the editor.

4) Recreate the actual grub-menu run

To re-create the actual grub-menu run:

sudo update-grub

, which should list available kernels and installed OS - similar to this:

demo@mint-19-3-cinnamon-64bit:~$ sudo update-grub
[sudo] password for demo:         
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/50_linuxmint.cfg'
Sourcing file `/etc/default/grub.d/60_mint-theme.cfg'
Generating grub configuration file ...
Found theme: /boot/grub/themes/linuxmint/theme.txt
Found linux image: /boot/vmlinuz-5.3.0-26-generic
Found initrd image: /boot/initrd.img-5.3.0-26-generic
Found linux image: /boot/vmlinuz-5.0.0-37-generic
Found initrd image: /boot/initrd.img-5.0.0-37-generic
Found linux image: /boot/vmlinuz-5.0.0-32-generic
Found initrd image: /boot/initrd.img-5.0.0-32-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin

If update-grub does show any errors: recheck your edits. It might help to compare your edits against the initial created backup-file using:

diff /etc/default/grub  ~/backups/etc/default/grub
demo@mint-19-3-cinnamon-64bit:~$ diff /etc/default/grub  ~/backups/etc/default/grub

Reboot and use

If you reboot now - and select a different kernel-version (or another OS) from the grub-menu withing the 3 seconds timeout - this will be used as your new default on following reboots until you change your selection again next time.

Related information

IRC:nano.htma simple text-mode editor
IRC:grubedit.htmmaking kernel params permanent
IRC:bootparam.htmedit kernel params on boot, common use-cases

© 1998-2023 by ORCUS® GmbH - (imprint) - we strictly do not track (period) - details: privacy - overview IRC: IRC support

note-1: not tracking does mean too - we are strictly NOT using direct external links within the content = we bother you having to copy&paste offered URLs