[SOLVED] Delete old linux kernel
[SOLVED] Delete old linux kernel
hi
What's the best whay to delete old linux kernel on CentOS 6?
[code]
$ rpm -q kernel
kernel-2.6.32-220.2.1.el6.i686
kernel-2.6.32-220.4.1.el6.i686
kernel-2.6.32-220.4.2.el6.i686
kernel-2.6.32-220.7.1.el6.i686[/code]
Should I use 'rpm -e' command to remove?
What's the best whay to delete old linux kernel on CentOS 6?
[code]
$ rpm -q kernel
kernel-2.6.32-220.2.1.el6.i686
kernel-2.6.32-220.4.1.el6.i686
kernel-2.6.32-220.4.2.el6.i686
kernel-2.6.32-220.7.1.el6.i686[/code]
Should I use 'rpm -e' command to remove?
-
- Retired Moderator
- Posts: 18276
- Joined: 2006/12/13 20:15:34
- Location: Tidewater, Virginia, North America
- Contact:
[SOLVED] Delete old linux kernel
That should work. So should "yum remove ...". To keep fewer kernels automatically edit [b]/etc/yum.conf[/b] and change [b]installonly_limit=5[/b] to a smaller number. It is advisable to keep at least a couple of old kernels to fall back to if there is a problem with an update.
Re: Delete old linux kernel
Thx Phil
I've removed using yum and now I have the following:[code]
# rpm -qa | grep kernel
dracut-kernel-004-256.el6_2.1.noarch
kernel-firmware-2.6.32-220.7.1.el6.noarch
kernel-2.6.32-220.7.1.el6.i686
kernel-headers-2.6.32-220.7.1.el6.i686
libreport-plugin-kerneloops-2.0.5-20.el6.i686
[/code]
BTW I've changed in /etc/yum.conf to:[code]installonly_limit=2[/code]
I've removed using yum and now I have the following:[code]
# rpm -qa | grep kernel
dracut-kernel-004-256.el6_2.1.noarch
kernel-firmware-2.6.32-220.7.1.el6.noarch
kernel-2.6.32-220.7.1.el6.i686
kernel-headers-2.6.32-220.7.1.el6.i686
libreport-plugin-kerneloops-2.0.5-20.el6.i686
[/code]
BTW I've changed in /etc/yum.conf to:[code]installonly_limit=2[/code]
-
- Retired Moderator
- Posts: 18276
- Joined: 2006/12/13 20:15:34
- Location: Tidewater, Virginia, North America
- Contact:
Re: [SOLVED] Delete old linux kernel
You are welcome. Looks good, as long as the current kernel is working for you, as you left nothing to fall back on.
Thanks for reporting back. Marking this thread [SOLVED] for posterity.
Thanks for reporting back. Marking this thread [SOLVED] for posterity.
Re: [SOLVED] Delete old linux kernel
I realize this is solved and closed, but for those interested there is an easier solution -
yum install yum-utils
package-cleanup --oldkernels --count=2
yum install yum-utils
package-cleanup --oldkernels --count=2
Re: [SOLVED] Delete old linux kernel
Reviving this... Will that command remove all older packages? I'm working with a live CD version of 6.5 with an overlay of roughly 4gb, after update I only have 2.7 GB left and haven't begun installing any of the other packages I'll need for this system. I don't care about a fallback kernel on this, everything I need to do works properly on the latest updates.
And yes I will try the above utilities and see for myself, but thought it was worth asking. I assume that if I don't specify how many to save, only the current kernel and packages will be present.
And yes I will try the above utilities and see for myself, but thought it was worth asking. I assume that if I don't specify how many to save, only the current kernel and packages will be present.
- bluegroper
- Posts: 266
- Joined: 2005/09/07 23:04:21
- Location: .au
Re: [SOLVED] Delete old linux kernel
Just edit your /etc/yum.conf
Then your next yum update will do all your housekeeping.
No need for any complicated remove commands.
Too easy.
HTH
Code: Select all
installonly_limit=3
No need for any complicated remove commands.
Too easy.
HTH
I'm not a complete idiot. There's still a few pieces missing.
Re: [SOLVED] Delete old linux kernel
bluegroper 's change of /etc/yum.conf installonly_limit followed by 'yum update' does not work.
sten's 'package-cleanup --oldkernels --count=2' works perfectly.
sten's 'package-cleanup --oldkernels --count=2' works perfectly.
Re: [SOLVED] Delete old linux kernel
I found that my new kernel was crashing .. I was unable to delete this kernel, apparently because it was the latest kernel I had ..
I did attempt a yum command as well, with similar results. I finally succeeded, sorta, with the following ..
( I am good, but not perfect )
( on line 87 or so, I found a reference to my offending kernel, prefixed with "^menuentry". I deleted that line and all lines through and including it's matching, closing brace ")" )
my boot process now requires human input, so apparently I have some cleanup to do.
Code: Select all
$ uname -a
Linux reliant.wek 3.10.0-327.36.3.el7.x86_64 #1 SMP Mon Oct 24 16:09:20 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ rpm -q kernel
kernel-3.10.0-327.el7.x86_64
kernel-3.10.0-327.36.3.el7.x86_64
kernel-3.10.0-514.2.2.el7.x86_64
$ rpm -e kernel-3.10.0-514.2.2.el7.x86_64
error: Failed dependencies:
kernel >= 3.10.0-384.el7 is needed by (installed) hypervkvpd-0-0.29.20160216git.el7.x86_64
kernel >= 3.10.0-384.el7 is needed by (installed) hypervvssd-0-0.29.20160216git.el7.x86_64
kernel >= 3.10.0-384.el7 is needed by (installed) hypervfcopyd-0-0.29.20160216git.el7.x86_64
Code: Select all
$ find . -name "*514*" -ls
( to ensure I had a good pattern )
$ tar cfz /root/boot-20170102.tgz /boot
$ tar tvfz /root/boot-20170102.tgz
Code: Select all
$ cd /boot && find . -name "*-514.*" -exec rm {} \;
$ find . -type f -exec grep -c -F "514" {} /dev/null \;
$ vi ./grub2/grub.cfg
my boot process now requires human input, so apparently I have some cleanup to do.
Re: [SOLVED] Delete old linux kernel
That's not the way to do it.
To remove a kernel that you do not want, first you need to make sure you are not running it as yum will refuse to remove the running kernel. So reboot and select a different kernel from the grub menu and then use yum remove kernel-3.10.0-514.2.2.el7.x86_64
Done.
To remove a kernel that you do not want, first you need to make sure you are not running it as yum will refuse to remove the running kernel. So reboot and select a different kernel from the grub menu and then use yum remove kernel-3.10.0-514.2.2.el7.x86_64
Done.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke