Fedora remove old kernels

Posted on 2022-01-14  128 Views


Problems occurs

Sometimes when you upgrade ur package, the result of the last several lines show:

Disk Requirements: 
At least 29MB more space needed on the /boot filesystem.

This is quick guide howto delete/remove/clean old kernels on Fedora 28/27/26, CentOS 7.5/6.10, Red Hat (RHEL) 7.5/6.10. I use here two kernel as example, if you want to keep other more or less, then adjust amount of installed kernels as you wish. Normally reason why you maybe want remove kernels is limited disk space, example on VPS servers and laptop. This is very easy task.

Solution for Fedora

dnf remove $(dnf repoquery --installonly --latest-limit=-2 -q)