排查 Windows 启动管理器错误 - 0xC0000225“找不到状态”Troubleshoot Windows Boot Manager error - 0xC0000225 "Status not found"

本文提供了解决在 Azure VM 中出现错误代码 0xC0000225 的问题的步骤。This article provides steps to resolve issues where error code 0xC0000225 occurs in an Azure VM. 此错误表明找不到状态或对象。This error states that the status or object is not found.

症状Symptoms

使用启动诊断查看 VM 的屏幕截图时,将看到屏幕截图显示 Windows 无法启动错误,状态代码为 0xc0000225。When you use Boot diagnostics to view the screenshot of the VM, you will see that the screenshot displays a Windows failed to start error with the Status code 0xc0000225.

与此错误代码关联的文件将通知你采取哪些步骤来解决问题。The file associated with this error code will inform you which steps to take in order to resolve the issue. 找到“文件:”部分的文本,以确定相应的操作方法。Locate the File: section's text to determine the appropriate course of action.

如果存在文件,但引用了驱动程序(如图所示),或者与 OS 相关或是第三方文件,请按照修复系统文件部分下的步骤进行操作。If the file is present but refers to a driver (as is shown) or is OS related or third party, follow the steps under the section Repair the System File.

在下图中,Windows 启动管理器指出“Windows 未能启动。In the following image, Windows Boot Manager states "Windows failed to start. 原因可能是最近更改了硬件或软件。”A recent hardware or software change might be the cause." 图中还显示“状态”为“0xc0000225”,“文件:”为 \windows\System32\drivers\atapi.sys,“信息:”为“无法加载操作系统,原因是关键系统驱动程序丢失或包含错误。 ”The image also shows the Status as "0xc0000225", File: as \windows\System32\drivers\atapi.sys, and Info: as "The operating system couldn't be loaded because a critical system driver is missing or contains errors."

Windows 启动管理器指出“Windows 未能启动。

无文件No File

如果显示状态代码,但未显示文件,请按照添加 OSDEVICE 变量部分下的步骤进行操作。If presented with the Status code, but no file is shown, follow the steps under the section Add the OSDEVICE Variable.

在下图中,Windows 启动管理器指出“Windows 未能启动。In the following image, Windows Boot Manager states "Windows failed to start. 原因可能是最近更改了硬件或软件。”A recent hardware or software change might be the cause." 图中还显示“状态”为“0xc0000225”,“信息:”为“启动选择失败,因为要求的设备不可访问。”The image also shows the Status as "0xc0000225", and Info: as "The boot selection failed because a required device is inaccessible."

Windows 启动管理器指出“Windows 未能启动。

注册表文件Registry File

如果它引用任何注册表文件,例如 \windows\system32\config\system,请按照创建支持票证部分下的步骤进行操作。If it refers to any of the registry files, such as \windows\system32\config\system, follow the steps under the section Create a Support Ticket.

在下图中,Windows 启动管理器指出“Windows 未能启动。In the following image, Windows Boot Manager states "Windows failed to start. 原因可能是最近更改了硬件或软件。”A recent hardware or software change might be the cause." 图中还显示“状态”为“0xc0000225”,“文件”为 \windows\System32\config\system,“信息:”为“无法加载操作系统,原因是系统注册表文件丢失或包含错误。”The image also shows the Status as "0xc0000225", the File as \windows\System32\config\system, and Info: as "The operating system couldn't be loaded because the system registry file is missing or contains errors."

Windows 启动管理器指出“Windows 未能启动。

在下图中,恢复屏幕显示“你的电脑/设备需要修复。In the following image, the recovery screen states "Your PC/Device needs to be repaired. 无法加载操作系统,原因是系统注册表文件丢失或包含错误。”The operating system couldn't be loaded because the system registry file is missing or contains errors." 图中还显示错误代码为“0xc0000225”,“文件”为 \windows\System32\config\systemThe image also shows the Error code as "0xc0000225" and the File as \windows\System32\config\system.

恢复屏幕显示“你的电脑/设备需要修复。

原因Causes

丢失二进制文件Missing Binary

在系统 (.sys) 文件中,可能会遇到二进制文件丢失或损坏的问题。You may be encountering missing or corrupted binary on your System (.sys) file.

BCD 损坏或 VHD 迁移不当BCD Corruption or Improper VHD Migration

