[CentOS] How do I remove a kernel

Wed Jan 9 00:52:11 UTC 2019
Robert Moskowitz <rgm at htt-consult.com>


On 1/8/19 6:31 PM, Pete Biggs wrote:
> On Tue, 2019-01-08 at 17:22 -0500, Robert Moskowitz wrote:
>> I have 4 kernels in /boot, leaving on 20MB which is not enough for the
>> next one.
>>
>> I had installonly_limit= set at 5, as there were some kernel problems.
>> After I got the error that there was not enough room for another kernel,
>> I set installonly_limit= to 3 and did the update with --exclude=kernel*
>>
>> That worked to update everything else, but not remove the oldest kernel.
>>
>> How can I remove the oldest kernel to make room for the new one?
>>
> yum install yum-utils

Already installed.

> package-cleanup --oldkernels --count=3
>
> replace the count with however many you want to leave on the system.

Dependencies Resolved

================================================================================
  Package         Arch     Version Repository              Size
================================================================================
Removing:
  kernel-core     armv7hl  4.14.28-201.el7.centos 
@instKern/$releasever   89 M
Removing for dependencies:
  kernel-modules  armv7hl  4.14.28-201.el7.centos 
@instKern/$releasever   17 M

Transaction Summary
================================================================================
Remove  1 Package (+1 Dependent package)


That picked up 110MB and now I have enough room for installing the new 
kernel.

Thanks.