错误详情

Installing, this may take a few minutes...
参考的对象类型不支持尝试的操作。
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: root
参考的对象类型不支持尝试的操作。

解决方法

方法一

管理员身份运行CMD,执行完成后需要重启电脑,但关机后下次仍然会出现该错误。

netsh winsock reset

方法二(推荐)

使用注册表方式。复制如下代码,新建文件test.reg(文件名可任意取,需以.reg结尾),双击执行。

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinSock2\Parameters\AppId_Catalog\0408F7A3]
"AppFullPath"="C:\\Windows\\System32\\wsl.exe"
"PermittedLspCategories"=dword:80000000