在这种情况下,要么引导配置数据 (BCD) 已损坏,要么虚拟硬盘 (VHD) 已从本地迁移,但准备不充分 。In this case, either the Boot Configuration Data (BCD) is corrupted, or the virtual hard drive (VHD) was migrated from on-premises, but wasn't properly prepared. 结果导致 OSDEVICE 变量丢失,需要添加该变量。The result is that the OSDEVICE variable is missing and will need to be added.

注册表配置单元损坏Registry Hive Corruption

注册表配置单元损坏可能是由于:A registry hive corruption could be due to:

  • 配置单元失败The Hive fails
  • 配置单元已装载,但为空The Hive mounts, but is empty
  • 未正确关闭配置单元The Hive was not closed properly

解决方案Solution

流程概述Process Overview

  1. 创建并访问修复 VM。Create and access a Repair VM.
  2. 选择解决方案:Select a Solution:
  3. 启用串行控制台和内存转储收集。Enable serial console and memory dump collection.
  4. 重新生成 VM。Rebuild the VM.

创建并访问修复 VMCreate and Access a Repair VM

  1. 使用 VM 修复命令 的步骤 1-3 准备一个修复 VM。Use steps 1-3 of the VM Repair Commands to prepare a Repair VM.
  2. 使用远程桌面连接来连接到修复 VM。Using Remote Desktop Connection, connect to the Repair VM.

选择解决方案Select a Solution

  1. 打开权限提升的命令提示符。Open an elevated command prompt.
  2. 根据之前确定的症状,执行相应解决方案中的步骤。Based on the symptom that you identified earlier, follow the steps in the corresponding solution. 你可以跳过其他解决方案中的步骤,因为它们不适用于你的问题:You may skip the steps in the other solutions, as they won't apply to your issue:

修复系统文件Repair the System File

  1. 使用附加的 VHD,导航到虚拟机 (VM) 屏幕截图中显示的二进制文件的文件位置。Using the attached VHD, navigate to the file location of the binary shown in your virtual machine (VM) screenshot.

  2. 右键单击该文件,选择“属性”,然后选择“详细信息”选项卡以查看文件信息。Right-click the file, select Properties, and then select the Details tab to see information on the file.

    1. 请注意文件版本,如下图所示:Note the version of the file, as shown in the image below:

      “cng.sys”文件的属性窗口,突出显示了文件版本。

  3. 将该文件重命名为 < BINARY.SYS >.old,并将 < BINARY.SYS > 替换为该文件的名称。Rename the file to < BINARY.SYS >.old, replacing < BINARY.SYS > with the name of the file.

    对于上一步中的图像,文件 cng.sys 将重命名为 cng.sys.oldFor the image in the step above, the file cng.sys would be renamed to cng.sys.old

    备注

    如果尝试重命名该文件,但收到消息“文件已损坏且无法读取”,请联系支持部门寻求帮助,因为此解决方案将不起作用。If you try to rename the file and receive the message "The file is corrupted and unreadable", contact support for assistance, as this solution will not work.

  4. 现在,损坏的文件已重命名,请通过从其内部存储库中还原来修复该文件。Now that the corrupt file is renamed, fix the file by restoring it from its internal repository.

    1. 启动 CMD 会话。Launch a CMD session.

    2. 导航到 \windows\winsxs。Navigate to \windows\winsxs.

    3. 使用以下命令搜索位于此部分开头的二进制文件:Search for the binary located at the beginning of this section using the following command:

      dir <BINARY WITH ".SYS" EXTENSION> /s

      此命令将列出计算机拥有的该文件的所有版本,并提供该组件的路径历史记录。This command will list all versions of the file that the machine has, giving you the path history of that component.

      例如,dir cng.sys 将重命名为 dir cng.sys /sFor example, dir cng.sys would be renamed dir cng.sys /s

    4. 在列表中选择该文件的最新版本(或你喜欢的任何版本),然后使用先前的路径和以下命令将该文件复制到 windows\system32 文件夹中:Choose the latest version of the file on the list (or any that you prefer) and copy the file to the windows\system32 folder using previous path and the following command:

      copy <drive>:\Windows\WinSxS\<DIRECTORY WHERE FILE IS>\<BINARY WITH ".SYS" EXTENSION> <DRIVE>:\Windows\System32\Drivers\

      备注

      如果最新的二进制文件不起作用,请尝试使用该版本之前的版本,或者任何已知存在稳定文件的版本,例如应用补丁前的版本。If the latest binary didn't work, try a version before that one, or any of which you know there is a stable file, such as a version before a patch.

      例如,如果你要查找的二进制文件是 cmimcext.sys,故障驱动器为驱动器 F:,并且你刚刚运行了最新版本搜索,那么,你将看到下图,命令提示符 dir cmim* /s 中的查询找到了 cmimcext.sys 文件的最新版本。For example, if the binary you are looking for is cmimcext.sys, the faulty drive is drive F:, and you just ran a search for the latest version, you would see the following image, where a query in command prompt of dir cmim* /s locates the latest version of the cmimcext.sys file.

      命令提示符“dir cmim* /s”中的查询,用于查找 cmimcext.sys 文件的最新版本。

      在上面的示例图中,查询是在 C: 上执行的,但驱动器号应为故障驱动器 F: 的驱动器号,该驱动器是作为修复 VM 上的数据磁盘附加的 OS 磁盘。In the example image above, the query was performed on C:, whereas the drive letter should be that of the faulty drive, F:, which is the OS disk attached as a data disk on the repair VM.

      最终用于复制文件的命令为:copy F:\Windows\WinSxS\amd64_xxxxxx\cmimcext.sys F:\Windows\System32\DriversThe resulting command to copy the file would be: copy F:\Windows\WinSxS\amd64_xxxxxx\cmimcext.sys F:\Windows\System32\Drivers.

