- Install Linux Kernel 6.2 in Ubuntu 22.04 | 20.04 Linux
- Update Ubuntu 22.04 | 20.04 Linux Kernel to version 6.2
- 1. Check the Current Ubuntu Kernel version
- 2. Update Ubuntu 22.04 or 20.04
- 3. Download Ubuntu mainline kernel installer
- 4. Find the latest version of the Linux Kernel
- 5. Installing Linux 6.2 Kernel on Ubuntu
- 6. Reboot your system
- 7. Change or Set the Default Kernel Version
- 8. Uninstall Linux kernel v6.2.0
- FAQ
- What is Ubuntu mainline?
- How to install Mainline in Ubuntu?
- What are the three types of kernels?
- Different Types of Kernel for Arch Linux and How to Use Them
- Different types of kernels available for Arch Linux
- Mainline kernel (package name: linux)
- LTS kernel (package name: linux-lts)
- Hardened kernel (package name: linux-hardened)
- Performance-tuned kernel (package name: linux-zen)
- How to switch kernels on Arch Linux
- Step 1: Install the kernel of your choice
- Step 2: Tweak the grub configuration file to add more kernel options
- Step 3: Re-generate the GRUB configuration file
- Conclusion
Install Linux Kernel 6.2 in Ubuntu 22.04 | 20.04 Linux
Ubuntu is one of the most popular operating systems built on top of the Linux kernel, developed by Linus Torvalds. However, installing the kernel on Ubuntu OS is not as straightforward, therefore in this article, we will learn the steps to install any latest available Linux kernel version on Ubuntu OS.
The Linux Kernel is the main part of any operating system and is responsible for bridging hardware and software together. Developers can use Kernel to modify operating systems to suit specific needs or tasks. Therefore, it’s a valuable part required for the proper functioning of the complete Ubuntu Linux OS.
Note: “The mainline kernel builds are produced for debugging purposes and therefore come with no support. Use them at your own risk”
In this article, we learn how to install Linux Kernel 6.2 on Ubuntu 22.04 or 20.04 Linux to get the advantages and improvements of this Kernel version on an existing system.
Update Ubuntu 22.04 | 20.04 Linux Kernel to version 6.2
The given steps in this tutorial are not just limited to Ubuntu only, even we can use them for Linux Mint, Debian, POP OS, and other similar Linux systems.
1. Check the Current Ubuntu Kernel version
Well, it is good to know which version of the Kernel is on our Ubuntu system before installing a new one. To do that, on your Ubuntu access the command terminal. The GUI desktop users can use the keyboard shortcut Ctrl+Alt+T to open the terminal app. After that run the given command:
2. Update Ubuntu 22.04 or 20.04
It is a good practice to make your system always up to date. However, if you haven’t then first run the system update command to ensure all the system packages are up to date. After that also install wget which we require later in this article.
sudo apt update && sudo apt upgrade
3. Download Ubuntu mainline kernel installer
Well, we don’t need to use any script to install the latest Linux kernel package on Ubuntu, because it is available as Debian binary to install.
However, to easily install, update and uninstall Linux Kernels on Ubuntu 22.04 | 20.04 LTS, we can use the Ubuntu Mainline Kernel script available on GitHub. Use the given command to download it on your Ubuntu system.
wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh
Once the script is on your system, make it executable and move it to /usr/local/bin to easily use it in the future to get the latest version of the kernel.
chmod +x ubuntu-mainline-kernel.sh
sudo mv ubuntu-mainline-kernel.sh /usr/local/bin/
4. Find the latest version of the Linux Kernel
We can use the Ubuntu Mainline Kernel script to find what is the latest available version of the Linux kernel to install on our Ubuntu system. For that on your command terminal run:
If the latest version is different from the one installed on your system, the script will display that.
Whereas to list available Kernel series (versions) that you can install using the script, use this terminal command:
5. Installing Linux 6.2 Kernel on Ubuntu
To install the latest Linux kernel package which is available in the repository of kernel.ubnut.com, we can use
sudo ubuntu-mainline-kernel.sh -i
However, if you have some special requirements and looking for some specific kernel version then after the -i parameter mention the exact version you want. For example: for 6.2, we can use:
sudo ubuntu-mainline-kernel.sh -i v6.2.0
If you have installed multiple Linux kernel versions on our Ubuntu using this script then to list all of them we can use:
sudo ubuntu-mainline-kernel.sh -l
6. Reboot your system
Restart your system to let it use the kernel version you have just configured.
After the system reboots, check your current version by using:
This time you will see the latest one.
7. Change or Set the Default Kernel Version
Ubuntu is configured to use the latest available Linux version on the system, by default. However, due to any reason, if you want to change that, then edit the Grub file.
Add the following two lines, to get an idea you can see the screenshot.
GRUB_SAVEDEFAULT=true GRUB_DEFAULT=saved
Save the file Ctrl+O, hit the Enter Key, and then exit it Ctrl+X. This will save our preference of the default kernel in the Boot menu and will not reset it with the system reboot until we change it.
Update Grub:
Now reboot your system:
As you start your system, press the Esc button to get the Grub menu. Select “Advanced options for Ubuntu” and then select the Kernel version you want to set as the default one on your system.
8. Uninstall Linux kernel v6.2.0
To remove any existing Ubuntu Linux kernel from your system you have installed using the script, run again mainline tool command:
sudo ubuntu-mainline-kernel.sh -u
Select the serial number of the version you want to completely remove from your system.
You can even use the PPA of Ubuntu Mainline to update or downgrade the Ubuntu Linux kernel.
FAQ
What is Ubuntu mainline?
The Mainline kernel is a term used for the latest available version of the Linux kernel that has recently been released by the developers but is still under development. Whereas Ubuntu mainline is a script that is available on GitHub and allows users to install the latest mainline and even the old or previous kernel versions from the kernel.ubuntu.com repository.
How to install Mainline in Ubuntu?
- Open the Ubuntu command terminal window.
- Download Ubuntu mainline script, the command is given in this article for that.
- After that use the sudo ubuntu-mainline-kernel.sh -i command.
- This will install the latest Mainlin version on your Ubuntu Linux.
What are the three types of kernels?
A kernel is the core of any operating system which acts as a bridge between the hardware and software in a computer.
There are three main types of kernels: monolithic kernels, microkernels, and hybrid kernels.
Monolithic Kernels are the most commonly used type of kernel. They contain all device drivers and core OS services within one large block of code which makes them more efficient and less prone to errors.
Microkernels are another type of kernel that only contains essential operating system functions, such as memory management, process scheduling, and inter-process communication. As its name suggests this arrangement reduces its size and complexity but makes it more difficult to debug.
“Hybrid Kernels” – as the name suggest it is a mixture of two kernels. Developers took the best aspects of monolithic kernels and microkernels by having both essential components and device drivers all within the same block of code. This makes such kernels more efficient and less prone to errors than microkernels but with better scalability than monolithic kernels.
Different Types of Kernel for Arch Linux and How to Use Them
One of the reasons why people use Arch Linux is that it is a bleeding edge rolling release. You get most software and the Linux kernel before users of other distributions.
But this doesn’t mean that you have to always use the latest mainline kernel. There are several kernel options available, and I am going to show you switch kernels in Arch Linux.
Different types of kernels available for Arch Linux
First, let me tell you about different kinds of Linux kernels available to you as an Arch user.
Mainline kernel (package name: linux)
This is the latest stable Linux kernel. Most people use this kernel for the reason that it is the latest available kernel version.
LTS kernel (package name: linux-lts)
The linux-lts package gives you the latest long term support Linux kernel. There is no predefined life cycle for a LTS kernel but you can be assured to enjoy the same kernel version for a much longer period.
Kernel patches normally don’t break anything but a breakage is not impossible to happen. If your hardware isn’t the newest the market can offer, you can enjoy the bleeding edge software with increased stability by installing the slightly older LTS kernel.
Hardened kernel (package name: linux-hardened)
For the security concerned users, there is a hardened version of the latest stable kernel. Do note that several packages will not work when using this kernel.
Performance-tuned kernel (package name: linux-zen)
If you want to get the most out of your system, you can use the “Zen” kernel which is basically a fork from the latest kernel and provides tunes at the cost of throughput and power usage.
How to switch kernels on Arch Linux
Now that you are aware of various kernel choices, let’s see how to change kernel in Arch Linux.
- Install the Linux kernel of your choice
- Tweak the grub config file to add the newly installed kernel
Don’t worry, I am going to show you the steps in details.
Check the kernel version in arch Linux using this command:
If it shows only a number
To switch kernels on Arch, can be simply done by installing the kernel that you want to use and tweak the grub configuration file.
Step 1: Install the kernel of your choice
You can use the pacman command to install the Linux kernel of your choice. You just need to know the package name.
You may also install more than one type of Linux kernels at the same time in the system. You can choose which kernel to use from the grub menu.
For the latest stable kernel:
For the latest LTS kernel:
For latest stable kernel with hardened patches:
sudo pacman -S linux-hardened
Step 2: Tweak the grub configuration file to add more kernel options
By default, Arch Linux uses the latest kernel version as the default. Additional kernel versions are available from under the advanced options:
However, I prefer to do things a bit different and a bit better (in my opinion). Here’s what I do:
- Disable grub submenu so that all the available kernel versions are shown on the main screen (instead of under Advanced Options).
- Configure grub to recall the last kernel entry you booted and use it as the default entry to boot from the next time.
Sounds a lot better already, does it not?
To do this you need to edit the GRUB configuration file. All the configuration files in general are located at the /etc directory.
Open your terminal and edit the config file in your favorite terminal-based text editor. I am using Nano editor:
As you may notice I have changed the value that I mentioned but I have added another 2 lines so the final result should look like this:
GRUB_DISABLE_SUBMENU=y GRUB_DEFAULT=saved GRUB_SAVEDEFAULT=true
The first and optional line is used to disable the GRUB submenu. I find it easier when instantly I can see all my kernels on the GRUB screen without having to enter the advanced options submenu.
The second line is used to save the last kernel entry.
Lastly you need to ensure that GRUB will use as a default the last saved entry.
Save the configuration file and exit.
Step 3: Re-generate the GRUB configuration file
To make the changes effective you need to re-generate the configuration file. To do so, open the terminal and run the following command:
$ sudo grub-mkconfig -o /boot/grub/grub.cfg
If it looks familiar to you, you have used this command during the Arch Linux installation process.
Reboot your Linux system and select the kernel you want to use!
Conclusion
You don’t need to worry about updating the kernel in Arch Linux. If there are updates to your choice of kernel, it will be installed with the system updates. I guess you already know how to update Arch Linux system.
Switching kernels on Arch Linux is an easy to do process with several options tailored to your needs. I find the above method the safest and easiest as you don’t need to remove a kernel from your system. If you choose to run the latest kernel, it’s good to have installed the LTS kernel in case of a kernel panic.
I hope you liked this Arch Linux tip. Stay subscribed to It’s FOSS for more tips and tutorials.