Linux VM 启动到 Grub 救援Linux VM boots to Grub Rescue

我们确定你的虚拟机 (VM) 已进入救援控制台。We have identified that your Virtual Machine (VM) entered a rescue console. 如果你的 Linux VM 最近应用了内核更改(例如内核升级),在启动过程中因内核错误而无法正常启动,则会发生此问题。The issue occurs when your Linux VM had kernel changes applied recently such as a kernel upgrade, and is no longer starting up properly because of kernel errors during the boot process. 在启动过程中,当启动加载程序尝试查找 Linux 内核并将启动控制移交给它时,如果移交失败,则 VM 会进入救援控制台。During the boot process, when the boot loader attempts to locate the Linux kernel and hand off boot control to it, the VM enters a rescue console when the handoff fails.

如果将来发现无法连接到 VM,则可使用 Azure 门户中的启动诊断边栏选项卡查看 VM 的屏幕截图。If you find that you can't connect to a VM in the future, you can view a screenshot of your VM using the boot diagnostics blade in the Azure portal. 这可能有助于诊断此问题并确定类似的启动错误是否是原因。This may help you diagnose the issue and determine if a similar boot error is the cause.

根据所收到的错误,按下面的缓解步骤操作:Follow the mitigation steps below depending on the error you receive:

错误 - 未知的文件系统Error - Unknown filesystem

错误 - 找不到文件Error - File not found

  • 如果出现“错误 15: 找不到文件或初始 RAM 磁盘”或“找不到 initrd/initramfs 文件”错误,请执行以下步骤。 If you're getting the error Error 15: File not found or initial RAM disk or initrd/initramfs file not found, follow the steps below.

    • 如果 /boot/grub2/grub.cfginitrd/initramfs 文件缺失,请完成以下过程:For the missing file /boot/grub2/grub.cfg or initrd/initramfs proceed with the following process:

      1. 确保 /etc/default/grub 存在且具有正确的/所需的设置。Ensure /etc/default/grub exist and has correct/desired settings. 如果不知道哪些是默认设置,可以通过工作 VM 进行检查。If you don't know which are the default settings, you can check with a working VM.

      2. 接下来,运行以下命令以重新生成其配置:grub2-mkconfig -o /boot/grub2/grub.cfgNext, run the following command to regenerate its configuration: grub2-mkconfig -o /boot/grub2/grub.cfg

    • 如果缺失的文件为 /boot/grub/menu.lst,则该错误是针对旧版 OS(RHEL 6.xCentos 6.xUbuntu 14.04)的,因此命令可能会有所不同。If the missing file is /boot/grub/menu.lst, this error is for older OS versions (RHEL 6.x, Centos 6.x and Ubuntu 14.04) so the commands could differ. 需启动旧服务器并进行测试,确保提供了正确的命令。You will have to spin up an old server and test to ensure the correct commands are provided.

错误 - 无此类分区Error - No such partition

错误 - 找不到 grub.cfg 文件Error - grub.cfg file not found

  • 如果出现“找不到 /boot/grub2/grub.cfg 文件”错误,请按以下步骤操作。 If you're getting the error /boot/grub2/grub.cfg file not found, follow the steps below.

    • 如果 /boot/grub2/grub.cfginitrd/initramfs 文件缺失,请完成以下过程:For the missing file /boot/grub2/grub.cfg or initrd/initramfs proceed with the following process:

      1. 确保 /etc/default/grub 存在且具有正确的/所需的设置。Ensure /etc/default/grub exist and has correct/desired settings. 如果不知道哪些是默认设置,可以通过工作 VM 进行检查。If you don't know which are the default settings, you can check with a working VM.

      2. 接下来,运行以下命令以重新生成其配置:grub2-mkconfig -o /boot/grub2/grub.cfgNext, run the following command to regenerate its configuration: grub2-mkconfig -o /boot/grub2/grub.cfg.

    • 如果缺失的文件为 /boot/grub/menu.lst,则该错误是针对旧版 OS(RHEL 6.xCentos 6.xUbuntu 14.04)的,因此命令可能会有所不同。If the missing file is /boot/grub/menu.lst, this error is for older OS versions (RHEL 6.x, Centos 6.x and Ubuntu 14.04) so the commands could defer. 请启动旧服务器并对其进行测试,确保提供了正确的命令。Spin up an old server and test it to ensure the correct commands are provided.

后续步骤Next steps