完成此任务后,继续启用串行控制台和内存转储收集Once this task is complete, continue to Enable the Serial Console and memory dump collection.

添加 OSDEVICE 变量Add the OSDEVICE Variable

收集当前启动设置信息,并记下活动分区上的标识符。Collect the current booting setup information and note the identifier on the active partition. 然后,按照 VM 生成说明,使用此信息添加 OSDEVICE 变量。You will then use this information to add the OSDEVICE variable, following the directions for the generation of your VM.

如果此信息收集给出没有 \boot\bcd 文件的错误,则改用修复系统文件中的说明。If this information collection gives an error where there's no \boot\bcd file, then use the instructions in Repair the System File instead.

  1. 对于第 1 代 VM,请以管理员身份打开权限提升的命令提示符,然后输入以下命令:For Generation 1 VMs, open an elevated command prompt as an Administrator and enter the following command:

    bcdedit /store <LETTER OF BOOT FOLDER>:\boot\bcd /enum

    此图显示了第 1 代 VM 中的 Windows 启动加载程序,并突出显示了标识符属性。This image shows Windows Boot Loader in a Generation 1 VM, with the identifier attribute highlighted. 突出显示的标识符属性显示了唯一的字母数字字符串。The identifier attribute highlighted shows a unique alphanumeric string.

    Windows 启动加载程序显示在第 1 代 VM 中,并突出显示了标识符属性。突出显示的标识符属性显示了唯一的字母数字字符串。

    记下 Windows 启动加载程序的标识符,其路径为 \windows\system32\winload.exe。Note the identifier of the Windows Boot Loader, whose path is \windows\system32\winload.exe.

  2. 对于第 2 代 VM,请验证 OS 磁盘是否联机,以及是否分配了分区驱动器号。For Generation 2 VMs, verify both that the OS disk is online, and that its partition drive letters have been assigned. 验证后,收集启动设置信息。When this has been verified, collect the boot setup information.

    1. 在“Windows 搜索”中,键入“磁盘管理”,然后打开磁盘管理控制台 。In Windows search, type Disk Management and open the disk management console. 使用此控制台可以识别修复 VM 上附加的磁盘号以及保存 BCD 存储的可扩展固件接口 (EFI) 分区。Use this console to identify the disk number attached on your repair VM and the Extensible Firmware Interface (EFI) partition which holds the BCD store.

      在下图中,磁盘 2 是附加到修复 VM 的磁盘号。In the following image, Disk 2 is the disk number attached to the Repair VM. 该图还显示了磁盘 2 上的 EFI 系统分区,该分区的大小为 100MB,并且未分配盘符。The image also shows the EFI System Partition on Disk 2, which is 100MB in size and doesn't have an assigned letter.

      磁盘 2 显示为附加到修复 VM 的磁盘号。它还显示了磁盘 2 上的 EFI 系统分区,该分区为 100MB,并且未分配盘符。

    2. 以管理员身份打开权限提升的命令提示符,然后输入以下命令:Open an elevated command prompt as an Administrator and enter the following commands:

      1. 使用 diskpart 命令打开 DISKPART TOOL。Open the DISKPART TOOL using the command diskpart.

      2. 列出所有磁盘,然后选择上一步中标识的附加磁盘:List all disks, then select the attached disk identified in the previous step:

        list disk
        sel disk <DISK #>
        

        下图显示了列出和选择磁盘的结果。The following image shows the results of listing and selecting a disk. 列出了 Disk 0 (127 GB / Online)、Disk 1 (32 GB / Online) 和 Disk 2 (127 GB / Online),并使用 sel disk 2 命令选择了 Disk 2。Disk 0 (127 GB / Online), Disk 1 (32 GB / Online), and Disk 2 (127 GB / Online) are listed, with Disk 2 being selected using the command sel disk 2.

        列出并选择磁盘的结果。列出了 Disk 0 (127 GB | Online)、Disk 1 (32 GB | Online) 和 Disk 2 (127 GB | Online),并选择了 Disk 2。

      3. 列出分区,并选择上一步中标识的 EFI 系统分区:List the partitions and select the EFI system partition identified in the previous step:

        list partition
        sel partition <PARTITION #>
        

        下图显示了列出和选择分区的结果。The following image shows the results of listing and selecting a partition. 列出了 Partition 1 (Reserved / 16MB)、Partition 2 (System / 100MB) 和 Partition 3 (Primary / 126 GB),并使用 sel part 2 命令选择了 Partition 2。Partition 1 (Reserved / 16MB), Partition 2 (System / 100MB), and Partition 3 (Primary / 126 GB) are listed, with Partition 2 being selected using the command sel part 2.

        列出并选择分区的结果。列出了 Partition 1 (Reserved | 16MB)、Partition 2 (System | 100MB) 和 Partition 3 (Primary | 126 GB),并选择了 Partition 2。

      4. 使用 assign 命令向 EFI 分区分配一个盘符。Assign a letter to the EFI partition using the command assign.

        在下图中,可以在文件资源管理器中看到 assign 命令和新驱动器 SYSTEM (F:)。In the following image, the assign command and the new drive SYSTEM (F:) are both viewable in File Explorer.

        可以在文件资源管理器中看到 assign 命令和新驱动器 SYSTEM (F:)。

      5. 使用以下命令列出 BCD 存储数据:List the BCD store data using the following command:

        bcdedit /store <LETTER OF EFI SYSTEM PARTITION>:EFI\Microsoft\boot\bcd /enum

        在下图中,Windows 启动加载程序位于第 2 代 VM 中,并突出显示了标识符属性。In the following image, Windows Boot Loader is in a generation 2 VM with the identifier attribute highlighted. 突出显示的标识符属性的值为 {default}。The highlighted identifier attribute has a value of {default}.

        Windows 启动加载程序显示在第 2 代 VM 中,并突出显示了标识符属性。突出显示的标识符属性将 default 显示为其值。

        记下 Windows 启动加载程序的标识符,其路径为 \windows\system32\winload.efi。Note the identifier of the Windows Boot Loader, whose path is \windows\system32\winload.efi.

  3. 请注意,活动分区上缺少 OSDEVICE 变量:Notice that the OSDEVICE variable on the active partition is missing:

    命令提示符中列出了 Windows 启动管理器和 Windows 启动加载程序的属性,其中缺少 OSDEVICE 属性。

    在此图中,命令提示符中列出了 Windows 启动管理器和 Windows 启动加载程序的属性,但缺少 OSDEVICE 属性。In this image, Windows Boot Manager and Windows Boot Loader's attributes are listed in the command prompt, but the OSDEVICE attribute is missing.

  4. 根据以下信息添加 OSDEVICE 变量:Add the OSDEVICE variable based on the following information:

    对于单分区 OS 磁盘,请添加 BOOTFor single partitions OS disks, add BOOT.

    备注

    可启动文件夹将与 Windows 文件夹 \windows folder 位于同一分区。The boot-able folder will be on the same partition as the windows folder \windows folder.

    • 第 1 代 VM 的可引导文件夹为 (\boot\bcd folder)。The bootable folder for Generation 1 VMs is (\boot\bcd folder).
    • 第 2 代 VM 的可引导文件夹为 EFI\Microsoft\boot\bcd。The bootable folder for Generation 2 VMs is EFI\Microsoft\boot\bcd.

    对于第 1 代 VM,请输入以下命令:For Generation 1 VMs, enter the following command:

    bcdedit /store <LETTER OF BOOT FOLDER>:\boot\bcd /set {<IDENTIFIER>} OSDEVICE BOOT

    对于第 2 代 VM,请输入以下命令:For Generation 2 VMs, enter the following command:

    bcdedit /store <LETTER OF EFI FOLDER>:EFI\Microsoft\boot\bcd /set {<IDENTIFIER>} OSDEVICE BOOT

    对于多分区 OS 磁盘,请添加 PARTITION=<LETTER OF WINDOWS FOLDER>:For multiple partition OS disks, add PARTITION=<LETTER OF WINDOWS FOLDER>:.

    备注

    可启动文件夹很可能与 Windows 文件夹 \windows folder 位于不同的分区。The boot-able folder will most likely be on a different partition than the windows folder \windows folder.

    • 第 1 代 VM 的可引导文件夹为 (\boot\bcd folder)。The bootable folder for Generation 1 VMs is (\boot\bcd folder).
    • 第 2 代 VM 的可引导文件夹为 EFI\Microsoft\boot\bcd。The bootable folder for Generation 2 VMs is EFI\Microsoft\boot\bcd.

    对于第 1 代 VM,请输入以下命令:For Generation 1 VMs, enter the following command:

    bcdedit /store <LETTER OF BOOT FOLDER>:\boot\bcd /set {<IDENTIFIER>} OSDEVICE partition=<LETTER OF WINDOWS FOLDER>:

    对于第 2 代 VM,请输入以下命令:For Generation 2 VMs, enter the following command:

    bcdedit /store <LETTER OF EFI FOLDER>:EFI\Microsoft\boot\bcd /set {< IDENTIFIER>} OSDEVICE partition=<LETTER OF WINDOWS FOLDER>:

