What kernel do you use?

I’ll just expand on everyone that’s attempted to answer this and give the full and correct way to achieve having the last used kernel be selected upon boot since there is a little bit of confusion and I’ve just tested the following myself that works.

So, if you want to enable the grub so that on boot it selects by default whichever kernel you last used, then please follow these commands:

EDIT: Use the following if your file-system is ext4, if you use btrfs, DO NOT use the following as it is unsupported.

sudo nano /etc/default/grub

You have to change two values here. First at the very top look for:

GRUB_DEFAULT=0

And change the value from a 0 to “saved” without the quotes like the following:

GRUB_DEFAULT=saved

Next value to change, look for the following (it’ll be towards the very bottom):

# Uncomment to make GRUB remember the last selection. This requires
# setting 'GRUB_DEFAULT=saved' above.
#GRUB_SAVEDEFAULT=true

Here, get rid of (aka delete) the # before GRUB_SAVEDEFAULT=true
So it looks like the following:

# Uncomment to make GRUB remember the last selection. This requires
# setting 'GRUB_DEFAULT=saved' above.
GRUB_SAVEDEFAULT=true

Now you may hit Ctrl+X, then type Y (for yes) and hit enter to save the file.
Next you have to ‘reload’ grub with the new vaules, so for that use the following:

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

Once you’ve done that, reboot, select a different kernel that you don’t normally boot from, login real quick, and do another reboot to check to see if the kernel you previously selected is saved from the last boot and then you should be all good to go! Like I said I just tested this and it works, just be mindful and careful to type those values in correctly. Hope this helps anyone that wanted this like I did :wink:

3 Likes