CentOS7更换启动的内核

  • 查询系统当前使用的内核:uname -a
  • 查询系统grub目录:
    awk -F\' '$1=="menuentry " {print i++ " : " $2}' /boot/grub2/grub.cfg
1
2
3
4
5
6
awk -F\' '$1=="menuentry " {print i++ " : " $2}' /boot/grub2/grub.cfg
> 0 : CentOS Linux (3.10.0-1062.1.1.el7.x86_64) 7 (Core)
> 1 : CentOS Linux (3.10.0-1062.1.1.el7.x86_64) 7 (Core) with debugging
> 2 : CentOS Linux (5.3.0-1.el7.elrepo.x86_64) 7 (Core)
> 3 : CentOS Linux (5.3.0-1.el7.elrepo.x86_64) 7 (Core) with debugging
> 4 : CentOS Linux 7 (Core), with Linux 0-rescue-bff8a0e97aa64c29b63d43defd9b317d
  • 设置新的启动项:grub2-set-default 序号,其中序号以0开始
  • 验证:grub2-editenv list
  • 重启:systemctl reboot