0 : CentOS Linux 7 Rescue be01194033634997b76c097ab3d668ed (4.20.0-1.el7.elrepo.x86_64)
1 : CentOS Linux (4.20.0-1.el7.elrepo.x86_64) 7 (Core)
2 : CentOS Linux (3.10.0-693.11.6.el7.x86_64) 7 (Core)
3 : CentOS Linux (3.10.0-693.el7.x86_64) 7 (Core)
4 : CentOS Linux (0-rescue-00a62363617944e08db8db894ba6145e) 7 (Core)
配置方法
1、通过 grub2-set-default 命令设置
查看当前 default 的 entry
grub2-editenv list
saved_entry=CentOS Linux (3.10.0-693.11.6.el7.x86_64) 7 (Core)
修改为指定的 entry,指定最新内核,然后查看指定内核为:saved_entry=1
grub2-set-default 1
grub2-editenv list
2、编辑 /etc/default/grub 文件
(第一种方式无法修改内核再用这种方式修改)
设置 GRUB_DEFAULT=1,通过上面查询显示的编号为 1 的内核作为默认内核:
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=”( s e d ‘ s , r e l e a s e . ∗ (sed ‘s, release .*(sed‘s,release.∗,g’ /etc/system-release)”
GRUB_DEFAULT=1
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL=”serial console”
GRUB_TERMINAL_OUTPUT=”serial console”
GRUB_CMDLINE_LINUX=”crashkernel=auto console=ttyS0 console=tty0 panic=5 net.ifnames=0 biosdevname=0 intel_idle.max_cstate=1 intel_pstate=disable”
GRUB_DISABLE_RECOVERY=”true”
GRUB_SERIAL_COMMAND=”serial –speed=9600 –unit=0 –word=8 –parity=no –stop=1″
生成 grub 配置文件
grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file …
Found linux image: /boot/vmlinuz-5.8.14-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-5.8.14-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1062.18.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1062.18.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-0ea734564f9a4e2881b866b82d679dfc
Found initrd image: /boot/initramfs-0-rescue-0ea734564f9a4e2881b866b82d679dfc.img
Found linux image: /boot/vmlinuz-0-rescue-d4a7825ac1094e6a9184b6379c189521
Found initrd image: /boot/initramfs-0-rescue-d4a7825ac1094e6a9184b6379c189521.img