Docker / WSL / Windows 虚拟化功能回滚故障修复记录
生成时间:2026-06-28
机器环境:Windows 10 Pro 19045
相关组件:Docker Desktop、WSL、Virtual Machine Platform、Windows CBS、NetCfg、VMware Bridge Protocol
1. 问题现象
Docker Desktop 启动失败,提示大意是:
text
Docker Desktop failed to start because virtualisation support wasn't detected.
Sign in to try restoring access to Docker features.
一开始看起来像是 Docker 检测不到虚拟化,但后续检查确认:
- BIOS/固件虚拟化已经开启。
- 任务管理器显示 CPU 虚拟化已启用。
- CPU 支持虚拟化扩展和二级地址转换。
- Windows 功能界面可以勾选
Virtual Machine Platform和Windows Subsystem for Linux。 - 但是重启后,这两个 Windows 功能又会被回滚成 Disabled。
wsl --status报WSL_E_WSL_OPTIONAL_COMPONENT_REQUIRED。
所以核心不是 Docker 本体,也不是硬件虚拟化没开,而是 Windows 可选功能启用后,在重启阶段被 CBS 回滚。
2. 最终根因一句话
VMware Bridge Protocol 的 Windows 网络组件注册损坏,COM/TypeLib 路径指向不存在的 F:\vmnetbridge.dll。Windows 在启用 WSL / Virtual Machine Platform 时需要安装 ms_l2bridge 网络驱动,安装过程中 NetCfg 会调用已注册网络组件的 Notify Objects。这个损坏的 VMware Bridge 通知对象加载失败,触发 0x8007007e / ERROR_MOD_NOT_FOUND,随后 CBS 判定网络驱动安装失败并回滚 WSL / Virtual Machine Platform。
完整链路:
text
Docker Desktop 启动失败
-> Docker 依赖 WSL2
-> WSL2 依赖 Virtual Machine Platform
-> Virtual Machine Platform 启用需要 CBS 在重启阶段提交
-> CBS 安装网络驱动 ms_l2bridge
-> NetSetupAI.dll 调用 NetCfg Notify Objects
-> VMware Bridge Protocol 注册损坏,指向 F:\vmnetbridge.dll
-> NetCfg 加载通知对象失败,返回 0x8007007e
-> CBS 返回 0x800f0922 并回滚
-> WSL 功能消失,Docker 报虚拟化不可用
3. 关键错误码
text
0x8007007e = ERROR_MOD_NOT_FOUND
0x800f0922 = CBS_E_INSTALLERS_FAILED
0x800f0826 = 前面失败后的跟随/回滚症状
CBS 日志中的关键证据:
text
Installing network driver ms_l2bridge
An error was detected by the NetSetup plugin:
'Invoke NetCfg Notify Objects for install'
Failed execution of queue item Installer: Network Drivers
with HRESULT HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND)
Installer: Network Drivers
Binary Name: NetSetupAI.dll
ErrorCode: 8007007e
Phase: 31
Mode: Delta
Startup: Failed to process advanced operation queue
[HRESULT = 0x800f0922 - CBS_E_INSTALLERS_FAILED]
这说明失败点发生在 Windows 网络驱动高级安装阶段,不是在 Docker 应用层。
4. 初始状态检查命令
检查 Windows 功能状态:
powershell
foreach ($f in 'VirtualMachinePlatform','Microsoft-Windows-Subsystem-Linux','Microsoft-Hyper-V-All') {
Get-WindowsOptionalFeature -Online -FeatureName $f |
Select-Object FeatureName,State,RestartNeeded
}
检查 WSL:
powershell
wsl --status
检查 CBS pending:
powershell
Test-Path C:\Windows\WinSxS\pending.xml
Test-Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending'
检查 CBS 错误:
powershell
Select-String -Path 'C:\Windows\Logs\CBS\CBS.log' `
-Pattern 'Error CSI|Error CBS|Failed execution|Binary Name|ErrorCode|8007007e|800f0922|800f0826|Network Drivers|ms_l2bridge|Invoke NetCfg|Failed to process advanced operation queue' |
Select-Object -Last 220 |
ForEach-Object { '{0}:{1}: {2}' -f $_.Path,$_.LineNumber,$_.Line.Trim() }
检查 setupapi:
powershell
Select-String -Path 'C:\Windows\INF\setupapi.dev.log','C:\Windows\INF\setupapi.app.log' `
-Pattern 'l2bridge|ms_l2bridge|vmnetbridge|0x8007007e|!!!|failed|error|NetCfg|Notify' |
Select-Object -Last 220 |
ForEach-Object { '{0}:{1}: {2}' -f $_.Path,$_.LineNumber,$_.Line.Trim() }
5. 已确认的行为模式
执行:
powershell
DISM.exe /Online /Enable-Feature /FeatureName:VirtualMachinePlatform /All /NoRestart
DISM.exe /Online /Enable-Feature /FeatureName:Microsoft-Windows-Subsystem-Linux /All /NoRestart
DISM 会显示:
text
The operation completed successfully.
重启前状态看似成功:
text
VirtualMachinePlatform Enabled
Microsoft-Windows-Subsystem-Linux Enabled
pending.xml PRESENT
CBS RebootPending PRESENT
但重启后又回滚:
text
VirtualMachinePlatform Disabled
Microsoft-Windows-Subsystem-Linux Disabled
pending.xml ABSENT
CBS RebootPending ABSENT
wsl --status WSL_E_WSL_OPTIONAL_COMPONENT_REQUIRED
这证明问题发生在重启阶段的 CBS pending 操作提交过程中。
6. 修复步骤记录
6.1 修复 WCP.dll 缺失
早期排查发现 NetSetupAI.dll 的依赖链里有系统组件缺失:
text
C:\Windows\System32\WCP.dll
C:\Windows\SysWOW64\WCP.dll
从 WinSxS 中找到对应版本并恢复:
text
C:\Windows\WinSxS\amd64_microsoft-windows-servicingstack_31bf3856ad364e35_10.0.19041.6465_none_7e0fb53c7c8be091\wcp.dll
C:\Windows\WinSxS\x86_microsoft-windows-servicingstack_31bf3856ad364e35_10.0.19041.6465_none_21f119b8c42e6f5b\wcp.dll
恢复目标:
text
C:\Windows\System32\WCP.dll
C:\Windows\SysWOW64\WCP.dll
验证签名有效,版本为 10.0.19041.6465。
结果:修复了一个缺失依赖,但重启后仍然回滚,所以它不是唯一根因。
6.2 恢复 l2bridge.sys
CBS 指向 ms_l2bridge,检查发现:
text
C:\Windows\System32\drivers\l2bridge.sys
曾经缺失。源文件位于:
text
C:\Windows\WinSxS\amd64_microsoft-windows-l2bridge-filter-driver_31bf3856ad364e35_10.0.19041.3636_none_892f0398f4604b85\l2bridge.sys
恢复到:
text
C:\Windows\System32\drivers\l2bridge.sys
验证签名有效。
结果:重启后仍然回滚,且 l2bridge.sys 又被回滚清掉。说明缺失的 l2bridge.sys 更像是回滚结果或中间症状,不是稳定根因。
6.3 恢复 VMware Bridge 运行时文件
netcfg -s n 显示:
text
vmware_bridge VMware Bridge Protocol
ms_bridge Microsoft MAC Bridge
VMware Bridge 网络组件注册位置:
text
HKLM\SYSTEM\CurrentControlSet\Control\Network\
{4d36e974-e325-11ce-bfc1-08002be10318}\
{49444745-4252-4554-79AC-EA6CADE4227F}\Ndi
关键值:
text
ComponentId: vmware_bridge
Description: VMware Bridge Protocol
Service: VMnetBridge
ClsID: {3d09c1ca-2bcc-40b7-b9bb-3f3ec143a87b}
ComponentDll: vmnetbridge.dll
发现 VMware Bridge 文件缺失:
text
C:\Windows\System32\vmnetbridge.dll
C:\Windows\System32\drivers\vmnetbridge.sys
从 DriverStore 找到源文件:
text
C:\Windows\System32\DriverStore\FileRepository\netbridge.inf_amd64_795340d0273da4f7\
恢复:
text
C:\Windows\System32\vmnetbridge.dll
C:\Windows\System32\drivers\vmnetbridge.sys
C:\Windows\System32\drivers\vmnet.sys
验证:
text
vmnetbridge.dll Signature: Valid
vmnetbridge.sys Signature: Valid
vmnet.sys Signature: Valid
还检查了 vmnetbridge.dll 的直接依赖,普通 DLL 都存在:
text
ADVAPI32.dll
KERNEL32.dll
ole32.dll
OLEAUT32.dll
USER32.dll
VCRUNTIME140.dll
VCRUNTIME140_1.dll
结果:DLL 本身可以被加载,但 CBS 仍然在 NetCfg Notify Objects 阶段报 0x8007007e,说明还存在注册路径问题。
6.4 修复 VMware Bridge COM InProcServer32
检查 CLSID:
text
{3d09c1ca-2bcc-40b7-b9bb-3f3ec143a87b}
发现:
text
HKLM\SOFTWARE\Classes\CLSID\{3d09c1ca-2bcc-40b7-b9bb-3f3ec143a87b}\InProcServer32
原值错误:
text
F:\vmnetbridge.dll
修复为:
text
C:\Windows\System32\vmnetbridge.dll
修复前备份:
text
C:\Users\Administrator\Documents\New project\diagnostics\vmware_bridge-clsid-before-fix-20260628-014348.reg
修复后验证:
text
HKEY_CLASSES_ROOT\CLSID\{3d09c1ca-2bcc-40b7-b9bb-3f3ec143a87b}\InProcServer32
(Default) REG_SZ C:\Windows\System32\vmnetbridge.dll
ThreadingModel REG_SZ Both
这是最关键的修复点,因为 CBS 失败点正是 NetCfg 调用网络组件通知对象。
6.5 修复 VMware Bridge TypeLib 残留路径
后续又发现 TypeLib 里还有两个残留错误路径:
text
HKLM\SOFTWARE\Classes\TypeLib\{16A76DDB-46C2-4AB4-9A74-755B80DDEB4E}\1.0\0\win64
(Default) REG_SZ F:\vmnetbridge.dll
HKLM\SOFTWARE\Classes\WOW6432Node\TypeLib\{16A76DDB-46C2-4AB4-9A74-755B80DDEB4E}\1.0\0\win64
(Default) REG_SZ F:\vmnetbridge.dll
修复前备份:
text
C:\Users\Administrator\Documents\New project\diagnostics\vmware_bridge-typelib-20260628-015826.reg
修复为:
text
C:\Windows\System32\vmnetbridge.dll
验证:
text
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{16A76DDB-46C2-4AB4-9A74-755B80DDEB4E}\1.0\0\win64
(Default) REG_SZ C:\Windows\System32\vmnetbridge.dll
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\WOW6432Node\TypeLib\{16A76DDB-46C2-4AB4-9A74-755B80DDEB4E}\1.0\0\win64
(Default) REG_SZ C:\Windows\System32\vmnetbridge.dll
备注:TypeLib 的 HELPDIR 仍然显示 F:,但它不是 DLL 加载路径,通常不会造成 ERROR_MOD_NOT_FOUND,所以没有继续扩大修改范围。
7. 修复后重新启用 Windows 功能
执行:
powershell
DISM.exe /Online /Enable-Feature /FeatureName:VirtualMachinePlatform /All /NoRestart
DISM.exe /Online /Enable-Feature /FeatureName:Microsoft-Windows-Subsystem-Linux /All /NoRestart
DISM 返回成功。重启前:
text
VirtualMachinePlatform Enabled
Microsoft-Windows-Subsystem-Linux Enabled
pending.xml True
CBS RebootPending True
这表示功能启用请求已经进入 pending,需要重启才能提交。
8. 最终重启后验证
重启后启动时间:
text
LastBootUpTime : 2026-06-28 02:01:20
功能状态:
text
FeatureName State RestartNeeded
----------- ----- -------------
VirtualMachinePlatform Enabled False
Microsoft-Windows-Subsystem-Linux Enabled False
Microsoft-Hyper-V-All Disabled False
CBS pending 状态:
text
pending.xml: False
CBS RebootPending: False
wsl --status 不再报:
text
WSL_E_WSL_OPTIONAL_COMPONENT_REQUIRED
继续执行:
powershell
wsl --update
wsl --set-default-version 2
wsl --status
结果:WSL 默认版本已设置为 2。
9. Docker Desktop 最终验证
Docker Desktop 路径存在:
text
C:\Program Files\Docker\Docker\Docker Desktop.exe
C:\Program Files\Docker\Docker\resources\com.docker.backend.exe
启动:
powershell
Start-Process -FilePath 'C:\Program Files\Docker\Docker\Docker Desktop.exe'
确认进程:
text
Docker Desktop
com.docker.backend
验证 Docker Engine:
powershell
docker version --format '{{json .}}'
成功返回:
text
Client Version: 29.5.3
Server Platform: Docker Desktop 4.78.0 (229452)
Server Version: 29.5.3
Server OS: linux
Server Arch: amd64
KernelVersion: 6.18.33.2-microsoft-standard-WSL2
检查 WSL 发行版:
powershell
wsl -l -v
结果:
text
NAME STATE VERSION
docker-desktop Running 2
检查 Docker CLI:
powershell
docker ps
结果正常返回空容器列表:
text
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
最终结论:
text
Docker Desktop 已经能够通过 WSL2 正常连接 Docker Engine。
10. 备份文件
text
C:\Users\Administrator\Documents\New project\diagnostics\docker-wsl-virtualization-repair-handoff-20260628.md
C:\Users\Administrator\Documents\New project\diagnostics\vmware_bridge-network-20260628-013228.reg
C:\Users\Administrator\Documents\New project\diagnostics\vmware_bridge-clsid-before-fix-20260628-014348.reg
C:\Users\Administrator\Documents\New project\diagnostics\vmware_bridge-typelib-20260628-015826.reg
C:\Users\Administrator\Documents\New project\diagnostics\docker-wsl-virtualization-repair-cn-20260628.md
11. 如果以后复发,优先查这些
先不要重装 Docker。先判断是不是 Windows 功能又被 CBS 回滚。
检查功能:
powershell
foreach ($f in 'VirtualMachinePlatform','Microsoft-Windows-Subsystem-Linux','Microsoft-Hyper-V-All') {
Get-WindowsOptionalFeature -Online -FeatureName $f |
Select-Object FeatureName,State,RestartNeeded
}
wsl --status
'pending.xml: ' + (Test-Path 'C:\Windows\WinSxS\pending.xml')
'CBS RebootPending: ' + (Test-Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending')
检查 CBS:
powershell
Select-String -Path 'C:\Windows\Logs\CBS\CBS.log' `
-Pattern 'Error CSI|Error CBS|Failed execution|Binary Name|ErrorCode|8007007e|800f0922|800f0826|Network Drivers|ms_l2bridge|Invoke NetCfg|Failed to process advanced operation queue' |
Select-Object -Last 220 |
ForEach-Object { '{0}:{1}: {2}' -f $_.Path,$_.LineNumber,$_.Line.Trim() }
检查 VMware Bridge:
powershell
netcfg -s n | Select-String -Pattern 'vmware_bridge|ms_l2bridge|ms_bridge'
reg query 'HKLM\SOFTWARE\Classes\CLSID\{3d09c1ca-2bcc-40b7-b9bb-3f3ec143a87b}\InProcServer32'
reg query 'HKLM\SOFTWARE\Classes\TypeLib\{16A76DDB-46C2-4AB4-9A74-755B80DDEB4E}\1.0\0\win64'
reg query 'HKLM\SOFTWARE\Classes\WOW6432Node\TypeLib\{16A76DDB-46C2-4AB4-9A74-755B80DDEB4E}\1.0\0\win64'
期望 DLL 路径为:
text
C:\Windows\System32\vmnetbridge.dll
检查关键文件:
powershell
Test-Path C:\Windows\System32\vmnetbridge.dll
Test-Path C:\Windows\System32\drivers\vmnetbridge.sys
Test-Path C:\Windows\System32\drivers\vmnet.sys
Test-Path C:\Windows\System32\WCP.dll
Test-Path C:\Windows\System32\NetSetupAI.dll
12. 经验总结
这次最容易被误导的是 Docker 的报错文案。它说虚拟化不可用,但真正不可用的是 Docker 所依赖的 WSL2 环境;而 WSL2 不可用,是因为 Windows 的 Virtual Machine Platform 功能在重启阶段被 CBS 回滚。
真正有效的排查路径是:
text
Docker Desktop
-> WSL2
-> Windows Optional Features
-> CBS pending operation
-> NetSetupAI.dll
-> ms_l2bridge
-> NetCfg Notify Objects
-> VMware Bridge Protocol COM registration
最终修复点不在 Docker,而在 VMware Bridge Protocol 的注册表路径和运行时文件。