Here's what I do. It's on RHEL, but the process is the same for Fedora.

First, find all kernels which are installed.The last one is the latest, so we ignore that one.

----------------------------------
[root@neuromancer ~]# rpm -qa kernel | sort
kernel-5.14.0-284.25.1.el9_2.x86_64
kernel-5.14.0-284.30.1.el9_2.x86_64
kernel-5.14.0-362.8.1.el9_3.x86_64
----------------------------------

Grab the version number for the oldest two and use that to find all related packages installed on my machine:

----------------------------------
[root@neuromancer ~]# rpm -qa | grep -e 5.14.0-284.25.1 -e 5.14.0-284.30.1
kernel-modules-core-5.14.0-284.25.1.el9_2.x86_64
kernel-core-5.14.0-284.25.1.el9_2.x86_64
kernel-modules-5.14.0-284.25.1.el9_2.x86_64
kernel-5.14.0-284.25.1.el9_2.x86_64
kernel-core-5.14.0-284.30.1.el9_2.x86_64
kernel-modules-core-5.14.0-284.30.1.el9_2.x86_64
kernel-modules-5.14.0-284.30.1.el9_2.x86_64
kernel-5.14.0-284.30.1.el9_2.x86_64
----------------------------------

Now remove all the RPMs with those version numbers. This is all one long command:

----------------------------------
[root@neuromancer ~]# dnf remove kernel-modules-core-5.14.0-284.25.1.el9_2.x86_64 kernel-core-5.14.0-284.25.1.el9_2.x86_64 kernel-modules-5.14.0-284.25.1.el9_2.x86_64 kernel-5.14.0-284.25.1.el9_2.x86_64 kernel-core-5.14.0-284.30.1.el9_2.x86_64 kernel-modules-core-5.14.0-284.30.1.el9_2.x86_64 kernel-modules-5.14.0-284.30.1.el9_2.x86_64 kernel-5.14.0-284.30.1.el9_2.x86_64
Updating Subscription Management repositories.
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Removing:
kernel x86_64 5.14.0-284.25.1.el9_2 @rhel-9-for-x86_64-baseos-rpms 0 kernel x86_64 5.14.0-284.30.1.el9_2 @rhel-9-for-x86_64-baseos-rpms 0 kernel-core x86_64 5.14.0-284.25.1.el9_2 @rhel-9-for-x86_64-baseos-rpms 56 M kernel-core x86_64 5.14.0-284.30.1.el9_2 @rhel-9-for-x86_64-baseos-rpms 56 M
 kernel-modules
x86_64 5.14.0-284.25.1.el9_2 @rhel-9-for-x86_64-baseos-rpms 33 M
 kernel-modules
x86_64 5.14.0-284.30.1.el9_2 @rhel-9-for-x86_64-baseos-rpms 33 M
 kernel-modules-core
x86_64 5.14.0-284.25.1.el9_2 @rhel-9-for-x86_64-baseos-rpms 31 M
 kernel-modules-core
x86_64 5.14.0-284.30.1.el9_2 @rhel-9-for-x86_64-baseos-rpms 31 M

Transaction Summary
================================================================================
Remove  8 Packages

Freed space: 240 M
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1 Erasing : kernel-5.14.0-284.30.1.el9_2.x86_64 1/8 Running scriptlet: kernel-5.14.0-284.30.1.el9_2.x86_64 1/8 Erasing : kernel-5.14.0-284.25.1.el9_2.x86_64 2/8 Running scriptlet: kernel-5.14.0-284.25.1.el9_2.x86_64 2/8 Erasing : kernel-modules-5.14.0-284.25.1.el9_2.x86_64 3/8 Running scriptlet: kernel-modules-5.14.0-284.25.1.el9_2.x86_64 3/8 Erasing : kernel-modules-5.14.0-284.30.1.el9_2.x86_64 4/8 Running scriptlet: kernel-modules-5.14.0-284.30.1.el9_2.x86_64 4/8 Erasing : kernel-modules-core-5.14.0-284.30.1.el9_2.x86_64 5/8 Running scriptlet: kernel-modules-core-5.14.0-284.30.1.el9_2.x86_64 5/8 Running scriptlet: kernel-core-5.14.0-284.30.1.el9_2.x86_64 6/8 /usr/sbin/weak-modules: line 1086: cd: /lib/modules/5.14.0-284.30.1.el9_2.x86_64/weak-updates: No such file or directory

