You might also like
Answer
You can configure grub via several ways to use a specific kernel or you can configure grub to use the latest one, or you can tell grub to pick one from a selection.
One specific kernel
If you inspect /etc/grub/grub.cfg you’ll see entries like this:
You can use two identifiers to configure grub; you can use 'Debian GNU/Linux GNU/Linux, with Linux 6.12.8-amd64' or you can use the $menuentry_id_option
with gnulinux-6.12.8-amd64-advanced-5522bbcf-dc03-4d36-a3fe-2902be938ed4.
On Debian you can change grub by using /etc/default/grub.d directory to add a
customisation:
Now run sudo update-grub and notice this line in your /boot/grub/grub.cfg:
Now the default boot option is set.
Per menu listing
You can also configure grub to use the menu listing, although this can be a bit finicky when you have submenus. For example, Debian ships with an advanced options menu:
If you want to select kernel from that section you need to do one or two
things. You can opt for the easy way and that is to select the nth option and
then the other nth option: GRUB_DEFAULT=1>2. Or you can pick the id:
And possibly you can also pick it based on the label:
But in all honesty I’ve never actually done this. But it seems logical.
Important: Always quote GRUB_DEFAULT when using > notation. Without
quotes, GRUB only sees the first part and ignores everything after >.
Disabling submenus
You can also disable submenus and that makes things a whole lot easier:
Save the last option
You can also tell grub to save the last picked option, which is what I have configured.
Now when you select a kernel to boot with grub saves this choice. You can
inspect the file /boot/grub/grubenv to see which option got saved:
This should be enough for you to configure grub to pick a kernel and roll with it.