1,查看当前系统有几个内核
执行: cat /boot/grub2/grub.cfg |grep menuentry
[root@21yunwei ~]# cat /boot/grub2/grub.cfg |grep menuentry
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
menuentry_id_option=""
export menuentry_id_option
menuentry 'CentOS Linux (4.4.110-1.el7.elrepo.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-4.4.110-1.el7.elrepo.x86_64-advanced-c59b9eb7-3a84-43c6-8f1e-29c2ef4ef0e6' {
menuentry 'CentOS Linux (4.4.82-1.el7.elrepo.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-4.4.82-1.el7.elrepo.x86_64-advanced-c59b9eb7-3a84-43c6-8f1e-29c2ef4ef0e6' {
menuentry 'CentOS Linux (3.10.0-693.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-693.el7.x86_64-advanced-c59b9eb7-3a84-43c6-8f1e-29c2ef4ef0e6' {
menuentry 'CentOS Linux (0-rescue-72db9dd831b546f2a155776dc80f6cb4) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-72db9dd831b546f2a155776dc80f6cb4-advanced-c59b9eb7-3a84-43c6-8f1e-29c2ef4ef0e6' {
2,设置默认的启动内核
grub2-set-default "CentOS Linux (3.10.0-693.el7.x86_64) 7 (Core)"
验证是否修改成功:
[root@21yunwei ~]# grub2-editenv list
saved_entry=CentOS Linux (3.10.0-693.el7.x86_64) 7 (Core)
3,重启后进行观察
重启成功以后查看下机器的内核是不是该内核:
[root@21yunwei ~]# uname -r
3.10.0-693.el7.x86_64