# awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg 0 : CentOS Linux (3.10.0-957.5.1.el7.x86_64) 7 (Core) 1 : CentOS Linux (3.10.0-957.el7.x86_64) 7 (Core) 2 : CentOS Linux (0-rescue-2f0c165e79aa2eb8de65117302472e64) 7 (Core)
# grub2-editenv list saved_entry=0 # grub2-set-default 1 # grub2-editenv list saved_entry=1
サーバ起動しなくて、レスキューモードで変更する場合は、このを直接変更
# grep GRUB_DEFAULT /etc/default/grub GRUB_DEFAULT=saved
# grubby --default-kernel /boot/vmlinuz-4.16.12-1.choon.el7.x86_64
# grubby --default-index 0
# grubby --info=ALL index=0 kernel=/boot/vmlinuz-4.16.12-1.choon.el7.x86_64 args="ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet biosdevname=0 net.ifnames=0 console=tty0 console=ttyS1,115200n8 spectre_v2=retpoline nopti LANG=en_US.UTF-8" root=/dev/mapper/centos-root initrd=/boot/initramfs-4.16.12-1.choon.el7.x86_64.img title=CentOS Linux (4.16.12-1.choon.el7.x86_64) 7 (Core) index=1 kernel=/boot/vmlinuz-3.10.0-1062.12.1.el7.x86_64 args="ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet biosdevname=0 net.ifnames=0 console=tty0 console=ttyS1,115200n8 spectre_v2=retpoline nopti" root=/dev/mapper/centos-root initrd=/boot/initramfs-3.10.0-1062.12.1.el7.x86_64.img title=CentOS Linux (3.10.0-1062.12.1.el7.x86_64) 7 (Core) index=2 kernel=/boot/vmlinuz-3.10.0-957.el7.x86_64 args="ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet biosdevname=0 net.ifnames=0 console=tty0 console=ttyS1,115200n8 spectre_v2=retpoline nopti" root=/dev/mapper/centos-root initrd=/boot/initramfs-3.10.0-957.el7.x86_64.img title=CentOS Linux (3.10.0-957.el7.x86_64) 7 (Core) index=3 kernel=/boot/vmlinuz-3.10.0-862.14.4.el7.centos.plus.x86_64 args="ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet biosdevname=0 net.ifnames=0 console=tty0 console=ttyS1,115200n8 spectre_v2=retpoline nopti" root=/dev/mapper/centos-root initrd=/boot/initramfs-3.10.0-862.14.4.el7.centos.plus.x86_64.img title=CentOS Linux (3.10.0-862.14.4.el7.centos.plus.x86_64) 7 (Core) index=4 kernel=/boot/vmlinuz-0-rescue-386cd61b700b4d7e96722ab240aea3fc args="ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet biosdevname=0 net.ifnames=0 console=tty0 console=ttyS1,115200n8 spectre_v2=retpoline nopti" root=/dev/mapper/centos-root initrd=/boot/initramfs-0-rescue-386cd61b700b4d7e96722ab240aea3fc.img title=CentOS Linux (0-rescue-386cd61b700b4d7e96722ab240aea3fc) 7 (Core) index=5 non linux entry
インデックス1のカーネルに変更する場合
# grubby --set-default-index=1