39

I want to update my Kernel to the latest stable version which is v5.16.1

I followed a guide which showed how to install kernel 5.16. Everything went fine until I received this error:

dpkg: dependency problems prevent configuration of linux-headers-5.16.1-051601-generic:
 linux-headers-5.16.1-851601-generic depends on libc6 (>= 2.34); however:
  Version of libc6:amd64 on system is 2.31-8ubuntu9.2. 
 linux-headers-5.16.1-851601-generic depends on libssl3 (>= 3.8.0--alphal); however:
  Package libssl3 is not installed. 
  
dpkg: error processing package linux-headers-5.16.1-051601-generic (--install):
 dependency problems - leaving unconfigured Setting up linux-image-unsigned-5.16.1-051601-generic (5.16.1-051601.282201160933) ... 
I: /boot/vmlinuz.old is now a symlink to vmlinuz-5.13.0-27-generic 
I: /boot/initrd.img.old is now a symlink to initrd.img-5.13.0-27-generic 
I: /boot/vmlinuz is now a symlink to vmlinuz-5.16.1-051601-generic 
I: /boot/initrd.img is now a symlink to initrd.img-5.16.1-051601-generic
Setting up linux-modules-5.16.1-051601-generic (5.16.1-051601.202201160933) 
Processing triggers for linux-image-unsigned-5.16.1-051601-generic (5.16.1-051601.202201160933) 
/etc/kernel/postinst.d/initramfs-tools: 
update-initramfs: Generating /boot/initrd.img-5.16.1-851681-generic 
I: The initramfs will attempt to resume from /dev/sda2 
I: (UUID=91b5f7d6-87fe-498a-a823-88828fa8256a) 
I: Set the RESUME variable to override this. 
/etc/kernel/postinst.d/zz-update-grub: 
Sourcing file 7etc/default/grub. 
Sourcing file 7etc/default/grub.d/99_breeze-grub.cfg. 
Sourcing file 7etc/default/grub.d/init-select.cfg. Generating grub configuration file ... 
Found theme: /boot/grub/themes/breeze/theme.txt 
Found linux image: /boot/vmlinuz-5.16.1-851681-generic 
Found initrd image: /boot/initrd.img-5.16.1-051601-generic 
Found linux image: /boot/vmlinuz-5.15.15-051515-generic 
Found initrd image: /boot/initrd.img-5.15.15-851515-generic 
Found linux image: /boot/vmlinuz-5.13.8-27-generic 
Found initrd image: /boot/initrd.img-5.13.8-27-generic 
Found linux image: /boot/vmlinuz-5.11.0-46-generic 
Found initrd image: /boot/initrd.img-5.11.0-46-generic 
Found linux image: /boot/vmlinuz-5.4.0-96-generic 
Found initrd image: /boot/initrd.img-5.4.0-96-generic 
Found memtest86+ image: /boot/memtest86+.elf 
Found memtest86+ image: /boot/memtest86+.bin 
done 
Errors were encountered while processing:
 linux-headers-5.16.1-051681-generic 

What are the dependencies and why are not they installed automatically while updating the kernel? I need a step by step guide to update the kernel to the latest one. Please help. I watched many youtube videos and they didn't have this error even after following the exact same steps.

I didn't get any satisfactory answers to this problem, please help me. My os is fully up-to-date. I'm new to linux and I can't use linux because of this problem because I want the latest kernel.

Hardware info:

  • OS : Kubuntu 21.10 (Currently running Kernel 5.13)
  • CPU: i3-8100
  • Storage: 250GB NVMe M.2 SSD
  • GPU : Nvidia GeForce GTX 1650
  • RAM: 8GB 2400 MHz
2
  • 4
    Hi. Please be aware that running mainline kernels is targeted towards testing. You haven't explained "why" you want the latest kernel. All Ubuntu kernels are updated with relevant security patches, so just running the latest "because it's the latest" is not really an explanation. Commented Jan 20, 2022 at 9:20
  • 3
    Please don't include screenshots of text; they aren't searchable, and can't be read by people with certain limitations. Copy/paste the text from the terminal into your question.
    – marcelm
    Commented Jan 20, 2022 at 18:02

