Score:3

How to update kernel to specific version

eg flag

I would like to upgrade to specific kernel version (5.4.0-81-generic) from following current state on different servers. I would like to use apt package manger to update kernel.

Ubuntu 18.04.3 LTS  4.15.0-55-generic
Ubuntu 18.04 LTS    4.15.0-51-generic
Ubuntu 18.04 LTS    4.15.0-20-generic
Ubuntu 18.04 LTS    4.15.0-106-generic
Ubuntu 18.04 LTS    4.15.0-133-generic
Ubuntu 18.04 LTS    4.15.0-140-generic
Ubuntu 18.04 LTS    4.15.0-107-generic
Ubuntu 18.04.4 LTS  5.4.0-74-generic
Ubuntu 18.04.4 LTS  5.4.0-77-generic

ls /boot
config-4.15.0-76-generic  grub                          initrd.img-5.4.0-70-generic   System.map-5.4.0-70-generic  vmlinuz-5.4.0-70-generic
config-5.4.0-70-generic   initrd.img-4.15.0-76-generic  System.map-4.15.0-76-generic  vmlinuz-4.15.0-76-generic

uname -r
5.4.0-70-generic

I get following 2 images when try to search for kernel version, which one to use.

apt-cache search linux-image | grep 5.4.0-81-generic
linux-image-5.4.0-81-generic - Signed kernel image generic
linux-image-unsigned-5.4.0-81-generic - Linux kernel image for version 5.4.0 on 64 bit x86 SMP

Now, how to safely, gracefully update only the kernel version -

apt-get upgrade linux-image-5.4.0-81-generic
N0rbert avatar
zw flag
Does this answer your question? [How do I restore the default repositories?](https://askubuntu.com/questions/124017/how-do-i-restore-the-default-repositories) It is already in [official repositories](https://packages.ubuntu.com/source/bionic-updates/linux-signed-hwe-5.4). To keep your system secure you have to install security upgrades (not just only kernel).
unknown avatar
eg flag
My question is more on how to install specific kernel version using apt package manager.
N0rbert avatar
zw flag
Please add output of `ls /boot` and `uname -r` to the question.
unknown avatar
eg flag
added output of ls /boot and uname -r
user535733 avatar
cn flag
You question should clearly explain exactly why you want a specific older kernel. It can be done, but it's a corner case. The explanation will help dissuade new users (the main frequenters of this site) from erroneously downgrading their kernels.
Score:5
zw flag

Warning: doing things below is dangerous if you care about system security. Proceed only if you are sure what do you want to achieve.

So you have to remove meta-package (it usually depends on the latest kernel, nowadays it is 5.4.0-86 in this HWE stack) by

sudo apt-get update
sudo apt-get remove linux-image-generic-hwe-18.04
sudo apt-get autoremove

and then install fixed version by

sudo apt-get install linux-image-5.4.0-81-generic

But please again note that latest kernel is safer, it may have many CVEs fixed. Check changelog for details.

So to get all latest upgrades back you have to execute the following commands:

sudo apt-get update
sudo apt-get install --install-recommends linux-generic-hwe-18.04  
sudo apt-get dist-upgrade # to get all latest dependencies

and then reboot to use all latest software including the kernel.


More stuff to read:

unknown avatar
eg flag
Could you please let me know where did you find ` linux-image-generic-hwe-18.04 ` and what it is and why it is to be removed.
unknown avatar
eg flag
I was looking at https://wiki.debian.org/HowToUpgradeKernel which didn't say anything to be removed. what's the significance of removing meta-package, please let me know.
N0rbert avatar
zw flag
Packages like linux-image-5.4.0-81-generic are dynamic dependencies of linux-image-generic-hwe-18.04 . Current is 5.4.0-86 .
unknown avatar
eg flag
Isn't my current kernel is '5.4.0-70-generic' as per uname -r command output and how is it related to removing met-package 'linux-image-generic-hwe-18.04' will remove my old package.
N0rbert avatar
zw flag
You have to understand dpkg/APT internals more carefully. Please read the relevant docs. Then execute `apt-cache rdepends linux-image-5.4.0-70-generic` to understand the relations between it and `linux-image-generic-hwe-18.04` package. You have to learn tools and system before doing strange things, IMHO.
cn flag
Thank you for the answer. I followed the steps and successfully installed 5.10 and 5.13.19 kernels on 18.04.6 LTS. I used mainline to install these kernels.
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.