Centos7 delete useless kernel

Normally there are two startup items, one is "normal startup" and the other is "rescue mode startup" (rescue).
If there are more than two startup items, it means that the current system has an old kernel that has not been deleted. The reason is that the old kernel will not be deleted automatically after CentOS is updated.
The default is to start with the new kernel, which can be selected temporarily in the startup options, or you can modify the configuration and specify it permanently.

[ root@controller ~]# uname -r     #View current kernel
3.10.0- 862.3.2. el7.x86_64
[ root@controller ~]# grub2-editenv list       #The default kernel is the latest version
saved_entry=CentOS Linux(3.10.0-862.3.2.el7.x86_64)7(Core)[root@controller ~]# rpm -qa |grep kernel-[0-9]
kernel-3.10.0-862.3.2.el7.x86_64
kernel-3.10.0-862.el7.x86_64
erlang-kernel-19.3.6.4-1.el7.x86_64
[ root@controller ~]# cat /boot/grub2/grub.cfg |grep "menuentry "
menuentry 'CentOS Linux (3.10.0-862.3.2.el7.x86_64) 7 (Core)'--classcentos--classgnu-linux --classgnu--classos--unrestricted $menuentry_id_option 'gnulinux-3.10.0-862.el7.x86_64-advanced-2e7f2bc7-8c8f-47f7-905d-5d65331a89be'{
menuentry 'CentOS Linux (3.10.0-862.el7.x86_64) 7 (Core)'--classcentos--classgnu-linux --classgnu--classos--unrestricted $menuentry_id_option 'gnulinux-3.10.0-862.el7.x86_64-advanced-2e7f2bc7-8c8f-47f7-905d-5d65331a89be'{
menuentry 'CentOS Linux (0-rescue-806e7521af0743a9a4414ff917f6c852) 7 (Core)'--classcentos--classgnu-linux --classgnu--classos--unrestricted $menuentry_id_option 'gnulinux-0-rescue-806e7521af0743a9a4414ff917f6c852-advanced-2e7f2bc7-8c8f-47f7-905d-5d65331a89be'{[root@controller ~]# yum remove kernel-3.10.0-862.el7.x86_64   #Remove old kernel
Or rpm-e kernel-3.10.0-862.el7.x86_64

an examination:

[ root@controller ~]# rpm -qa |grep kernel-[0-9]
kernel-3.10.0-862.3.2.el7.x86_64
erlang-kernel-19.3.6.4-1.el7.x86_64
[ root@controller ~]# grep menu /boot/grub2/grub.cfg

**Address of this article: **https://www.zwblog.cn/post/81.html **Copyright statement: **This article is an original article, the copyright belongs to herve, welcome to share this article, please keep the source for reprinting!

Recommended Posts

Centos7 delete useless kernel
Centos delete redundant kernel
Centos7 upgrade kernel
CentOS7.5-1804 system kernel upgrade
Centos kernel compilation configuration
CentOS6.5 upgrade kernel to 3.10.28
Centos kernel version upgrade
Debug Kernel Panic in Centos
CentOS 8 (2)
Three methods of Centos kernel upgrade
Linux: Centos7 upgrade the original kernel
CentOS 8 (1)
Remember a centos 7 kernel upgrade accident
Linux kernel compilation and CentOS system installation