5 Answers 5

40

NOTE: Make sure to disable secure boot from BIOS settings before proceeding. If you don't want to disable Secure Boot, you've to manually sign the kernel. This answer may help.

NOTE: Kernels installed from outside the main Ubuntu repositories may not be supported, and don't get security updates. If you ask for further help, you may be told to revert to a supported kernel.

A few points to note:

  • The kernel you want to install is 5.16.1 whereas the tutorial you're following shows the method to install 5.16.

  • 5.16 is a mainline kernel.

  • Ubuntu uses the latest stable LTS kernel instead of the latest stable kernel.

  • You should not upgrade your kernel manually unless you want some specific driver support.

  • As of Jan 20, 2022, there is no easy way to install 5.16.1 except compiling from the source. You can get the Tarball from its official website (direct link). Compiling is easy but installing dependencies and configuring installation is hard. You'll more likely face errors.

  • Manual kernel installations do not upgrade automatically with apt upgrade. You need to manually upgrade them each time or use the script mentioned below in this answer.

Fixing the installation issue

It's because of a dependency issue, running a force install will fix it:

sudo apt -f install

Preferably, you can use aptitude for a better result:

sudo aptitude -f install

Alternative way to install kernel 5.16

Alternatively, running the below commands will also install the kernel v5.16:

cd ~/Downloads 

wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.16/amd64/linux-headers-5.16.0-051600_5.16.0-051600.202201092355_all.deb
wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.16/amd64/linux-headers-5.16.0-051600-generic_5.16.0-051600.202201092355_amd64.deb
wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.16/amd64/linux-image-unsigned-5.16.0-051600-generic_5.16.0-051600.202201092355_amd64.deb
wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.16/amd64/linux-modules-5.16.0-051600-generic_5.16.0-051600.202201092355_amd64.deb

sudo dpkg -i *.deb
sudo apt -f install

Installing the latest kernel.

The title says that you want to install the latest kernel, you can use an automated script to install the latest kernel:

  1. Install the shell script which automatically checks and install the latest kernel:

    wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh
    sudo install ubuntu-mainline-kernel.sh /usr/local/bin/
    
  2. Run the shell script:

    sudo ubuntu-mainline-kernel.sh -c     
    
  3. Install the latest stable kernel:

    sudo ubuntu-mainline-kernel.sh -i
    
  4. Press Y to accept the installation.

  5. Reboot to boot into the latest kernel:

    sudo reboot      
    

for the future, if you'd like to recheck and reinstall the latest stable kernel, you can simply run:

sudo ubuntu-mainline-kernel.sh -i

Note: You can check the kernel you are using, using the following command:

