Article directory
Encounter problems
To install wsl on a windows 11 computer, use the command
wsl --install
It shows successful installation. But entering wsl shows the following error
C:\Users\lsz>wsl
Processing fstab with mount -a failed.
<3>WSL (8) ERROR: CreateProcessEntryCommon:370: getpwuid(0) failed 2
<3>WSL (8) ERROR: CreateProcessEntryCommon:374: getpwuid(0) failed 2
<3>WSL (8) ERROR: CreateProcessEntryCommon:577: execvpe /bin/sh failed 2
<3>WSL (8) ERROR: CreateProcessEntryCommon:586: Create process not expected to return
Solution
Reason: This is because Docker Desktop exists on my computer, and the encounter between the two will produce this bug. At this time, the default distro (distribution version) will be the Docker one, which needs to be manually changed to our Ubuntu. The specific operations are as follows:
Using PowerShell, enter
C:\Users\lsz>wsl -l
适用于 Linux 的 Windows 子系统分发:
docker-desktop-data (默认)
Ubuntu
docker-desktop
You can see that the default distribution is docker-desktop-data. We can use the command wsl -s Ubuntu
to set Ubuntu as the default.
The specific commands are as follows:
C:\Users\lsz>wsl -s Ubuntu
操作成功完成。
C:\Users\lsz>wsl -l
适用于 Linux 的 Windows 子系统分发:
Ubuntu (默认)
docker-desktop-data
docker-desktop
After the above operations, the problem is solved. You can enter wsl for testing.
reference
【1】https://github.com/microsoft/WSL/issues/5923