rocky linux9 运行update grub显示command not found

1
2
3
4
5
6
7
8
9
[root@localhost etc]# grub-update
-bash: grub-update: command not found
[root@localhost etc]# update-grub
-bash: update-grub: command not found
[root@localhost etc]# update-grub2
-bash: update-grub2: command not found
[root@localhost etc]# grub2-update
-bash: grub2-update: command not found
[root@localhost etc]#

无法执行这个命令的原因是rocky linux9 只支持“grub2-”系列命令

1
2
3
4
5
grub2-bios-setup           grub2-menulst2cfg          grub2-mount                grub2-set-default
grub2-editenv grub2-mkconfig grub2-probe grub2-set-password
grub2-file grub2-mkimage grub2-reboot grub2-setpassword
grub2-get-kernel-settings grub2-mkpasswd-pbkdf2 grub2-script-check grub2-switch-to-blscfg
grub2-install grub2-mkrelpath grub2-set-bootflag

我们可以用以下命令来代替执行update-grub,使用命令时,要注意EFI和经典模式启动的文件位置不同

1
2
3
4
5
6
7
8
# 经典模式
grub2-mkconfig -o /boot/grub/grub.cfg
# EFI模式
grub2-mkconfig -o /boot/efi/EFI/rocky/grub.cfg

# 执行成功后的提示
# Generating grub configuration file ...
# done