Home Linux Kernel Different Ways To Update Linux Kernel For Ubuntu

Different Ways To Update Linux Kernel For Ubuntu

By sk
Published: Last Updated on 21K views

In this guide, we will learn 7 different ways to update Linux kernel for Ubuntu operating systems. Among the 7 methods, five methods requires system reboot to apply the new Kernel and two methods don't.

Before updating Linux Kernel, it is highly recommended to backup your important data!

All methods mentioned here are tested on Ubuntu OS only. We are not sure if they will work on other Ubuntu flavors (Eg. Xubuntu) and Ubuntu derivatives (Eg. Linux Mint).

Part A – Linux Kernel Updates with reboot

The following methods requires you to reboot your system to apply the new Linux Kernel. All of the following methods are recommended for personal or testing systems.

Again, please backup your important data, configuration files and any other important stuff from your Ubuntu system.

Method 1 - Update Linux Kernel for Ubuntu with dpkg (The manual way)

This method helps you to manually download and install the latest available Linux kernel from kernel.ubuntu.com website. If you want to install most recent version (either stable or release candidate), this method will help.

Download the Linux kernel version from the above link. As of writing this guide, the latest available version was 5.0-rc1 and latest stable version was v4.20.

Download Linux kernel

Click on the Linux Kernel version link of your choice and find the section for your architecture (‘Build for XXX’). In that section, download the two files with these patterns (where X.Y.Z is the highest version):

  1. linux-image-*X.Y.Z*-generic-*.deb
  2. linux-modules-X.Y.Z*-generic-*.deb

In a terminal, change directory to where the files are and run this command to manually install the kernel:

$ sudo dpkg --install *.deb

Reboot to use the new kernel:

$ sudo reboot

Check the kernel is as expected:

$ uname -r

For step by step instructions, please check the section titled under "Install Linux Kernel 4.15 LTS On DEB based systems" in the following guide.

The above guide is specifically written for 4.15 version. However, all the steps are same for installing latest versions too.

Pros: No internet needed (You can download the Linux Kernel from any system).

Cons: Manual update. Reboot necessary.

Method 2 - Update Linux Kernel for Ubuntu with apt-get (The recommended method)

This is the recommended way to install latest Linux kernel on Ubuntu-like systems. Unlike the previous method, this method will download and install latest Kernel version from Ubuntu official repositories instead of  kernel.ubuntu.com website..

To update the whole system including the Kernel, just do:

$ sudo apt-get update
$ sudo apt-get upgrade

If you want to update the Kernel only, run:

$ sudo apt-get upgrade linux-image-generic

Pros: Simple. Recommended method.

Cons: Internet necessary. Reboot necessary.

Updating Kernel from official repositories will mostly work out of the box without any problems. If it is the production system, this is the recommended way to update the Kernel.

Method 1 and 2 requires user intervention to update Linux Kernels. The following methods (3, 4 & 5) are mostly automated.

Method 3 - Update the Linux Kernel with Ukuu

Ukuu is a Gtk GUI and command line tool that downloads the latest main line Linux kernel from kernel.ubuntu.com, and install it automatically in your Ubuntu desktop and server editions.

Ukku is not only simplifies the process of manually downloading and installing new Kernels, but also helps you to safely remove the old and unnecessary Kernels. For more details, refer the following guide.

Pros: Easy to install and use. Automatically installs main line Kernel.

Cons: Internet necessary. Reboot necessary.

Method 4 - Update the Linux Kernel with UKTools

Just like Ukuu, the UKTools also fetches the latest stable Kernel from from kernel.ubuntu.com site and installs it automatically on Ubuntu and its derivatives like Linux Mint. More details about UKTools can be found in the link given below.

Pros: Simple. Automated.

Cons: Internet necessary. Reboot necessary.

Method 5 - Update the Linux Kernel with Linux Kernel Utilities

Linux Kernel Utilities is yet another program that makes the process of updating Linux kernel easy in Ubuntu-like systems. It is actually a set of BASH shell scripts used to compile and/or update latest Linux kernels for Debian and derivatives.

It consists of three utilities, one for manually compiling and installing Kernel from source from http://www.kernel.org website, another for downloading and installing pre-compiled Kernels from from https://kernel.ubuntu.com website. and third script is for removing the old kernels.

For more details, please have a look at the following link.

Pros: Simple. Automated.

Cons: Internet necessary. Reboot necessary.

Part B – Linux Kernel Updates without reboot

