How To

Install the Latest Linux Kernel on Ubuntu

Ubuntu ships a conservative kernel on purpose. Each release pins a kernel version and then only backports fixes to it, which is exactly what you want on a server you never think about. But it leaves you behind when you need a driver for brand new hardware, a scheduler or filesystem change that only landed upstream, or a fix that has not been backported yet. The mainline kernel is the answer, and on Ubuntu you do not have to compile anything to get it.

Original content from computingforgeeks.com - post 16087

Canonical publishes prebuilt mainline kernels as ready-to-install .deb packages for every upstream release. You download a few files, install them, and reboot. This guide covers that prebuilt route on Ubuntu 26.04 and 24.04, including the Secure Boot catch that stops most people, and how to roll back cleanly. Every step below was run on both Ubuntu 26.04 and Ubuntu 24.04 in June 2026, installing the current mainline kernel from the official builds.

Before you begin

You need an Ubuntu 26.04 or 24.04 system you can reboot, a user with sudo, and a way to reach the GRUB menu (a console or attached keyboard) in case you need to pick the old kernel. If the box is brand new, the first steps after an Ubuntu 26.04 install are worth running before you start swapping kernels. Two things to know up front:

  • Mainline kernels are unsigned. If your machine has Secure Boot enabled, it will refuse to boot them until you turn Secure Boot off in firmware. More on this below.
  • These are upstream kernels without Ubuntu’s patches or driver backports, and they receive no security updates. They are great for testing and new hardware, but the stock Ubuntu kernel is the right choice for any production or internet-facing server.

Step 1: Check your current kernel

Note what you are running now so you can compare afterward and know which kernel to fall back to. The command to check your kernel version is the same on every distro:

uname -r

On a fresh Ubuntu 24.04 box this prints the shipped kernel, something like:

6.8.0-106-generic

Step 2: Download the mainline kernel packages

The builds live at kernel.ubuntu.com/mainline. Each release has an amd64 folder, and you need four of the generic packages from it: both header packages, the image, and the modules. Make a working directory and pull them. Replace the version in the URLs with the release you want from that page:

mkdir -p ~/mainline-kernel && cd ~/mainline-kernel
BASE="https://kernel.ubuntu.com/mainline/v7.1/amd64"
wget "${BASE}/linux-headers-7.1.0-070100_7.1.0-070100.202606141628_all.deb"
wget "${BASE}/linux-headers-7.1.0-070100-generic_7.1.0-070100.202606141628_amd64.deb"
wget "${BASE}/linux-image-unsigned-7.1.0-070100-generic_7.1.0-070100.202606141628_amd64.deb"
wget "${BASE}/linux-modules-7.1.0-070100-generic_7.1.0-070100.202606141628_amd64.deb"

The trailing number in each filename is a build timestamp that changes per release, so copy the exact names from the folder rather than typing them. Skip the lowlatency variants unless you specifically run audio or realtime workloads. Confirm all four landed:

ls -1 *.deb

You should see the four packages, the modules one being by far the largest:

linux-headers-7.1.0-070100_7.1.0-070100.202606141628_all.deb
linux-headers-7.1.0-070100-generic_7.1.0-070100.202606141628_amd64.deb
linux-image-unsigned-7.1.0-070100-generic_7.1.0-070100.202606141628_amd64.deb
linux-modules-7.1.0-070100-generic_7.1.0-070100.202606141628_amd64.deb

Step 3: Install the packages

Install all four in one go with dpkg. Order does not matter because they are in the same directory:

sudo dpkg -i *.deb

If dpkg complains about a missing dependency, let apt resolve it and finish the job:

sudo apt install -f -y

The install registers the new kernel and rebuilds the initramfs. The closing lines confirm the image package finished setting up:

Setting up linux-modules-7.1.0-070100-generic (7.1.0-070100.202606141628) ...
Setting up linux-image-unsigned-7.1.0-070100-generic (7.1.0-070100.202606141628) ...

Step 4: Update GRUB and reboot

The package install usually updates GRUB on its own, but run it explicitly so you can see the new kernel get picked up:

sudo update-grub

The new image and your existing one both appear, so a bad boot is never a dead end:

Found linux image: /boot/vmlinuz-7.1.0-070100-generic
Found initrd image: /boot/initrd.img-7.1.0-070100-generic
Found linux image: /boot/vmlinuz-6.8.0-106-generic
done

Ubuntu boots the newest kernel by default, so a plain reboot lands you on the mainline build:

sudo reboot

Step 5: Verify the new kernel

Once the system is back, check what you are running:

