Setting savedefault option for grub in Ubuntu 13.04

Technical, Technology

Thank to kstevens.

You need to have both of these lines in /etc/default/grub:

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

Then run sudo update-grub.

Check the entries in /boot/grub/grub.cfg and they should look something like:

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu, with Linux 2.6.32-22-generic' --class ubuntu --class gnu-linux --class gnu --class os {
        recordfail
        savedefault
        insmod ext2
        set root='(hd0,5)'
        search --no-floppy --fs-uuid --set c23bb931-2d60-4f48-9086-c8dbdc7fdca6
        linux   /boot/vmlinuz-2.6.32-22-generic root=UUID=c23bb931-2d60-4f48-9086-c8dbdc7fdca6 ro splash vga=786  quiet splash
        initrd  /boot/initrd.img-2.6.32-22-generic
}

The most important line to note is savedefault.  It indicates that this menu entry will save itself as the default when selected.  Verify that this line appears under each menu entry.

HOWTO: make last chosen entry as default for grub2 bootloader

Technical, Technology

The correct syntax for enabling savedefault in /etc/default/grub (GRUB 2) is with the lines:

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

and not with the line DEFAULT=save that the enquirer suggested.

After adding the two lines above to /etc/default/grub, one has to update GRUB’s configuration, as a superuser, with the following commands:

grub-mkconfig
update-grub