0%

WSL任何操作都报错(退出代码 1603,错误码:Wsl/CallMsi/Install/ERROR_INSTALL_FAILURE)

具体错误信息

PowerShell中运行wsl命令:

1
2
3
4
5
6
WSL 正在完成升级...
Warning 1946.Property 'System.AppUserModel.ID' for shortcut 'WSL.lnk' could not be set.
Warning 1946.Property 'System.AppUserModel.ToastActivatorCLSID' for shortcut 'WSL.lnk' could not be set.
Could not write value to key \SOFTWARE\Classes\Directory\shell\WSL. Verify that you have sufficient access to that key, or contact your support personnel.
更新失败(退出代码: 1603)。
Error code: Wsl/CallMsi/Install/ERROR_INSTALL_FAILURE

解决方法

  1. 开启依赖项:

    在管理员权限的PowerShell,运行:

    1
    2
    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
    Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -NoRestart

    重启Windows 10

  2. 修改注册表:

    键入win+r,打开运行面板,输入regedit,打开注册表编辑器。

    在注册表编辑器中将下述键重命名(最好操作前进行备份):

    1
    2
    3
    4
    5
    6
    7
    8
    9
    // 将下列键
    计算机\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\WSL
    计算机\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\WSL
    计算机\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\WSL

    // 重命名为
    计算机\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\WSL_bak
    计算机\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\WSL_bak
    计算机\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\WSL_bak