解決windows下WslRegisterDistribution failed with error: 0x80070050的問題

freephp發表於2022-04-16

最近升級了老電腦的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

相關文章