Hi
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.
I would also appreciate advice on how to do this on a RHEL4 server being updated with up2date.
Is it safe just to delete the old kernel and initrd files from the boot partition and the grub conf file?
TIA
ChrisG
Subject: [CentOS] LIMITING NUMBER OF KERNEL VERSIONS RETAINED
Hi
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.
I would also appreciate advice on how to do this on a RHEL4 server being updated with up2date.
Is it safe just to delete the old kernel and initrd files from the boot partition and the grub conf file?
TIA
ChrisG
Chris
I dunno answer to limit kernels retained.
No, simple deletion is not a good idea.
What we do is this
rpm -qa | grep kernel
Then we use yum to remove the ones we do not need
yum remove kernel-whatever-version-etc
and/or other items as necessary
- rh
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
On Sunday 13 January 2008 08:14:39 Alfred von Campe wrote:
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
Of course you'll handle the typo and type
yum install yum-utils
(for those who are too literal for their own good : )
followed by:
# package-cleanup --oldkernels [--count=x]
where x defaults to "2" (i.e., keep two older kernels).
Alfred
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
On 1/13/08, Alfred von Campe alfred@von-campe.com wrote:
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).
I recently discovered that if you have both the uniprocessor and SMP kernel packages installed, which I believe is the default behavior, then package-cleanup won't remove the SMP packages. I had to rpm -e those myself.
Maybe there's some other reason that it missed those ...
Bart Schaefer wrote:
On 1/13/08, Alfred von Campe alfred@von-campe.com wrote:
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).
I recently discovered that if you have both the uniprocessor and SMP kernel packages installed, which I believe is the default behavior, then package-cleanup won't remove the SMP packages. I had to rpm -e those myself.
Maybe there's some other reason that it missed those ... _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Thanks for the quick replies everybody, I will follow Alfred's suggestion.
ChrisG
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@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@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
Could somebody please repost the solution or point me at the correct resource.
I would also appreciate advice on how to do this on a RHEL4 server being updated with up2date.
Is it safe just to delete the old kernel and initrd files from the boot partition and the grub conf file?
Unless you are really hurting for disk space on your boot partition, it is safe to leave the extra kernel images there. If the clutter on your grub menu bothers you, you can simply delete them from the grub.conf file so they don't show up. I generally keep 2-3 older kernel images around just in case newly installed ones won't boot for some reason.
Alfred gave some good advice for keeping this neat 'n tidy with the yum-utils package-cleanup command.
Chris Geldenhuis napsal(a):
Hi
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.
I would also appreciate advice on how to do this on a RHEL4 server being updated with up2date.
Is it safe just to delete the old kernel and initrd files from the boot partition and the grub conf file?
TIA
ChrisG
Hi, I use this within my kikstart scripts: if [ $(rpm -q kernel | wc -l) -gt 1 ]; then rpm -e $(rpm -q kernel | sed '$d'); fi if [ $(rpm -q kernel-smp | wc -l) -gt 1 ]; then rpm -e $(rpm -q kernel-smp | sed '$d'); fi
David Hrbáč