[CentOS] Re: LIMITING NUMBER OF KERNEL VERSIONS RETAINED

Mon Jan 14 09:33:44 UTC 2008
Kay Diederichs <kay.diederichs at uni-konstanz.de>

Alfred von Campe schrieb:
>> Some time ago there was a discussion on the above subject. I have 
>> scanned the past few month's mailing list archives and cannot find the 
>> relevant mail(s).
>>
>> Could somebody please repost the solution or point me at the correct 
>> resource.
> 
> What you want is:
> 
>   # yum instal yum-utils
> 
> followed by:
> 
>   # package-cleanup --oldkernels [--count=x]
> 
> where x defaults to "2" (i.e., keep two older kernels).
> 
> Alfred

I get an error:

[root at turn15 ~]# package-cleanup -y --oldkernels
Setting up yum
Loading "installonlyn" plugin
I will remove the following 2 kernel related packages:
kernel-devel-2.6.18-8.1.14.el5
kernel-devel-2.6.18-8.1.15.el5
/usr/bin/package-cleanup:312: DeprecationWarning: returnHeaderByTuple() 
will go away in a future version of Yum.

   hdr = my.rpmdb.returnHeaderByTuple(kernel)[0]
Traceback (most recent call last):
   File "/usr/bin/package-cleanup", line 402, in ?
     main()
   File "/usr/bin/package-cleanup", line 371, in main
     removeKernels(my, opts.kernelcount, opts.confirmed, opts.keepdevel)
   File "/usr/bin/package-cleanup", line 317, in removeKernels
     my.populateTs()
   File "/usr/lib/python2.4/site-packages/yum/depsolve.py", line 171, in 
populateTs
     self.ts.addErase(txmbr.po.idx)
AttributeError: 'YumInstalledPackage' object has no attribute 'idx'
[root at turn15 ~]# rpm -qa kernel\*
kernel-devel-2.6.18-8.1.14.el5
kernel-headers-2.6.18-53.1.4.el5
kernel-devel-2.6.18-8.1.15.el5
kernel-devel-2.6.18-53.1.4.el5
kernel-2.6.18-53.1.4.el5

How to deal with that?

thanks,

Kay