Erasing : kernel-core-5.14.0-284.30.1.el9_2.x86_64 6/8 warning: file /lib/modules/5.14.0-284.30.1.el9_2.x86_64/modules.builtin.modinfo: remove failed: No such file or directory warning: file /lib/modules/5.14.0-284.30.1.el9_2.x86_64/modules.builtin: remove failed: No such file or directory

Running scriptlet: kernel-core-5.14.0-284.30.1.el9_2.x86_64 6/8 Erasing : kernel-modules-core-5.14.0-284.25.1.el9_2.x86_64 7/8 Running scriptlet: kernel-modules-core-5.14.0-284.25.1.el9_2.x86_64 7/8 Running scriptlet: kernel-core-5.14.0-284.25.1.el9_2.x86_64 8/8 /usr/sbin/weak-modules: line 1086: cd: /lib/modules/5.14.0-284.25.1.el9_2.x86_64/weak-updates: No such file or directory

Erasing : kernel-core-5.14.0-284.25.1.el9_2.x86_64 8/8 warning: file /lib/modules/5.14.0-284.25.1.el9_2.x86_64/modules.builtin.modinfo: remove failed: No such file or directory warning: file /lib/modules/5.14.0-284.25.1.el9_2.x86_64/modules.builtin: remove failed: No such file or directory

Running scriptlet: kernel-core-5.14.0-284.25.1.el9_2.x86_64 8/8 Verifying : kernel-5.14.0-284.25.1.el9_2.x86_64 1/8 Verifying : kernel-5.14.0-284.30.1.el9_2.x86_64 2/8 Verifying : kernel-core-5.14.0-284.25.1.el9_2.x86_64 3/8 Verifying : kernel-core-5.14.0-284.30.1.el9_2.x86_64 4/8 Verifying : kernel-modules-5.14.0-284.25.1.el9_2.x86_64 5/8 Verifying : kernel-modules-5.14.0-284.30.1.el9_2.x86_64 6/8 Verifying : kernel-modules-core-5.14.0-284.25.1.el9_2.x86_64 7/8 Verifying : kernel-modules-core-5.14.0-284.30.1.el9_2.x86_64 8/8
Installed products updated.

Removed:
kernel-5.14.0-284.25.1.el9_2.x86_64 kernel-5.14.0-284.30.1.el9_2.x86_64 kernel-core-5.14.0-284.25.1.el9_2.x86_64 kernel-core-5.14.0-284.30.1.el9_2.x86_64 kernel-modules-5.14.0-284.25.1.el9_2.x86_64 kernel-modules-5.14.0-284.30.1.el9_2.x86_64 kernel-modules-core-5.14.0-284.25.1.el9_2.x86_64 kernel-modules-core-5.14.0-284.30.1.el9_2.x86_64

Complete!
----------------------------------

Now take a look in /boot to verify there's no cruft left over:

----------------------------------
[root@neuromancer ~]# ls /boot/
config-5.14.0-362.8.1.el9_3.x86_64
efi
extlinux
grub2
initramfs-0-rescue-15a772f5f71f455cb62f800c28a6d90b.img
initramfs-5.14.0-362.8.1.el9_3.x86_64.img
initramfs-5.14.0-362.8.1.el9_3.x86_64kdump.img
loader
symvers-5.14.0-362.8.1.el9_3.x86_64.gz
System.map-5.14.0-362.8.1.el9_3.x86_64
vmlinuz-0-rescue-15a772f5f71f455cb62f800c28a6d90b
vmlinuz-5.14.0-362.8.1.el9_3.x86_64
----------------------------------

As far as having the wrong rescue kernel, or too many, check out the thread at https://lists.fedoraproject.org/archives/list/[email protected]/thread/DI76W7ARJAKOZLF4QN7XXTLZGL43LY2O/

Especially look at the comment from Jerry James. I tested it on a VM and it worked fine for me.

Hope this is helpful.

Thomas
--
_______________________________________________
users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to