正常情况有两个启动项,一个是“正常启动”,另一个是“救援模式启动”(rescue)。
如果启动项多于2个,说明当前系统有旧内核未删除。原因是CentOS更新后不会自动删除旧内核。
默认以新内核启动,可以在启动选项中临时选择,也可以修改配置永久指定。
[root@controller ~]# uname -r #查看当前内核
3.10.0-862.3.2.el7.x86_64
[root@controller ~]# grub2-editenv list # 默认内核已是最新版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)' --class centos --class gnu-linux --class gnu --class os --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)' --class centos --class gnu-linux --class gnu --class os --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)' --class centos --class gnu-linux --class gnu --class os --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 #删除旧内核
或者rpm -e kernel-3.10.0-862.el7.x86_64
检查:
[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