How to change your Ubuntu Kernel?
In this guide, we will provide you on the steps to change your kernel and boot different kernels from the Ubuntu mainline repositories conveniently.
It makes use of the ubuntu-mainline-kernel.sh utility to manage the kernels. It should be noted that this utility checks the status of the kernel tree before download and installation of the kernel.
Get the ubuntu-mainline-kernel.sh utility
You can get this utility by using the following commands:
wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh
chmod +x ubuntu-mainline-kernel.sh
Get the list of available kernels
You can get the list of available kernels using the following command:
./ubuntu-mainline-kernel.sh -r
Install a specific kernel version
You can install a specific kernel version using the following command:
./ubuntu-mainline-kernel.sh -i v6.4.6
Remove a specific kernel version
You can remove a kernel by running the following command and choosing the kernel you want to uninstall:
./ubuntu-mainline-kernel.sh -u
Boot a specific kernel version
To boot a specific kernel version, you will have to configure your bootloader in order to load the desired kernel version.
To view the kernel options you can choose from, use
grep 'menuentry \|submenu ' /boot/grub/grub.cfg | cut -f2 -d "'"
To configure grub, you will have to modify the /etc/default/grub file and set the GRUB_DEFAULT=0 to the kernel option you want to boot with such as GRUB_DEFAULT='Advanced options for Ubuntu>Ubuntu, with Linux 6.4.6-060406-generic'.
The Advanced options for Ubuntu > part that is recommended to be used.
After modifying the grub config, run update-grub command to update the GRUB configration and apply the changes made.
ubuntu-mainline-kernel.sh is a very useful utility that simplifies the process of installing kernels from the command line.
However, it is still advisable to go through the warnings that you should be aware of while using this utility on their github page <https://github.com/pimlie/ubuntu-mainline-kernel.sh#warnings>
_