🌐
Red Hat
access.redhat.com › solutions › 1227
What is the proper method to remove old kernels from a Red Hat Enterprise Linux system? - Red Hat Customer Portal
December 10, 2025 - How can I remove old kernel packages from a Red Hat Enterprise Linux system? Two kernel packages are appearing in my system, how to remove the older kernel package? My /boot directory is getting full, how do I remove old kernels? # df Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/VolGroup00-LogVol00 14804452 7006156 7046272 50% / /dev/sda1 101086 101086 0 100% /boot none 127332 0 127332 0% /dev/shm ·
🌐
Baeldung
baeldung.com › home › administration › boot process › removing old kernel versions for a clean boot menu
Removing Old Kernel Versions for a Clean Boot Menu | Baeldung on Linux
June 22, 2024 - It’s a command-line tool which ... all other old kernels. RedHat-based distros, including CentOS and Fedora, use YUM or DNF for package management....
Discussions

How do I remove old kernel versions through satellite
So, I've inherited a bunch of RHEL servers and they need patching. Fortunately there's a satellite server so patching turned out to be fairly… More on reddit.com
🌐 r/redhat
5
6
February 14, 2022
How to remove old kernels?
$ dpkg -l "linux-image*" "linux-headers*" Will show you all installed kernels and their headers, then you can remove them like: $ sudo apt purge linux-image-6.12.2-amd64 But it's better to use $ sudo apt autoremove to remove all except for the last two. In rare cases there might be some leftovers that were not removed automatically. I use purge over remove because it is meant to delete remaining configuration files and not just the package. More on reddit.com
🌐 r/debian
30
26
December 17, 2024
[Guide] Removing Old Unused Kernels
You just need to regularly apt autoremove to get rid of old kernels while keeping a fixed number. No need for more complicated schemes IMO. More on reddit.com
🌐 r/Ubuntu
14
7
August 28, 2023
Remove old kernels in Redhat 8?
It should be removing old kernels automatically on new kernel installs, no? Usually you get to keep about 3 of them, depending on configuration. $ grep limit /etc/dnf/dnf.conf installonly_limit=3 That is the config knob what controls how many kernels are installed at any given time. More on reddit.com
🌐 r/redhat
4
6
July 18, 2019
People also ask

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.

🌐
magnetbyte.com
magnetbyte.com › how-to-safely-remove-old-kernels-from-rhel-linux
How to Safely Remove Old Kernels from RHEL: Complete Guide
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-version

Or use:

package-cleanup --oldkernels --count=2

This command will keep the latest 2 kernels and remove the rest.

🌐
magnetbyte.com
magnetbyte.com › how-to-safely-remove-old-kernels-from-rhel-linux
How to Safely Remove Old Kernels from RHEL: Complete Guide
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.