完成此任务后,继续启用串行控制台和内存转储收集Once this task is complete, continue to Enable the Serial Console and memory dump collection.

联系支持人员Contact Support

注册表文件错误已解决,但你需要创建支持票证来获取更多帮助。The Registry File error has a solution, but you will need to create a support ticket for further assistance.

启用串行控制台和内存转储收集Enable the Serial Console and memory dump collection

建议:在重新生成 VM 之前,通过运行以下脚本来启用串行控制台和内存转储收集:Recommended: Before you rebuild the VM, enable the Serial Console and memory dump collection by running the following script:

  1. 以管理员身份打开权限提升的命令提示符会话。Open an elevated command prompt session as an Administrator.

  2. 运行以下命令:Run the following commands:

    启用串行控制台Enable the Serial Console:

    bcdedit /store <VOLUME LETTER WHERE THE BCD FOLDER IS>:\boot\bcd /ems {<BOOT LOADER IDENTIFIER>} ON 
    bcdedit /store <VOLUME LETTER WHERE THE BCD FOLDER IS>:\boot\bcd /emssettings EMSPORT:1 EMSBAUDRATE:115200
    
  3. 验 OS 磁盘上的可用空间是否大于 VM 上的内存大小 (RAM)。Verify that the free space on the OS disk is larger than the memory size (RAM) on the VM.

    如果 OS 磁盘上没有足够的空间,请更改将要创建内存转储文件的位置,并将该位置引用到具有足够可用空间的 VM 上附加的任何数据磁盘。If there's not enough space on the OS disk, change the location where the memory dump file will be created, and refer that location to any data disk attached to the VM that has enough free space. 若要更改位置,请在以下命令中将 %SystemRoot% 替换为数据磁盘的驱动器号(例如,F:)。To change the location, replace %SystemRoot% with the drive letter of the data disk, such as F:, in the following commands.

    用于启用 OS 转储的建议配置:Suggested configuration to enable OS Dump:

    从损坏的 OS 磁盘加载注册表配置单元:Load Registry Hive from the broken OS Disk:

    REG LOAD HKLM\BROKENSYSTEM <VOLUME LETTER OF BROKEN OS DISK>:\windows\system32\config\SYSTEM
    

    在 ControlSet001 上启用:Enable on ControlSet001:

    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 
    

    在 ControlSet002 上启用:Enable on ControlSet002:

    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 
    

    卸载损坏的 OS 磁盘:Unload Broken OS Disk:

    REG UNLOAD HKLM\BROKENSYSTEM
    

重新生成 VMRebuild the VM

使用 VM 修复命令的步骤 5 重新生成 VM。Use step 5 of the VM Repair Commands to rebuild the VM.