How to update kernel to specific version
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:
-
man apt
locally or online,man apt-get
locally or online - https://wiki.ubuntu.com/Kernel/LTSEnablementStack#Ubuntu_18.04_LTS_-_Bionic_Beaver
- https://help.ubuntu.com/18.04/serverguide/package-management.html
unknown
Updated on September 18, 2022Comments
-
unknown over 1 year
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 over 2 yearsDoes this answer your question? How do I restore the default repositories? It is already in official repositories. To keep your system secure you have to install security upgrades (not just only kernel).
-
unknown over 2 yearsMy question is more on how to install specific kernel version using apt package manager.
-
N0rbert over 2 yearsPlease add output of
ls /boot
anduname -r
to the question. -
unknown over 2 yearsadded output of ls /boot and uname -r
-
user535733 over 2 yearsYou 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.
-
-
unknown over 2 yearsCould 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 over 2 yearsI was looking at 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 over 2 yearsPackages 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 over 2 yearsIsn'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 over 2 yearsYou 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 andlinux-image-generic-hwe-18.04
package. You have to learn tools and system before doing strange things, IMHO. -
Promise Chukwudum about 2 yearsThank 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.