As I already said, all of above methods need you to reboot the server before the new kernel is active. If they are personal systems or testing machines, you could simply reboot and start using the new Kernel.

But, what if they are production systems that requires zero downtime? No problem. This is where Livepatching comes in handy!

The livepatching (or hot patching) allows you to  install Linux updates or patches without rebooting, keeping your server at the latest security level, without any downtime.

This is attractive for ‘always-on’ servers, such as web hosts, gaming servers, in fact, any situation where the server needs to stay on all the time.

Linux vendors maintain patches only for security fixes, so this approach is best when security is your main concern.

The following two methods doesn't require system reboot and useful for updating Linux Kernel on production and mission-critical Ubuntu servers.

Method 6 - Update the Linux Kernel Canonical Livepatch Service

Canonical Livepatch Service
Canonical Livepatch Service

Canonical Livepatch Service applies Kernel updates, patches and security hotfixes automatically without rebooting the Ubuntu systems. It reduces the Ubuntu systems downtime and keep them secure.

Canonical Livepatch Service can be set up either during or after installation. If you are using desktop Ubuntu, the Software Updater will automatically check for kernel patches and notify you.

In a console-based system, it is up to you to run apt-get update regularly. It will install kernel security patches only when you run the command "apt-get upgrade", hence is semi-automatic.

Livepatch is free for three systems. If you have more than three, you need to upgrade to enterprise support solution named Ubuntu Advantage suite. This suite includes Kernel Livepatching and other services such as,

  • Extended Security Maintenance - critical security updates after Ubuntu end-of-life.
  • Landscape - the systems management tool for using Ubuntu at scale.
  • Knowledge Base - A private collection of articles and tutorials written by Ubuntu experts.
  • Phone and web-based support.

Cost

Ubuntu Advantage includes three paid plans namely, Essential, Standard and Advanced. The basic plan (Essential plan) starts from 225 USD per year for one physical node and 75 USD per year for one VPS.

It seems there is no monthly subscription for Ubuntu servers and desktops. You can view detailed information on all plans here.

Pros: Simple. Semi-automatic. No reboot necessary. Free for 3 systems.

Cons: Expensive for 4 or more hosts. No patch rollback.

Enable Canonical Livepatch Service

If you want to setup Livepatch service after installation, just do the following steps.

Get a key at https://auth.livepatch.canonical.com/.

$ sudo snap install canonical-livepatch
$ sudo canonical-livepatch enable your-key

Method 7 - Update the Linux Kernel with KernelCare

KernelCare
KernelCare

KernelCare is the newest of all the live patching solutions. It is the product of CloudLinux. KernelCare runs on Ubuntu and other flavors of Linux. It checks for patch releases every 4 hours and will install them without confirmation. Patches can be rolled back if there are problems.

Cost

Fees, per server: 4 USD per month, 45 USD per year.

Compared to Ubuntu Livepatch, kernelCare seems very cheap and affordable. Good thing is monthly subscriptions are also available.

Another notable feature is it supports other Linux distributions, such as Red Hat, CentOS, Debian, Oracle Linux, Amazon Linux and virtualization platforms like OpenVZ, Proxmox etc.

You can read all the features and benefits of KernelCare here and check all available plan details here.

Pros: Simple. Fully automated. Wide OS coverage. Patch rollback. No reboot necessary. Free license for non-profit organizations. Low cost.

Cons: Not free (except for 30 day trial).

Enable KernelCare Service

Get a 30-day trial key at https://cloudlinux.com/kernelcare-free-trial5.

Run the following commands to enable KernelCare and register the key.

$ sudo wget -qq -O - https://repo.cloudlinux.com/kernelcare/kernelcare_install.sh | bash
$ sudo /usr/bin/kcarectl --register KEY

If you're looking for an affordable and reliable commercial service to keep the Linux Kernel updated on your Linux servers, KernelCare is good to go.

with inputs from Paul A. Jacobs, a Technical Evangelist and Content Writer from Cloud Linux.

And, that's all for now. Hope this was useful. If you believe any other tools/methods should include in this list, feel free to let us know in the comment section below. I will check and update this guide accordingly.

You May Also Like

1 comment

Jim January 8, 2019 - 4:41 pm

Generally I have found it best to wait for the OS’s official kernel update. to avoid problems. I have used Ukuu when a kernel update failed to support my wireless. I did find it confusing though, there are so many kernels, and which ones to use.

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More