uname -r

It reports the mainline version, with the -070100 upload tag in place of Ubuntu’s usual ABI number:

7.1.0-070100-generic

The screenshot below is the same kernel running on Ubuntu 26.04, installed entirely from the prebuilt packages:

Terminal showing the mainline 7.1 kernel installed from .deb packages and running on Ubuntu 26.04

Removing a mainline kernel

Mainline kernels are not managed by apt updates, so you clean them up by hand when you no longer want them. First boot back into the kernel you want to keep (pick it from the GRUB menu if needed), since apt will not remove the kernel you are currently running. Then purge the four mainline packages by name, matching the version to the one you installed:

sudo apt purge linux-image-unsigned-7.1.0-070100-generic \
  linux-modules-7.1.0-070100-generic \
  linux-headers-7.1.0-070100-generic linux-headers-7.1.0-070100
sudo update-grub

That removes the image, modules, and headers in one shot and rebuilds the boot menu without them. You are back on the stock Ubuntu kernel with nothing left behind.

Troubleshooting

The system boots to a black screen or returns to the old kernel

This is almost always Secure Boot. The mainline packages are the linux-image-unsigned builds, and a machine with Secure Boot on will reject an unsigned kernel and fall back. Reboot into firmware setup (UEFI), disable Secure Boot, and try again. On a server you cannot reach physically, confirm Secure Boot state first with mokutil --sb-state before you install a mainline kernel. If you would rather keep Secure Boot on, stay on Ubuntu’s signed stock kernel.

The new kernel is installed but the old one still boots

GRUB picks the highest version by default, but if your machine still lands on the old kernel, hold Shift (BIOS) or Esc (UEFI) during boot to open the GRUB menu, then choose the mainline kernel under “Advanced options for Ubuntu”. Confirm it is present in the menu with sudo update-grub first, which lists every image it found.

A driver or DKMS module fails to build

Out-of-tree modules like the NVIDIA driver or VirtualBox need the matching headers, which is why you installed both linux-headers packages. If a DKMS build still fails, the module may not support the newer kernel yet. That is the trade with mainline: you are ahead of where third-party drivers have caught up. Booting back to the stock kernel restores the working module immediately.

If you would rather build the kernel with your own config instead of using these prebuilt packages, the steps to compile one from source are a separate job worth its own walkthrough. On Red Hat based systems the route is different again; see how to install a newer kernel on Rocky Linux and AlmaLinux. For most people, though, the prebuilt mainline packages are the fastest way onto a newer kernel on Ubuntu, and rolling back is always one reboot away.

Keep reading

Upgrade Ubuntu 24.04 to Ubuntu 26.04 LTS (Step by Step) Ubuntu Upgrade Ubuntu 24.04 to Ubuntu 26.04 LTS (Step by Step) UFW Firewall Commands with Examples on Ubuntu 24.04 / 22.04 Security UFW Firewall Commands with Examples on Ubuntu 24.04 / 22.04 Ubuntu 26.04 LTS (Resolute Raccoon): New Features, Changes, and What to Know Ubuntu Ubuntu 26.04 LTS (Resolute Raccoon): New Features, Changes, and What to Know Install PostgreSQL 19 on Ubuntu, Debian, Rocky Linux & AlmaLinux AlmaLinux Install PostgreSQL 19 on Ubuntu, Debian, Rocky Linux & AlmaLinux Install OrientDB on Ubuntu 26.04 / 24.04 / 22.04 Databases Install OrientDB on Ubuntu 26.04 / 24.04 / 22.04 How To Install Minikube on Ubuntu 24.04|22.04|20.04 Kubernetes How To Install Minikube on Ubuntu 24.04|22.04|20.04

0 thoughts on “Install the Latest Linux Kernel on Ubuntu”

  1. Mainline currently does not have amd65 .deb packages. So this won’t work for most people until the mainline kernel for amd64 is released.

    Reply
  2. excellent, I am finally able to get sound from my laptop speaker after installing latest kernel 6.10.6 on my hp envy17 on latest ubuntu cinnamon version

    Reply
  3. installed one latest kernel but still issues like

    WARNING: turbostat not found for kernel 6.10.7-061007

    You may need to install the following packages for this specific kernel:
    linux-tools-6.10.7-061007-generic
    linux-cloud-tools-6.10.7-061007-generic

    E: Unable to locate package linux-tools-6.10.7-061007-generic
    E: Couldn’t find any package by glob ‘linux-tools-6.10.7-061007-generic’

    Reply

Leave a Comment

Press ESC to close