uname -r
9
  • 1
    Thanks, it solved my issue. You just gave me exact step by step guide. Thank you. Commented Jan 20, 2022 at 9:43
  • Hey is there any way to remove the older kernels? Because now I've got many kernels installed in my grub menu. @Someone Commented Jan 20, 2022 at 9:55
  • 2
    @SifatUllah sudo apt autoremove should remove them. You can also manually remove them using sudo apt remove
    – Error404
    Commented Jan 20, 2022 at 10:00
  • 1
    @JosephGarvin There are many PPAs for newer kernels, but most of them would just fail or cause some or another error while downloading the packages (from my experience). They may harm the package manager. So, installing from the script is much more secure. Further more, the kernel installed from this script won't be automatically deleted, so any update won't effect it in any way. But still, it's quite dangerous to update kernel before the official update. Also, if you are following my answer, make sure you have a backup and at least some knowledge about APT and Ubuntu.
    – Error404
    Commented Jul 20, 2022 at 9:46
  • 1
    Oneliner : wget -c -- $(curl -s https://kernel.ubuntu.com/\~kernel-ppa/mainline/v${VER}/amd64/ | sed 's/"\|>\|</\n/g' | grep deb | uniq | while read line; do echo "https://kernel.ubuntu.com/~kernel-ppa/mainline/v${VER}/amd64/${line}";done); dpkg -i linux*${VER}*.deb . Remember to set VER=6.3 .
    – Tejas Kale
    Commented May 2, 2023 at 22:34
3

I found next script, which automates kernel installations:

wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh
sudo chmod a+x ubuntu-mainline-kernel.sh
sudo install ubuntu-mainline-kernel.sh /usr/local/bin
sudo ubuntu-mainline-kernel.sh -i

NOTICE: These are mainline kernels, which are not the default Ubuntu kernels.

1
  • @ArturMeinild: Done Commented Sep 6, 2023 at 15:15
2

Install mainline kernel package which is a sweet gui. Worked perfectly for me. Saved me time and effort having to do it manually. Updating to 6.3 fixed my wifi driver and tethering! Great work guys!

sudo add-apt-repository ppa:cappelikan/ppa
sudo apt update
sudo apt install mainline
1
  • 1
    4. mainline check
    – Vitalicus
    Commented Dec 28, 2023 at 21:01
1

Practical Way = Install Ubuntu 22.10
Ubuntu 22.10 using KERNEL = 5.19
https://cdimage.ubuntu.com/daily-live/pending/
or
INSTALL Linux Kernel 5.19 to Ubuntu 22.04 LTS
Kernel 5.19 more better and faster than Kernel 5.15
Download Kernel 5.19 =

wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.19/amd64/linux-headers-5.19.0-051900_5.19.0-051900.202207312230_all.deb
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.19/amd64/linux-headers-5.19.0-051900-generic_5.19.0-051900.202207312230_amd64.deb
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.19/amd64/linux-image-unsigned-5.19.0-051900-generic_5.19.0-051900.202207312230_amd64.deb
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.19/amd64/linux-modules-5.19.0-051900-generic_5.19.0-051900.202207312230_amd64.deb

Source = https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.19/
Now, Install All =

sudo apt install ./linux-headers-5.19.0*.deb ./linux-image-unsigned-5.19.0*.deb ./linux-modules-5.19.0*.deb

Check Kernel Version =

uname -r

Output New Kernel 5.19 =
5.19.0-051900-generic
Now, Restart your Computer

REMOVE Kernel 5.15 from Ubuntu 22.04 LTS =

sudo apt purge linux-headers-5.15.0* linux-modules-5.15.0* linux-image-unsigned-5.15.0*

sudo apt autoremove
3
  • this solution did not work for me
    – alper
    Commented May 3, 2023 at 6:57
  • @ISRAEL The linux-generic-hwe-22.04 meta package now installs kernel v5.19 : shell $ dpkg -s linux-generic-hwe-22.04 | grep 5.19 Source: linux-meta-hwe-5.19 Version: 5.19.0.46.47~22.04.21 Provides: kernel-testing--linux-hwe-5.19--full--generic, kernel-testing--linux-hwe-5.19--full--preferred Depends: linux-image-generic-hwe-22.04 (= 5.19.0.46.47~22.04.21), linux-headers-generic-hwe-22.04 (= 5.19.0.46.47~22.04.21)
    – SebMa
    Commented Jul 1, 2023 at 10:28
  • Except, on my machine, for some reason the 5.19 kernel update caused it to be non-bootable. I actually tried this two different times. Reverted to 5.15 series, it's all I need until next *buntu LTS stable release: 22.04.3 which should work fine. (Or wait for 24.04.1 I suppose!) Commented Aug 5, 2023 at 17:24
1

You can also update via the command line by running sudo apt update && sudo apt full-upgrade or sudo apt dist-upgrade.

If you don’t want to install all pending updates, run sudo apt install linux-image-generic-hwe-22.04 to pull it in.

1
  • OP is not using 22.04.
    – Raptor
    Commented Apr 9 at 2:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .