wsl docker 和 ubuntu 衝突問題

antor發表於2024-03-25

https://blog.csdn.net/weixin_44825912/article/details/136565219

問題如下:

    wsl安裝成功,但開啟時出現多行報錯無法使用。

PS C:\WINDOWS\system32> wsl
<3>WSL (8) ERROR: CreateProcessParseCommon:754: getpwuid(0) failed 2
Processing fstab with mount -a failed.
<3>WSL (8) ERROR: CreateProcessEntryCommon:331: getpwuid(0) failed 2
<3>WSL (8) ERROR: CreateProcessEntryCommon:502: execvpe /bin/sh failed 2
<3>WSL (8) ERROR: CreateProcessEntryCommon:505: Create process not expected to return
這是因為我的電腦上安裝過Docker Desktop,而Ubuntu和它在一起會出現這個bug。此時預設的發行版是Docker-desktop-data,需要我們手動更改到Ubuntu-版本號。

解決方案:

輸入wsl --list --verbose命令檢視,會發現發行版預設為docker-desktop-data。

接著輸入wsl -s Ubuntu-22.04更改發行版為Ubuntu-版本號。

再次檢視,發現已經更改成功,並能使用wsl命令進入。

————————————————

                        版權宣告:本文為博主原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處連結和本宣告。

原文連結:https://blog.csdn.net/weixin_44825912/article/details/136565219

相關文章