Background: (in case this serves to detect an XY problem) With a recent update to Ubuntu 22.04, an Oracle kernel showed up in my grub menu, ending up on top since its versioning uses higher numbers.
Doing some digging around, this appears to be a dependency of NVIDIA proprietary drivers, which is not meant to be booted from. The update which added this to my grub also updated the kernel, so I'm assuming the update introduced the new kernel by letting grub scan for new kernels.
Currently I am using a workaround of GRUB_DEFAULT=saved
, which works great for rebooting the system, but requires me to manually select the kernel after switching systems back an forth on a dual boot setup.
The question: Can you make grub forget about a kernel, without actually removing it from the system, and without excluding an entire disk?
I do not wish to set the first grub option to a specific kernel, as this manually created link would presumably not get updated when the system's kernel does, making it easy to miss an update.
EDIT: prompted by a comment, the listing I am referring to is "Advanced options." I'm looking for a command or a config file edit that will either persistently mark a kernel not to be included in grub upon scanning for kernels with a command like update-grub
, or to at least remove it from the listing until the next scan for new kernels. The goal is to make it so that the top kernel, which will automatically be booted, is not an unwanted kernel used as a dependency, but the system's newest kernel. As to my understanding, the default "Ubuntu" boot option runs the top listing in this menu.