How to Update Kernel Version for Optimal Performance?

Learn how to safely update your kernel version with this simple guide. Enhance security, improve performance, and unlock new features.

Updated: 26 Aug, 24 by Lisa P 13 Min

List of content you will read in this article:

The kernel is like the brain of your Linux system. It`s free and anyone can use it. The main function of the Kernel is connecting software to hardware, that`s why it is so important for computers to run smoothly. Kernel often sticks to its older version, but if you want to see better performance and security, you should update it to the newest version. You don`t know how to update Kernel version? don`t stress! In this blog post, we explore the easiest methods for updating it. So, stay with us till the end. 

The Kernel is like your computer`s boss, the only one who makes sure everything runs efficiently. Now imagine over time, new updates come and can make it smarter, faster, safer, and better at handling new stuff like fancy graphics cards or super-fast internet. In this situation, what happens if you stick to the latest versions? You will lose all these new and useful features. So, you should give your computer a regular checkup to keep it in top shape. In this way, you train the boss of your computer to use the greatest and newest tools for boosting production. Now that you know how much is it important, let`s see how to update kernel version with different methods. 

  • A Linux computer: This can be a desktop, laptop, or server.
  • Superuser abilities: You should be able to perform administrative tasks, thus you will require a user account with "sudo" rights.
  • A terminal: It is where you'll enter commands to get things done. It's like communicating with your computer via code.
  • The right tool: This is already incorporated into Linux and allows you to install and update software. 
  • The Update Manager (optional): This is another utility included with Ubuntu that can help you update stuff, but it is not necessarily required. 

How to Update Kernel Version with different methods

You already realize why updating your kernel is essential. Now let's get into how to do it. There are several ways to upgrade your Ubuntu kernel, ranging from simple to more sophisticated. This guide will explore five different ways, letting you choose the one that works best for you.

Using the Command Line (For Advanced Users)

Are you comfortable with the command line? So, you can download the latest kernel packages directly and install them using `dpkg`. This method gives you more control over the installation process. 

Download the Latest Kernel Package

  1. Go to the Mainline kernel index page.
  2. Locate the most recent kernel version. It's usually listed at the bottom of the directory.
  3. Download the appropriate DEB package for your system's architecture.

Step 2: Install the Linux Kernel

Once the download is complete, open your terminal and go to the download directory. Using this command, install the kernel package:

   sudo dpkg -i linux-headers*.deb

Now, you should list the kernel files to verify the installation:

   ls -l

Step 3: Reboot Your System

After the installation, you need to reboot your computer. You can check the new kernel version using:

   uname -r

   Ubuntu typically boots into the newest kernel by default.

Note: This method is suitable for people who have more technical knowledge than the GUI-based approach. When manually installing kernel packages, take caution, as false installations can cause system instability.

Using a GUI Tool (The easiest way)

This is the easiest way to update your kernel version. Using this simple tool, you can easily update your kernel. Before we begin, you should know that the most recent kernel is the "mainline kernel." We'll use a tool to get the most recent one for you. 

Step 1: Update the packages of your system 

As a standard practice, it's recommended to update your system before undertaking any modifications. Open a terminal window (CTRL+ALT+T) and run the following command:

sudo apt update

All your packages should now be updated.

Step 2: Verify Current Kernel Version

To determine your current kernel version, run the following command:

uname -r

Now you can see the installed kernel version number in the output. This is necessary to select the appropriate next kernel option based on your system's configuration.

Step 3: Add the cappelikan PPA 

To install the Ubuntu Mainline Kernel Installer on your machine, add the cappelikan PPA with the following command:

sudo add-apt-repository ppa:cappelikan/ppa --y

This procedure will add the repository and then update your system packages to reflect the changes.

Step 4: Install Ubuntu Mainline Kernel Installer

You are now prepared to install the Ubuntu Mainline Kernel Installer by running the command below:

sudo apt install mainline -y

Step 5: Upgrade Ubuntu Linux Kernel

Start the application from your menu after installation to begin the Ubuntu kernel upgrade. Before installing the new kernel, delete the existing kernel by clicking the "Uninstall Old" button on the right side of the installer screen.

Type Y/N in the confirmation window and press Enter to confirm your decision. You will be requested to provide your sudo password to complete the operation. Choose your kernel version and click "Install."

The kernel installation process can take some time. Please be wait. Once finished, shut the Ubuntu Mainline Kernel Installer terminal window.

Step 6: Reboot Your System

To check the status of your new kernel, restart the Ubuntu Mainline Kernel Installer. The installed kernel version should appear as newer than the version retrieved in step 2. When ready, reboot your system as directed in the previous step. To use the modified configurations, restart your computer with the following command:

sudo reboot.

After the system reboots, run the 'uname -r' command again to confirm the version number. The output should now show the newly installed kernel version.

Using the System Update Process (Safest Way)

This is one of the safest ways to update your Linux kernel. All you need to do is the following simple steps:

  1. To determine your current kernel version, open a terminal and run:

uname -sr

  1. Update your local package lists to reflect available updates:

sudo apt update

This command checks for newer versions of installed packages and notifies you of any available updates.

  1. Install the Linux Kernel upgrade to perform a system-wide upgrade. Do this with the following command:

sudo apt full-upgrade

This command will automatically update your entire system, including the kernel. As a result, you ensure everything works together correctly.

