centos在安装新内核后,会设置新内核为默认启动内核,有时候我们可能需要更改为其他内核,操作如下。
查看当前默认内核
grubby --default-kernel
输出结果
[root@localhost ~]# grubby --default-kernel
/boot/vmlinuz-4.18.0-348.7.1.el8_5.x86_64
查看所有内核
grubby --info=ALL
输出结果
[root@localhost ~]# grubby --info=ALL
index=0
kernel="/boot/vmlinuz-4.18.0-348.7.1.el8_5.x86_64"
args="ro crashkernel=auto resume=/dev/mapper/cl-swap rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet $tuned_params"
root="/dev/mapper/cl-root"
initrd="/boot/initramfs-4.18.0-348.7.1.el8_5.x86_64.img $tuned_initrd"
title="CentOS Linux (4.18.0-348.7.1.el8_5.x86_64) 8"
id="5aba21d384f845cbb93134cc471fe539-4.18.0-348.7.1.el8_5.x86_64"
index=1
kernel="/boot/vmlinuz-4.18.0-348.2.1.el8_5.x86_64"
args="ro crashkernel=auto resume=/dev/mapper/cl-swap rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet $tuned_params"
root="/dev/mapper/cl-root"
initrd="/boot/initramfs-4.18.0-348.2.1.el8_5.x86_64.img $tuned_initrd"
title="CentOS Linux (4.18.0-348.2.1.el8_5.x86_64) 8"
id="5aba21d384f845cbb93134cc471fe539-4.18.0-348.2.1.el8_5.x86_64"
index=2
kernel="/boot/vmlinuz-4.18.0-240.1.1.el8_3.x86_64"
args="ro crashkernel=auto resume=/dev/mapper/cl-swap rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet $tuned_params"
root="/dev/mapper/cl-root"
initrd="/boot/initramfs-4.18.0-240.1.1.el8_3.x86_64.img $tuned_initrd"
title="CentOS Linux (4.18.0-240.1.1.el8_3.x86_64) 8"
id="5aba21d384f845cbb93134cc471fe539-4.18.0-240.1.1.el8_3.x86_64"
index=3
kernel="/boot/vmlinuz-4.18.0"
args="ro crashkernel=auto resume=/dev/mapper/cl-swap rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet $tuned_params"
root="/dev/mapper/cl-root"
initrd="/boot/initramfs-4.18.0.img $tuned_initrd"
title="CentOS Linux (4.18.0) 8"
id="5aba21d384f845cbb93134cc471fe539-4.18.0"
index=4
kernel="/boot/vmlinuz-0-rescue-5aba21d384f845cbb93134cc471fe539"
args="ro crashkernel=auto resume=/dev/mapper/cl-swap rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet"
root="/dev/mapper/cl-root"
initrd="/boot/initramfs-0-rescue-5aba21d384f845cbb93134cc471fe539.img"
title="CentOS Stream (0-rescue-5aba21d384f845cbb93134cc471fe539) 8"
id="5aba21d384f845cbb93134cc471fe539-0-rescue"
设置默认内核
比如我要设置成4.18.0内核
grubby --set-default /boot/vmlinuz-4.18.0
这样就设置好了