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.
建议的步骤Recommended steps
根据所收到的错误,按下面的缓解步骤操作:Follow the mitigation steps below depending on the error you receive:
错误 - 未知的文件系统Error - Unknown filesystem
如果出现“未知的文件系统”错误,则请注意,此错误可能是由于启动分区中的文件系统损坏,或者是由于内核配置不正确。 If you're getting the error Unknown filesystem , this error can result from a file system corruption on the boot partition, or an incorrect kernel configuration.
- 对于文件系统问题,请按 Linux Recovery:Cannot SSH to Linux VM due to file system errors (fsck, inodes)(Linux 恢复:由于文件系统错误(fsck、inode)而无法通过 SSH 连接到 Linux VM)一文中的步骤操作。For file system issues, follow the steps in the article Linux Recovery: Cannot SSH to Linux VM due to file system errors (fsck, inodes).
- 对于内核问题,请按照如何从与内核相关的启动问题中恢复 Azure Linux 虚拟机或 Linux 恢复:Fixing non-boot issues related to Kernel problems using chroot(Linux 恢复:使用 chroot 修复与内核问题相关的非启动问题)一文中的步骤操作。For kernel issues, follow the steps in the article How to recover an Azure Linux virtual machine from kernel-related boot issues, or Linux Recovery: Fixing non-boot issues related to Kernel problems using chroot.
错误 - 找不到文件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.cfg
或initrd/initramfs
文件缺失,请完成以下过程:For the missing file/boot/grub2/grub.cfg
orinitrd/initramfs
proceed with the following process:确保
/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.接下来,运行以下命令以重新生成其配置:
grub2-mkconfig -o /boot/grub2/grub.cfg
Next, run the following command to regenerate its configuration:grub2-mkconfig -o /boot/grub2/grub.cfg
如果缺失的文件为
/boot/grub/menu.lst
,则该错误是针对旧版 OS( RHEL 6.x 、 Centos 6.x 和 Ubuntu 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
- 如果出现“无此类分区”错误, 请参阅 Case Scenario : "no such partition" error while trying to start the VM after attempting to extend the OS drive(案例情况:在尝试扩展 OS 驱动器后尝试启动 VM 时出现“无此类分区”错误)。If you're getting the error No such partition , refer to Case Scenario : "no such partition" error while trying to start the VM after attempting to extend the OS drive.
错误 - 找不到 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.cfg
或initrd/initramfs
文件缺失,请完成以下过程:For the missing file/boot/grub2/grub.cfg
orinitrd/initramfs
proceed with the following process:确保
/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.接下来,运行以下命令以重新生成其配置:
grub2-mkconfig -o /boot/grub2/grub.cfg
。Next, run the following command to regenerate its configuration:grub2-mkconfig -o /boot/grub2/grub.cfg
.
如果缺失的文件为
/boot/grub/menu.lst
,则该错误是针对旧版 OS( RHEL 6.x 、 Centos 6.x 和 Ubuntu 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.