The Linux kernel is an essential part of the Linux operating system, acting as a link between software and hardware. Keeping current with the latest kernel version is critical since it provides several benefits such as greater stability, updated features, and enhanced security. This article will walk you through checking and updating the kernel version in Ubuntu 22.04.
Prerequisites
- A server that runs Ubuntu Linux
- Terminal access (CTRL-ALT-T or Applications menu > Accessories > Terminal)
- A user account with sudo access
- Ubuntu includes an apt tool.
- Ubuntu’s built-in Update Manager (optional)
How to Check the Kernel Version on Ubuntu
There are several methods to determine the Ubuntu kernel version on your Ubuntu 22.04 system. Here are a few commonly used methods:
Use uname Command
- Open a terminal
- Enter the following command into the terminal:
uname -r
The uname command with the -r flag can be used to check the Ubuntu kernel version on Ubuntu 22.04.
Use cat command
You can use the following command to get the current Upgrade Linux kernel version, the version of GCC used to compile the kernel, and the kernel’s compilation time. To access the contents of this file, use the “cat” command,
cat /proc/version
Note: Please keep in mind that our Ubuntu 22.04 comes with the Kernel version 5.15.0.39 by default.
Update Kernel Version on Ubuntu 22.04
The kernel headers are provided by the Linux headers packages. It is responsible for running the latest kernel’s drivers and modules.
In this guide we will use an executable file to download the .deb files and upgrade kernel to latest available version.
Download the Executable Script
Use the “wget” command to download the executable script file from Github.
wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh
Once downloaded make the file as executable and move it into the /usr/local/bin directory.
chmod +x ubuntu-mainline-kernel.sh
Move the file to the above mentioned directory.
sudo mv ubuntu-mainline-kernel.sh /usr/local/bin/
Check Available Linux Kernel Versions
Now you can execute the downloaded file to check for all versions and also for available latest versions.
Execute the below command to check if there are any latest versions available with the -c option.
ubuntu-mainline-kernel.sh -c
You will get an output similar to the one below if there are any latest versions available.
Finding latest version available on kernel.ubuntu.com: v6.3.7 Finding latest installed version: none A newer kernel version (v6.3.7) is available
If you need to list all available versions you can execute the below command with the -r option.
ubuntu-mainline-kernel.sh -r
You will get a big set of lists as shown below.
v3.2.85 v3.2.90 v3.2.92 v3.2.93 v3.2.94 v3.2.95 v3.2.96 v3.2.97 v3.2.98 v3.2.99 v3.2.100 v3.2.101 v3.4.113 v3.8.3 v3.8.7 v3.12.65 v3.12.66 v3.12.67 v3.12.68 v3.12.69 v3.12.70 v3.12.71 v3.12.72 v3.12.73 v3.12.74 v3.14.74 v3.14.75 v3.14.77 v3.14.78 v3.14.79 v3.16.40 v3.16.45 v3.16.50 v3.16.55 v3.16.60 v3.16.65 v3.16.70 v3.16.75 v3.16.76 v3.16.77 v3.16.78 v3.16.79 v3.16.80 v3.16.81 v3.16.82 …
Install Latest Kernel Version
Now you can install the latest version using the below command.
sudo ubuntu-mainline-kernel.sh -i
Type Y and ENTER to accept. Once the installation is complete, you will see something similar to the one below.
Finding latest version available on kernel.ubuntu.com Latest version is: v6.3.7, continue? (y/N) Will download 6 files from kernel.ubuntu.com: Downloading amd64/linux-headers-6.3.7-060307-generic_6.3.7-060307.202306090936_amd64.deb: 100% Downloading amd64/linux-headers-6.3.7-060307_6.3.7-060307.202306090936_all.deb: 100% Downloading amd64/linux-image-unsigned-6.3.7-060307-generic_6.3.7-060307.202306090936_amd64.deb: 100% Downloading amd64/linux-modules-6.3.7-060307-generic_6.3.7-060307.202306090936_amd64.deb: 100% Downloading amd64/CHECKSUMS: 100% Downloading amd64/CHECKSUMS.gpg: 100% Importing kernel-ppa gpg key ok Signature of checksum file has been successfully verified Checksums of deb files have been successfully verified with sha256sum Installing 4 packages Cleaning up work folder
Install Specific Kernel Version (Optional)
If you wish to install any specific kernel version you can you can pass the version number you need to install.
sudo ubuntu-mainline-kernel.sh -I v6.3.7
Reboot the System
After successfully installing the kernel packages, you must reboot your system in order for the modifications to take effect for the kernel version to be updated.
To restart your computer, run the following command:
sudo reboot
Verify Kernel Version Update
To determine the installed kernel version on Ubuntu 22.04, run the following command:
sudo ubuntu-mainline-kernel.sh -l Output v6.3.7-060307 cat /proc/version Output Linux version 6.3.7-060307-generic (kernel@kathleen) (x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1) 12.3.0, GNU ld (GNU Binutils for Ubuntu) 2.40) #202306090936 SMP PREEMPT_DYNAMIC Fri Jun 9 09:47:18 UTC 2023
Now you have the latest version of kernel updated in your Ubuntu 22.04.
Also read: You might also find useful our guide on How to Add Users to Sudoers in Linux
Conclusion
To summarize, upgrading the Linux kernel in Ubuntu is a simple process that provides various benefits such as faster performance, increased security, and access to the most recent features. Ubuntu users may easily stay up to date with the latest kernel versions and enjoy a more streamlined and secure operating system by following the appropriate steps.
Please feel free to share your thoughts and feedback in the comment section below.
How to Upgrade Linux Kernel in Ubuntu