跳至内容

如何解决在 Amazon EC2 中使用 VM Import/Export 时出现的 "ClientError: BLSC-style GRUB found" 错误?

1 分钟阅读
0

我想使用 VM Import/Export 将虚拟机 (VM) 映像导入 Amazon Elastic Compute Cloud (Amazon EC2) 或导出亚马逊机器映像 (AMI)。该映像来自 Red Hat Enterprise Linux (RHEL) 8、CentOS 8 或 Oracle Linux 8。但我收到了 "ClientError: BLSC-style GRUB found, but unable to detect default kernel" 错误。

简短描述

"ClientError: BLSC-style GRUB found" 错误会在 VM Import/Export 无法检测到虚拟机映像中的默认内核时出现。

要在 Amazon EC2 中使用 VM Import/Export ,必须将 /etc/default/grub 文件中的 GRUB_ENABLE_BLSCFG 参数设置为 false。默认情况下,GRUB_ENABLE_BLSCFG 设置为 true。如果此参数设置为 true,则 GRUB2 会使用 blscfg 文件和 /boot/loader 文件中的条目,而不是 grub.cfg 文件中的 menuentry 条目。因此,您会收到 "ClientError: BLSC-style GRUB found" 错误消息。

"ClientError: BLSC-style GRUB found" 错误也会在使用不受支持的内核时出现。

解决方法

**先决条件:**确认您使用的是受支持的操作系统 (OS) 和内核版本

如果您使用的是受支持的操作系统和内核,但仍收到 "ClientError: BLSC-style GRUB found" 错误消息,请完成以下步骤:

  1. 使用文本编辑器(如 vi)打开 /etc/default/grub 文件。<br id=hardline_break/> 命令示例:

    sudo vi /etc/default/grub
  2. GRUB_ENABLE_BLSCFG 参数设置为 false<br id=hardline_break/> 文本示例:

    GRUB_ENABLE_BLSCFG=false
  3. 运行以下命令以重新构建 GRUB 配置文件:

    grub2-mkconfig -o /boot/grub2/grub.cfg
  4. 测试虚拟机以确保其仍然可以在本地运行。然后,导入新的虚拟机映像或导出 AMI。

  5. (可选)在导入新映像或导出 AMI 后,将该参数设置回 true

AWS 官方已更新 8 个月前