Note: as we mentioned before, this method is safe. But still, you should back up important data before performing any system updates, and there`s no exception for this method. 

Update Ubuntu Kernel Using apt

Using the `apt` package manager is a good method for managing software on Ubuntu. It allows you to install, upgrade, and remove packages, including the kernel. To use this method, follow these steps:

  1. First of all, check your current kernel version:

uname -r

This command displays the currently running kernel version. For example, the output might be `6.4.16-33-generic`.

  1. update the list of available packages on your system:

sudo apt update

This ensures `apt` has access to the latest package information, including any new kernel versions.

  1. Now, use `apt upgrade` to upgrade all packages with available updates:

sudo apt upgrade

If a newer kernel version is available, `apt` will include it in the upgrade process. 

  1. The terminal might ask for your confirmation before proceeding. Type `y` and press Enter to confirm.
  2. The upgrade process will download and install the updates. Once finished, check the new kernel version:

uname -r

The output should now show a newer kernel version, indicating a successful upgrade.

Note: While this method is simpler, it can`t always upgrade to the most recent kernel version. Updates are often tested for stability before becoming generally available.

do-release-upgrade (updates the entire version)

Note: This method upgrades your entire Ubuntu version, not just the kernel. Back up your important data before starting.

The Software Updater doesn't show a new release available? In this way, you can attempt a full system upgrade using the do-release-upgrade command. You only need to follow these steps:

Open a terminal and run:

sudo do-release-upgrade

This command checks for a new Ubuntu release. If a newer version is available, you'll see detailed information about the release, including:

  • Release codename and version number
  • Release notes URL
  • General information about Ubuntu

If you feel comfortable updating to the new version, hit y and press Enter to proceed. The update process will download and install the required packages, including the most recent kernel.

Post-Upgrade

Once the upgrade finishes, your system will run the most recent Ubuntu version with a suitable kernel. Remember to restart your computer so the modifications take effect.

Notes:

  1. This procedure is appropriate for upgrading to the next Long Term Support (LTS) release.
  2. Upgrading to non-LTS releases is not recommended for production situations due to shorter support cycles.
  3. Always consult the official Ubuntu release notes for complete information on new features and potential upgrading options.

Emergency Kernel Installation (Last Resort)

Warning: Before performing this method, always back up your data because this method is risky and only can be used by advanced users. This way forces a kernel upgrade no matter if it's not officially supported by your Ubuntu version. Don`t forget that you should use this approach with caution.

Step 1: Enable Kernel Updates

  1. Open the Software Updater.
  2. Go to Settings and then the Updates tab.
  3. Check all three options under "Install updates from" including Important security updates, Recommended updates, and Unsupported updates. 
  4. In the "Notify me of a new Ubuntu version" dropdown, select "For any new version."

Step 2: Force the Upgrade

  1. Open a terminal and run the following command:

   update-manager -d

  1. Review the release notes for the new kernel.
  2. If you're comfortable with the changes, click "Upgrade."

Manual Kernel Installation (Extremely Risky)

Warning: This is our responsibility to explain different methods as well as give you the necessary warnings. Installing a kernel manually can render your system unusable and it is very dangerous due to the high chance of encountering compatibility issues, system instability, or data loss. Only use this method if you fully consider all of these risks and have a complete system backup. 

  1. Install Ukuu:

   sudo apt-add-repository ppa:teejee2008/ppa

   sudo apt update

   sudo apt install ukuu

  1. Launch Ukuu:

   sudo ukuu-gtk

  1. Select and install the desired kernel.
  2. Reboot your system.

Note: Before starting to remove the updated kernel version, back up your important files as it can cause system instability if not done correctly. 

Sometimes you may face issues with a newly installed kernel. In this way, you need to back to the previous version. but how? Here we tell you: 

Step 1: Boot into an Older Kernel

  1. Restart your computer and access the GRUB boot menu (often by pressing Shift during boot).
  2. Select the "Advanced options for Ubuntu" entry.
  3. Choose a previous kernel version from the list.

Step 2: Remove the Problematic Kernel

Once booted into the older kernel, open a terminal and run the following commands to remove the unwanted kernel packages. Instead of `*`, use the version number of the kernel you want to remove. 

sudo apt remove linux-headers-*

sudo apt remove linux-image-*

sudo apt remove linux-modules-*

Example

sudo apt remove linux-headers-5.15.0-52-generic linux-image-5.15.0-52-generic linux-modules-5.15.0-52-generic

Step 3: Update GRUB

To ensure the removed kernel doesn't appear in the boot menu, you might need to update GRUB using this command:

sudo update-grub

Notes:

  • The removal of the kernel may have an impact on other software, depending on their dependencies.
  • Before removing a package, always use commands like 'dpkg -l | grep linux' to double-check its exact name.
  • Use a package manager like 'synaptic' for a more visible way to handle installed packages.

Conclusion

In this guide, we tried to outline different methods for how to update kernel version. Each methods cater different levels of user experience and comfort with the command line. Before choosing a method, consider your knowledge, are you comfortable with a simple graphical interface or do you have a deep understanding of system administration? No matter, just perform a method with caution and ensure backing up your data. Don`t forget that manual kernel installations are risky.

 

Lisa P

Lisa P

Hello, everyone, my name is Lisa. I'm a passionate electrical engineering student with a keen interest in technology. I'm fascinated by the intersection of engineering principles and technological advancements, and I'm eager to contribute to the field by applying my knowledge and skills to solve real-world problems.

user monovm

Wade Larson III

2024, Sep, 24

Wow, what a comprehensive guide! Updating the kernel can seem daunting, but you've broken it down brilliantly. The section on prerequisites is super helpful for beginners, and I appreciate the detailed steps for each method, especially the GUI tool and the command line options. The warnings and notes about backing up data are spot on. Excellent work making a complex process accessible and easy to follow. Thanks for sharing!