查看当前启动内核
代码语言:javascript复制root@BJ-CentOS7 ~ # uname -sr
Linux 3.10.0-957.21.3.el7.x86_64
查看当前默认启动内核
代码语言:javascript复制root@BJ-CentOS7 ~ # grub2-editenv list
saved_entry=CentOS Linux (3.10.0-693.el7.centos.toa.x86_64) 7 (Core)
确认系统内当前已安装内核版本
代码语言:javascript复制root@BJ-CentOS7 ~ # cat /boot/grub2/grub.cfg | grep -v rescue | grep ^menuentry
menuentry 'CentOS Linux, with Linux 3.10.0-957.21.3.el7.x86_64' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-957.21.3.el7.x86_64-advanced-244b1cf5-bcde-47c5-9a90-055dcee38030' {
menuentry 'CentOS Linux, with Linux 3.10.0-693.el7.centos.toa.x86_64' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-693.el7.centos.toa.x86_64-advanced-244b1cf5-bcde-47c5-9a90-055dcee38030' {
menuentry 'CentOS Linux, with Linux 3.10.0-123.el7.x86_64' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-123.el7.x86_64-advanced-244b1cf5-bcde-47c5-9a90-055dcee38030' {
代码语言:javascript复制root@BJ-CentOS7 ~ # rpm -qa kernel
kernel-3.10.0-123.el7.x86_64
kernel-3.10.0-693.el7.centos.toa.x86_64
kernel-3.10.0-957.21.3.el7.x86_64
设置默认启动内核
修改默认启动内核后,重启机器即可以修改后的内核加载系统
代码语言:javascript复制root@BJ-CentOS7 ~ # grub2-set-default 'CentOS Linux (3.10.0-693.el7.centos.toa.x86_64) 7 (Core)'
root@BJ-CentOS7 ~ # grub2-editenv list
saved_entry=CentOS Linux (3.10.0-693.el7.centos.toa.x86_64) 7 (Core)
root@BJ-CentOS7 ~ # grub2-set-default 'CentOS Linux (3.10.0-957.21.3.el7.x86_64^C7 (Core)'
root@BJ-CentOS7 ~ # grub2-editenv list
saved_entry=CentOS Linux (3.10.0-957.21.3.el7.x86_64^C7 (Core)