https://inasa.dev/blog/rss.xml

Debian | Change kernel

2023-02-18

找到submenu中的$menuentry_id_option

grep submenu /boot/grub/grub.cfg

返回

submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-52378de1-0e36-44b8-94d6-33b06437e470' {

gnulinux-advanced-52378de1-0e36-44b8-94d6-33b06437e470就是$menuentry_id_option

找到要使用内核的菜单项

grep gnulinux /boot/grub/grub.cfg

返回

menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-52378de1-0e36-44b8-94d6-33b06437e470' {
submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-52378de1-0e36-44b8-94d6-33b06437e470' {
	menuentry 'Ubuntu, with Linux 5.15.0-1029-oracle' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.15.0-1029-oracle-advanced-52378de1-0e36-44b8-94d6-33b06437e470' {
	menuentry 'Ubuntu, with Linux 5.15.0-1029-oracle (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.15.0-1029-oracle-recovery-52378de1-0e36-44b8-94d6-33b06437e470' {

修改/etc/default/grub

示例

#GRUB_DEFAULT=0
GRUB_DEFAULT="gnulinux-advanced-52378de1-0e36-44b8-94d6-33b06437e470>gnulinux-5.15.0-1029-oracle-advanced-52378de1-0e36-44b8-94d6-33b06437e470"

更新

update-grub2
reboot

  • https://unix.stackexchange.com/questions/198003/set-default-kernel-in-grub