Windows 在启动 Azure VM 时显示蓝屏错误Windows shows blue screen error when booting an Azure VM

本文介绍在 Azure 中启动 Windows 虚拟机 (VM) 时可能遇到的蓝屏错误。This article describes blue screen errors that you may encounter when you boot a Windows Virtual Machine (VM) in Azure. 本文提供用于收集支持票证数据的步骤。It provides steps to help you collect data for a support ticket.

症状Symptom

Windows VM 不启动。A Windows VM doesn't start. 检查启动诊断中的启动屏幕截图时,在蓝色屏幕中看到以下错误消息之一:When you check the boot screenshots in Boot diagnostics, you see one of the following error messages in a blue screen:

  • 你的电脑遇到问题,需要重启。our PC ran into a problem and needs to restart. 我们将收集一些错误信息,然后你就可以重启。We're just collecting some error info, and then you can restart.
  • 你的电脑遇到问题,需要重启。Your PC ran into a problem and needs to restart.

本部分列出管理 VM 时可能遇到的常见错误消息:This section lists the common error messages you may encounter when managing VMs:

原因Cause

收到停止错误可能有多个原因。There could be multiple reasons as why you would get a stop error. 最常见原因是:The most common causes are:

  • 驱动程序存在问题Problem with a driver
  • 系统文件或内存损坏Corrupted system file or memory
  • 应用程序访问内存的禁止扇区An application accesses to a forbidden sector of the memory

收集内存转储文件Collect memory dump file

若要解决此问题,需先收集故障转储文件,然后使用此转储文件联系支持部门。To resolve this problem, you would need first to gather dump file for the crash and contact support with the dump file. 若要收集转储文件,请执行以下步骤:To collect the Dump file, follow these steps:

将 OS 磁盘附加到恢复 VMAttach the OS disk to a recovery VM

  1. 拍摄受影响的 VM 的 OS 磁盘的快照作为备份。Take a snapshot of the OS disk of the affected VM as a backup. 有关详细信息,请参阅拍摄磁盘快照For more information, see Snapshot a disk.
  2. 将 OS 磁盘附加到恢复 VMAttach the OS disk to a recovery VM.
  3. 通过远程桌面连接到恢复 VM。Remote desktop to the recovery VM.

找到转储文件并提交支持票证Locate dump file and submit a support ticket

  1. 在恢复 VM 上,转到附加的 OS 磁盘中的 Windows 文件夹。On the recovery VM, go to windows folder in the attached OS disk. 如果分配给附加 OS 磁盘的驱动器号为 F,则需转到 F:\Windows。If the driver letter that is assigned to the attached OS disk is F, you need to go to F:\Windows.
  2. 找到 memory.dmp 文件,然后使用该转储文件提交支持票证Locate the memory.dmp file, and then submit a support ticket with the dump file.

如果找不到转储文件,请转到下一步以启用转储日志和串行控制台。If you cannot find the dump file, move the next step to enable dump log and Serial Console.

启用转储日志和串行控制台Enable dump log and Serial Console

若要启用转储日志和串行控制台,请运行以下脚本。To enable dump log and Serial Console, run the following script.

  1. 打开提升的命令提示符会话(以管理员身份运行)。Open elevated command Prompt session (Run as administrator).

  2. 运行以下脚本:Run the following script:

    在此脚本中,假定分配给附加 OS 磁盘的驱动器号为 F。将其替换为 VM 中的相应值。In this script, we assume that the drive letter that is assigned to the attached OS disk is F. Replace it with the appropriate value in your VM.

    reg load HKLM\BROKENSYSTEM F:\windows\system32\config\SYSTEM.hiv
    
    REM Enable Serial Console
    bcdedit /store F:\boot\bcd /set {bootmgr} displaybootmenu yes
    bcdedit /store F:\boot\bcd /set {bootmgr} timeout 5
    bcdedit /store F:\boot\bcd /set {bootmgr} bootems yes
    bcdedit /store F:\boot\bcd /ems {<BOOT LOADER IDENTIFIER>} ON
    bcdedit /store F:\boot\bcd /emssettings EMSPORT:1 EMSBAUDRATE:115200
    
    REM Suggested configuration to enable OS Dump
    REG ADD "HKLM\BROKENSYSTEM\ControlSet001\Control\CrashControl" /v CrashDumpEnabled /t REG_DWORD /d 1 /f
    REG ADD "HKLM\BROKENSYSTEM\ControlSet001\Control\CrashControl" /v DumpFile /t REG_EXPAND_SZ /d "%SystemRoot%\MEMORY.DMP" /f
    REG ADD "HKLM\BROKENSYSTEM\ControlSet001\Control\CrashControl" /v NMICrashDump /t REG_DWORD /d 1 /f
    
    REG ADD "HKLM\BROKENSYSTEM\ControlSet002\Control\CrashControl" /v CrashDumpEnabled /t REG_DWORD /d 1 /f
    REG ADD "HKLM\BROKENSYSTEM\ControlSet002\Control\CrashControl" /v DumpFile /t REG_EXPAND_SZ /d "%SystemRoot%\MEMORY.DMP" /f
    REG ADD "HKLM\BROKENSYSTEM\ControlSet002\Control\CrashControl" /v NMICrashDump /t REG_DWORD /d 1 /f
    
    reg unload HKLM\BROKENSYSTEM
    
    1. 请确保磁盘上有足够的空间来分配与 RAM 一样多的内存,具体取决于为此 VM 选择的大小。Make sure that there's enough space on the disk to allocate as much memory as the RAM, which depends on the size that you are selecting for this VM.

    2. 如果没有足够的空间,或者这是大型 VM(E 系列),则可随后更改创建此文件时所在的位置,将该位置指向任何其他附加到 VM 的数据磁盘。If there's not enough space or this is a large size VM (E series), you could then change the location where this file will be created and refer that to any other data disk which is attached to the VM. 为此,需更改以下密钥:To do this, you will need to change the following key:

    reg load HKLM\BROKENSYSTEM F:\windows\system32\config\SYSTEM.hiv
    
    REG ADD "HKLM\BROKENSYSTEM\ControlSet001\Control\CrashControl" /v DumpFile /t REG_EXPAND_SZ /d "<DRIVE LETTER OF YOUR DATA DISK>:\MEMORY.DMP" /f
    REG ADD "HKLM\BROKENSYSTEM\ControlSet002\Control\CrashControl" /v DumpFile /t REG_EXPAND_SZ /d "<DRIVE LETTER OF YOUR DATA DISK>:\MEMORY.DMP" /f
    
    reg unload HKLM\BROKENSYSTEM
    
  3. 分离 OS 磁盘,然后将 OS 磁盘重新附加到受影响的 VMDetach the OS disk and then Re-attach the OS disk to the affected VM.

  4. 启动 VM 以重现问题,然后就会生成转储文件。Start the VM to reproduce the issue, then a dump file will be generated.

  5. 将 OS 磁盘附加到恢复 VM,收集转储文件,然后使用该转储文件提交支持票证Attach the OS disk to a recovery VM, collect dump file, and then submit a support ticket with the dump file.