Score:3

How Do I update my kernel to the latest one?

cn flag

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 in showed in this image:

Error Log

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
Artur Meinild avatar
vn flag
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.
marcelm avatar
cn flag
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.
Score:6
my flag

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.

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
Michel Rummens avatar
id flag
Script worked like a charm! Cheers :)
Tejas Kale avatar
cn flag
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` .
Sifat Ullah avatar
cn flag
Thanks, it solved my issue. You just gave me exact step by step guide. Thank you.
Sifat Ullah avatar
cn flag
Hey is there any way to remove the older kernels? Because now I've got many kernels installed in my grub menu. @Someone
Someone avatar
my flag
@SifatUllah `sudo apt autoremove` should remove them. You can also manually remove them using `sudo apt remove`
GorillaApe avatar
cn flag
I tried the method from kernel.ubuntu.com but during boot I get an error that it is not signed
Someone avatar
my flag
@GorillaApe See the Edited part i.e Note on the above of the answer.
Score:1
ar flag

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
Score:1
in flag

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
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.