解决windows下WslRegisterDistribution failed with error: 0x80070050的问题

2022年5月20日13:17:58

最近升级了老电脑的windows10的系统,发现wsl2里面安装的ubuntu20.04不能在windows terminal正常启动了(我之前是把ubuntu20.04作为默认启动终端的。)

涉及报错:

WslRegisterDistribution failed with error: 0x80070050

我的思考:

报错是说wsl的distribution注册不了,所以需要在注册表里面编辑distribution相关配置项来解决问题。

解决办法:

Please backup (using the steps I mention in my previous answer) before trying this.
wsl --shutdown (from PowerShell or CMD)
In Windows, run the Registry Editor
Find \HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss
Find the key in there that has DistributionName of Ubuntu20.04LTS. Change the Ubuntu20.04LTS to Ubuntu-20.04.
In theory, that may fix the problem by changing the distribution name back to what it should be.

按照这个步骤能顺利解决问题,最终能在windows terminal里面成功运行ubuntu20.04.看来windows10的注册表有自己的一套命名规范,大家只能去follow它的要求。

参考了很多资料,有的说是dns的问题,有的是说虚拟机配置的问题,其实都是文不对题,没有找到根本原因,记录这篇文章也是想给在苦苦google+bing解决办法的同学节约一点时间,所有问题最终都要回到报错信息本身去找突破。说的distribution那么一定要往distribution的register相关配置去想。当然能早点脱离windows是最好的,这样会少一些折腾环境的事儿。

毕竟时间真的宝贵,用在刀刃上吧。
参考资料
https://askubuntu.com/questions/1401830/wsl-not-working-after-update-from-microsoft-store

  • 作者:freephp
  • 原文链接:https://www.cnblogs.com/freephp/p/16152315.html
    更新时间:2022年5月20日13:17:58 ,共 996 字。