DevHeads.net

How do I remove a kernel

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?

thanks

Comments

Re: How do I remove a kernel

By Pete Biggs at 01/08/2019 - 18:31

On Tue, 2019-01-08 at 17:22 -0500, Robert Moskowitz wrote:
yum install yum-utils
package-cleanup --oldkernels --count=3

replace the count with however many you want to leave on the system.

P.

Re: How do I remove a kernel

By Robert Moskowitz at 01/08/2019 - 19:52

On 1/8/19 6:31 PM, Pete Biggs wrote:
Already installed.

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.

Re: How do I remove a kernel

By m.roth at 01/08/2019 - 17:30

Robert Moskowitz wrote:
yum remove kernel-rest-of-kernel-name, for example
yum remove kernel-3.10.0-862.2.3.el7.x86_64

mark

Re: How do I remove a kernel

By Robert Moskowitz at 01/08/2019 - 17:57

On 1/8/19 5:30 PM, mark wrote:
# yum remove kernel-4.14.28-201.el7.centos.armv7hl
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package kernel.armv7hl 0:4.14.28-201.el7.centos will be erased
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package   Arch       Version Repository                Size
================================================================================
Removing:
 kernel    armv7hl    4.14.28-201.el7.centos @instKern/$releasever    0.0

Transaction Summary
================================================================================
Remove  1 Package

Installed size: 0
Is this ok [y/N]:

Only freed up 12MB.  All the other kernel components are still there:

How do I get rid of the whole lot?

thanks

Re: How do I remove a kernel

By Stephen John Smoogen at 01/08/2019 - 18:02

what other components? Can you give some details on what you are seeing
staying around? That will help (especially since people didn't know from
the first email you are on a arm system which may have different items than
an x86_64)

Re: How do I remove a kernel

By Robert Moskowitz at 01/08/2019 - 19:47

On 1/8/19 6:02 PM, Stephen John Smoogen wrote:
Oops.  My bad for leaving that off, but what about all the kernel* (like
4 rpms?) that normally gets installed?

dtb-4.14.28-201.el7.centos.armv7hl
initramfs-4.14.28-201.el7.centos.armv7hl.img
System.map-4.14.28-201.el7.centos.armv7hl
uImage-4.14.28-201.el7.centos.armv7hl
uInitrd-4.14.28-201.el7.centos.armv7hl
vmlinuz-4.14.28-201.el7.centos.armv7hl

The dtb* is a directory.

Re: How do I remove a kernel

By Stephen John Smoogen at 01/08/2019 - 17:29

yum remove kernel-3.10.0-862.2.3.el7.x86_64 # or whatever the name is.

For the YOLO approach

yum remove $( rpm -q kernel | sort -n | head -n 2 )

That should work currently (though a safer method might be done).. I am not
sure if it will correctly deal with kernel-3.10.0-1234.5.6.el7.x86_64
someday