5

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
unknown
  • 89
  • 1
  • 3
  • 8
  • 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). – N0rbert Sep 27 '21 at 13:34
  • My question is more on how to install specific kernel version using apt package manager. – unknown Sep 27 '21 at 13:35
  • Please add output of `ls /boot` and `uname -r` to the question. – N0rbert Sep 27 '21 at 13:37
  • added output of ls /boot and uname -r – unknown Sep 27 '21 at 13:40
  • 1
    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. – user535733 Sep 27 '21 at 14:04

1 Answers1

5

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:

N0rbert
  • 97,162
  • 34
  • 239
  • 423
  • 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 Sep 27 '21 at 13:44
  • 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. – unknown Sep 27 '21 at 13:50
  • 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 . – N0rbert Sep 27 '21 at 14:00
  • 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. – unknown Sep 27 '21 at 14:12
  • 2
    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. – N0rbert Sep 27 '21 at 14:15
  • 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. – Champ Jan 26 '22 at 21:45