🌐
magnetbyte.com
magnetbyte.com › how-to-safely-remove-old-kernels-from-rhel-linux
How to Safely Remove Old Kernels from RHEL: Complete Guide
🌐
Reddit
reddit.com › r/redhat › remove old kernels in redhat 8?
r/redhat on Reddit: Remove old kernels in Redhat 8?
July 18, 2019 -

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)
🌐
Yawhois
wiki.yawhois.com › home › linux › remove old kernels on red hat
Remove Old Kernels on Red Hat – Jim's Knowledge Base
November 12, 2022 - I want to always have two working kernels installed on my machines. In order to keep two, I would use the following command to remove all but the two latest kernels. [jhudgins@p2vm-sys-ppmail ~]$ sudo package-cleanup --oldkernels --count=2
🌐
TecMint
tecmint.com › home › linux distros › centos › how to delete old unused kernels in centos, rhel and fedora
How to Delete Old Unused Kernels in CentOS, RHEL and Fedora
September 8, 2017 - Another alternative way to remove old kernels automatically is setting the kernel limit in yum.conf file as shown. ... Save and close the file. The next time you run an update, only two kernels will be left on the system. You may also like to read these following related articles on Linux kernel.
🌐
Linux Tips
linux-tips.us › home › remove unused kernels from rhel
Remove Unused Kernels From RHEL • Linux Tips
September 11, 2023 - (You can boot to older kernels via GRUB if you want. That article is actually about recovery mode on Ubuntu, but the pictures should clue you in until I write an article just for this purpose.) If you use a --count= of 1 or 0, it will remove every kernel except the one in use, it will not remove the kernel that’s in use.
🌐
Linux.org
linux.org › home › forums › general linux forums › general linux topics
Trying to remove old kernels - but receiving conflicting information. | Linux.org
July 29, 2024 - dnf --help | grep autoremove autoremove remove all unneeded packages that were originally installed as dependencies · Click to expand... ... Click to expand... ... $ uname -a Linux scion1208 6.10.2-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Jul 27 14:12:13 EDT 2024 x86_64 x86_64 x86_64 G NU/Linux · Click to expand... The line that says "el9:elrepo" elrepo is non-vendor, also Redhat 9 (and it's clones ) are only on the 5.14.x kernel, not 6.10.
Find elsewhere
🌐
nixCraft
cyberciti.biz › nixcraft › howto › linux › removing linux kernel command
How to: Linux delete or remove kernel - nixCraft
February 19, 2021 - To remove kernel-smp-2.6.9-42.EL type the rpm command: # rpm -e kernel-smp-2.6.9-42.EL OR # rpm -vv -e kernel-smp-2.6.9-42.EL · These days we use the yum command/dnf command to list installed kernels and delele them directly: sudo dnf list ...
🌐
MagnetByte
magnetbyte.com › how-to-safely-remove-old-kernels-from-rhel-linux
How to Safely Remove Old Kernels from RHEL: Complete Guide
August 6, 2025 - It provides steps for RHEL 3 through 9 to remove individual old kernels, auto-purge outdated versions while keeping the running and latest kernel, and set a retained kernel limit. It recommends yum or dnf over direct rpm to avoid accidental removal, and covers GRUB updates and /boot partition troubleshooting. If you’re managing a Red Hat Enterprise Linux (RHEL), CentOS, RockyLinux or AlmaLinux server, you have likely noticed that over time, old kernels accumulate and eat up space—especially in the /boot partition.
🌐
Medium
medium.com › @jaine.mayank › how-to-remove-the-old-linux-kernel-from-rhel8-centos8-640c0d07ec2c
How to remove the old Linux kernel from RHEL8/CentOS8? | by Mayank Jain | Medium
July 8, 2023 - The above command will ask for confirmation to remove the kernel, press y and confirm it or you can add an argument in dnf remove command as -y · # dnf remove kernel-4.18.0–425.3.1.el8.x86_64 -y · Note: Make sure you are selecting the correct ...
🌐
TutorialsPoint
tutorialspoint.com › article › how-to-delete-old-unused-kernels-in-centos-rhel-and-fedora
How to Delete Old Unused Kernels in CentOS, RHEL and Fedora?
June 7, 2023 - sudo dnf install dnf-utils sudo package-cleanup --oldkernels --count=2 · To make this permanent, edit /etc/dnf/dnf.conf and add ? ... Regular kernel cleanup is essential for maintaining system health and freeing up disk space in /boot. Always keep multiple kernel versions for recovery purposes and use automated cleanup tools to streamline the process.
Top answer
1 of 2
4

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.

2 of 2
2

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

🌐
GeeksforGeeks
geeksforgeeks.org › linux-unix › how-to-uninstall-kernel-from-linux-remove-old-kernel-versions
How to Uninstall Kernel from Linux (Remove Old Kernel Versions) - GeeksforGeeks
July 23, 2025 - Above command lists all installed RPM packages on your system that contain the term "kernel" in their name. ... For Ubuntu users, the `apt `command is a more user-friendly alternative to apt-get. To remove or delete an old kernel, you can use: ... This command removes unused kernels from linux along with their associated configuration files, freeing up disk space and helping to keep your Linux system clean and organized.
🌐
GoLinuxCloud
golinuxcloud.com › home › how to properly remove old kernels rhel/centos 8
How to properly remove old kernels RHEL/CentOS 8 | GoLinuxCloud
January 1, 2024 - You can now use dnf command to remove old kernels from RHEL/CentOS 8 Linux. package-cleanup doesn't work any more. Use oldinstallonly with installonly_limit
🌐
Medium
leosaa.medium.com › remove-old-kernel-packages-in-rhel-8-52cee606656
Remove old kernel packages in RHEL 8 | by Leo Saavedra | Medium
February 26, 2021 - [buser@lautaro ~]$ rpm -qa | grep kernel- kernel-tools-4.18.0-240.15.1.el8_3.x86_64 kernel-4.18.0-240.el8.x86_64 kernel-core-4.18.0-240.15.1.el8_3.x86_64 kernel-core-4.18.0-240.el8.x86_64 kernel-tools-libs-4.18.0-240.15.1.el8_3.x86_64 kernel-modules-4.18.0-240.15.1.el8_3.x86_64 kernel-4.18.0-240.15.1.el8_3.x86_64 kernel-modules-4.18.0-240.el8.x86_64 · Then we have to remove the oldest one and keep only 1
🌐
Red Hat
access.redhat.com › solutions › 7081460
Does package-cleanup --oldkernels command work in RHEL 8 and above? - Red Hat Customer Portal
September 2, 2024 - Can't remove old kernels using the command package-cleanup --oldkernels. Red Hat Enterprise Linux 8 Red Hat Enterprise Linux 9 · A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.
🌐
Red Hat
access.redhat.com › solutions › 4094001
How to remove existing rescue kernel and how to prevent them from being created after new kernel updates. - Red Hat Customer Portal
2 weeks ago - The rescue kernel is taking up space in /boot. A rescue kernel entry is created for every Kernel installation. A rescue kernel is marked as default after a Kernel installation. /boot contains multiple initramfs-0-rescue and/or vmlinuz-0-rescue files GRUB boot menu shows multiple 0-rescue entries
🌐
Red Hat
access.redhat.com › solutions › 7093920
How to uninstall a kernel on a RHEL 8/9/10 system? - Red Hat Customer Portal
December 5, 2025 - I have too many kernels installed; how do I remove an old one? Red Hat Enterprise Linux 10 · Red Hat Enterprise Linux 9 · Red Hat Enterprise Linux 8 · A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more. Log in for full access Log In ·
🌐
LinuxQuestions.org
linuxquestions.org › questions › red-hat-31 › redhat-9-rhn-kernel-update-delete-old-one-86898
Redhat 9 RHN Kernel Update - Delete Old One
Hi I installed RH9 on my PC. Great! I get to the point where I can optionally update using RHN. I enter my details and it shows me a new kernel. I
🌐
Reddit
reddit.com › r/redhat › how do i remove old kernel versions through satellite
r/redhat on Reddit: How do I remove old kernel versions through satellite
February 14, 2022 - Yea, I've set it to two on the machines I logged into to test. I'm ok with a backup kernel being there. It's just, there's 70 servers. I really don't want to pet them. ... Cannot remove duplicate kernel packages.