Install Latest Linux Kernel on Ubuntu: 2 Ways
In this article
Installing the latest Linux kernel on Ubuntu gives you newer hardware support, better performance, and security fixes before the default repositories catch up. You can do it in two reliable ways: using the official Ubuntu Mainline Kernel Installer (a PPA script) or manually downloading and installing the kernel packages from the Ubuntu kernel archive. Both work on standard Ubuntu desktop and server editions. Before you start, back up your important data and ensure you have a stable internet connection. Also, note that the latest mainline kernel is not always the most stable for production—consider testing it on a non-critical machine first.
What You'll Need
- A Ubuntu system (desktop or server) with sudo access.
- An internet connection to download the kernel packages.
- Basic comfort with the terminal (commands are provided).
- Optional: a backup or snapshot of your system before proceeding.
Step-by-Step
Below are two methods. Method 1 is easier and recommended for most users; Method 2 gives you more control but requires manual package selection.
Method 1: Using the Ubuntu Mainline Kernel Installer (PPA)
- Open a terminal (Ctrl+Alt+T).
- Add the PPA that hosts the installer script:
sudo add-apt-repository ppa:cappelikan/ppa
Press Enter when prompted. - Update your package list:
sudo apt update - Install the mainline kernel installer:
sudo apt install mainline - Launch the graphical tool from the terminal or application menu:
mainline
The tool will show a list of available mainline kernels (these are official kernels built by the Ubuntu kernel team). - Select the latest kernel version you want (usually the highest number) and click Install.
- Enter your password when prompted. The tool will download and install the kernel packages automatically.
- Reboot your system:
sudo reboot - After reboot, verify the kernel version:
uname -r— you should see the new version.
Method 2: Manual Download and Install from the Ubuntu Kernel Archive
- Open a web browser and go to the official Ubuntu mainline kernel archive:
https://kernel.ubuntu.com/mainline/(orhttps://kernel.ubuntu.com/~kernel-ppa/mainline/if the first redirects). - Find the latest kernel version folder (e.g.,
v6.8.2) and click into it. If you are on an amd64 system (most common), look for files ending withall.debandamd64.deb. For ARM64 (e.g., Raspberry Pi), look forarm64.debfiles. - Download the following four files (for amd64):
linux-headers-<version>-all.deblinux-headers-<version>-generic_<version>_amd64.deblinux-image-unsigned-<version>-generic_<version>_amd64.deblinux-modules-<version>-generic_<version>_amd64.deb
- Open a terminal and navigate to your Downloads folder:
cd ~/Downloads - Install all downloaded .deb files together with:
sudo dpkg -i *.deb
If you get dependency errors, runsudo apt -f installto fix them. - Reboot your system:
sudo reboot - Verify the new kernel with
uname -r.
Common Mistakes
- Installing the wrong architecture: Make sure you download amd64 packages for 64-bit Intel/AMD, not arm64 or i386.
- Skipping the headers: If you plan to compile external kernel modules (like VirtualBox or NVIDIA drivers), you need the headers packages.
- Forgetting Secure Boot: If Secure Boot is enabled, you may need to sign the kernel or use the signed packages. The mainline installer usually handles this, but manual installation may require you to disable Secure Boot or enroll a key.
- Not updating GRUB: In most cases,
dpkgautomatically updates GRUB, but if you manually move files, you might need to runsudo update-grub.
Tips
- Always keep at least one known-good kernel installed (the default Ubuntu kernel) so you can boot into it if the new one fails.
- Use the mainline installer (Method 1) for simplicity—it also lets you remove old kernels easily.
- After installing a new kernel, test hardware (Wi-Fi, graphics, audio) thoroughly before relying on it for daily work.
- If you use proprietary drivers (NVIDIA, etc.), reinstall them after a kernel update:
sudo apt install --reinstall nvidia-driver-<version>(replace with your driver version).
Troubleshooting
If the system fails to boot after installing the new kernel: Restart and hold Shift (or Esc) to open the GRUB menu. Select “Advanced options for Ubuntu” and choose the previous kernel from the list. Boot into that, then remove the problematic kernel using the mainline tool or sudo apt remove linux-image-<version>.
If you get dependency errors during manual installation: Run sudo apt --fix-broken install to resolve missing dependencies, then try sudo dpkg --configure -a.
If the mainline tool shows no kernels: Make sure you have an internet connection and that the PPA is correctly added. Try sudo apt update again.
If Wi-Fi stops working after the update: The new kernel may lack the driver for your wireless card. Boot back to the old kernel and check if a proprietary driver is available in “Additional Drivers” (Software & Updates).
If you get a “Secure Boot violation” error: Disable Secure Boot in your BIOS/UEFI settings, or use the signed kernel packages from the Ubuntu archive (look for files with “signed” in the name).
Frequently Asked Questions
Is the latest mainline kernel safe for production?
Not necessarily. Mainline kernels are released for testing and may not have been fully validated for Ubuntu. For production, stick to the kernel in Ubuntu's official repositories (e.g., HWE kernels).
Will my proprietary drivers work with the latest kernel?
Possibly not immediately. NVIDIA and other proprietary drivers may need updates to support new kernels. Check the driver's release notes before upgrading.
Can I go back to the previous kernel?
Yes. GRUB keeps old kernels available. You can select the previous one at boot, and you can remove the new kernel using sudo apt remove linux-image-<version>.
How do I know which kernel version is the latest?
Check the Ubuntu mainline archive or the kernel.org website. The mainline installer also shows the latest available version.
Does installing a new kernel affect my installed applications?
No, applications are independent of the kernel version. However, kernel modules (like drivers) may need to be recompiled or reinstalled.
Can I install a mainline kernel on Ubuntu LTS?
Yes, but be aware that mainline kernels are not supported by Ubuntu's security team. If you need long-term stability, stick with the LTS kernel.