How do I remove old kernel versions through satellite
How to remove old kernels?
[Guide] Removing Old Unused Kernels
Remove old kernels in Redhat 8?
Why should I remove old kernels from RHEL?
Old kernels can take up unnecessary space on your system—especially in the /boot partition. Over time, this can lead to issues when updating or installing new packages. Cleaning up old kernels helps maintain system performance and stability.
What’s the easiest way to remove old kernels in RHEL?
You can use the built-in dnf or package-cleanup tool. For example:
dnf remove kernel-old-versionOr use:
package-cleanup --oldkernels --count=2This command will keep the latest 2 kernels and remove the rest.
Is it safe to remove old kernels from RHEL?
Yes, it's safe—as long as you keep at least one or two working kernels (including the one currently in use). Deleting the active kernel or the only backup could leave your system unbootable.
Videos
I tried using this command:
package-cleanup --oldkernels --count=1
However, it didn't work as apparently on Redhat 8 it's a DNF-based shim rather than the original Yum command.
Is there an easy way to make the original Yum command work on Redhat 8? If not, what is the easiest way to remove old kernels from the boot menu options?
edit: Solved!
dnf remove $(dnf repoquery --installonly --latest-limit=-1 -q)
Probably the safest thing to do would be to use yum erase <package>-<version>. Basically, what you have up there, but the .EL is not necessary to be included. You can use rpm -e if for some reason yum is unavailable.
You want to be very careful not to remove the currently running kernel. I notice that there are devel packages, too. It sounds like those might be entirely unnecessary for you but I'd start with just removing the oldest versions until you are satisfied with the amount of space freed up.
Yum should take care of it, but also confirm that the boot entries are removed from /etc/grub.conf.
I ran into this this week. I found a system that had yum auto-updates enabled. Over the years, multiple kernel updates were applied and eventually filled /boot. Note your kernel version with uname -a. Run an rpm -qa | grep kernel to list the various kernel packages installed. Perform a yum erase on the versions/packages you want to erase.
[root@xxxx ~]# rpm -qa | grep kernel
kernel-devel-2.6.9-42.0.8.plus.c4
kernel-smp-2.6.9-42.0.10.EL
kernel-devel-2.6.9-67.0.15.plus.c4
kernel-smp-2.6.9-67.0.20.plus.c4
kernel-devel-2.6.9-89.0.28.plus.c4
kernel-module-xfs-2.6.9-42.0.3.plus.c4smp-0.2-1
kernel-smp-2.6.9-55.plus.c4
kernel-devel-2.6.9-55.0.2.EL
kernel-devel-2.6.9-55.0.2.plus.c4
kernel-smp-2.6.9-55.0.9.plus.c4
kernel-smp-2.6.9-55.0.12.EL
kernel-smp-2.6.9-67.0.1.EL
kernel-devel-2.6.9-67.0.1.EL.plus.c4
kernel-smp-2.6.9-67.0.4.plus.c4
kernel-smp-2.6.9-67.0.7.plus.c4
kernel-devel-2.6.9-67.0.22.plus.c4
kernel-devel-2.6.9-42.0.10.plus.c4
kernel-devel-2.6.9-67.plus.c4
kernel-smp-2.6.9-78.0.13.plus.c4
kernel-smp-2.6.9-89.0.25.plus.c4
kernel-hugemem-devel-2.6.9-89.0.28.plus.c4
kernel-smp-2.6.9-42.0.3.EL
kernel-smp-2.6.9-42.0.3.plus.c4
kernel-smp-2.6.9-42.0.8.EL
kernel-devel-2.6.9-42.0.10.EL
Erasing a few versions...
yum erase kernel-devel-2.6.9-67.0.4.plus.c4 kernel-devel-2.6.9-67.0.1.EL