Windows Subsystem for Linux (WSL) Troubleshooting
I recently encountered an issue with a new WSL container not starting correctly. Ultimately, I didn’t sort out the problem with my new container. I built a new one, a different way to resolve my issue. This post is my journey documenting some of the steps I took today that might help someone else.
The error
I’ve created hundreds of containers. I download an image, or in this case, use one already on my PC. I then import it with the following.
1
2
3
PS C:\Users\Kevin> curl https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-amd64.tar.gz --output ubuntu-24.04-wsl-root-tar.xz
wsl --import UbuntuDev2 "C:\Users\Kevin\WSL\UbuntuDev2" .\ubuntu-24.04-wsl-root-tar.xz
This time, I encountered the following errors.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
PS C:\Users\Kevin> wsl -d Acc1dev
<3>WSL (10) ERROR: CreateProcessParseCommon:763: Failed to translate C:\Users\Kevin
<3>WSL (10) ERROR: CreateProcessParseCommon:809: getpwuid(0) failed 2
<3>WSL (10) ERROR: UtilTranslatePathList:2852: Failed to translate C:\Program Files\WindowsApps\Microsoft.PowerShell_7.4.6.0_x64__8wekyb3d8bbwe
<3>WSL (10) ERROR: UtilTranslatePathList:2852: Failed to translate C:\Program Files\Microsoft MPI\Bin\
~~~Truncated
<3>WSL (10) ERROR: UtilTranslatePathList:2852: Failed to translate C:\Program Files\Azure Data Studio\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2852: Failed to translate C:\Users\Kevin\.dotnet\tools
Processing fstab with mount -a failed.
Failed to mount C:\, see dmesg for more details.
Failed to mount D:\, see dmesg for more details.
<3>WSL (10) ERROR: CreateProcessCommon:392: getpwuid(0) failed 2
<3>WSL (10) ERROR: CreateProcessCommon:559: execvpe(/bin/sh) failed: No such file or directory
Troubleshooting
At first, I thought I had done something wrong, so I deleted the container to start over. I unregistered it and deleted the folder.
1
wsl --unregister Acc1dev
I reinstalled using the same commands above, paying attention this time. Same error. I double-checked the folder permissions, and everything looked good. My other containers start normally. 😒
I deleted everything again and downloaded a fresh copy of the image. Something could have happened to my image—same error.
Google-Fu! A bunch of things not related. 😒
I came across this post that suggests checking environmental variables. https://learn.microsoft.com/en-us/answers/questions/1657597/fix-by-error
I did find one line related to my dev SQL server. I recall doing an update, and maybe that was it. I decided to reboot; maybe an updater/installer needs to finish some tasks.
My variables didn’t change, so I manually deleted the problem environmental variable and rebooted.
Same error, sans the deleted variable. 😒
I run across this post that suggests setting the default distro. I already have a default; I’m not getting the same error either, but sure, why not? https://stackoverflow.com/questions/77890139/windows-sub-system-for-linux-failure-to-load-by-fstab-has-failed-to-mount
1
2
3
4
5
6
7
PS C:\Users\Kevin> wsl -l -v
NAME STATE VERSION
* Ubuntu Stopped 2
UbuntuDev1 Stopped 2
UbuntuDev2 Stopped 2
Acc1dev Stopped 2
PS C:\Users\Kevin>
1
2
wsl --set-default Ubuntu
The operation completed successfully.
For reasons, I reboot.
Same error. 😢
I Give Up
I decided to do a clean installation from the Microsoft Store. I have things to do, and playing with WSL isn’t on the list for today.
Let’s see what they have available.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
PS C:\Users\Kevin> wsl --list --online
The following is a list of valid distributions that can be installed.
Install using 'wsl.exe --install <Distro>'.
NAME FRIENDLY NAME
Ubuntu Ubuntu
Debian Debian GNU/Linux
kali-linux Kali Linux Rolling
Ubuntu-18.04 Ubuntu 18.04 LTS
Ubuntu-20.04 Ubuntu 20.04 LTS
Ubuntu-22.04 Ubuntu 22.04 LTS
Ubuntu-24.04 Ubuntu 24.04 LTS
OracleLinux_7_9 Oracle Linux 7.9
OracleLinux_8_7 Oracle Linux 8.7
OracleLinux_9_1 Oracle Linux 9.1
openSUSE-Leap-15.6 openSUSE Leap 15.6
SUSE-Linux-Enterprise-15-SP5 SUSE Linux Enterprise 15 SP5
SUSE-Linux-Enterprise-15-SP6 SUSE Linux Enterprise 15 SP6
openSUSE-Tumbleweed openSUSE Tumbleweed
Ubuntu 24.04 LTS, please.
1
wsl --install -d Ubuntu24.04
Great! It installed. I don’t particularly like doing it this way. I don’t get to specify the location or name. WSL puts the files in some random place I don’t back up or clean up. I shutdown wsl to make some changes.
1
wsl --shutdown
Not helpful location my new container was installed in:
1
C:\Users\Kevin\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu24.04LTS_79rhkp1fndgsc\LocalState
Let’s move our container location. I don’t know of any other way to edit wsl’s configuration.
Start –> Open –> regedit
Navigate to the following location
1
Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss
You will see a folder for each container installed. I find my generic Ubuntu container name. Double-click on BasePath to change the value:
1
2
3
4
5
6
Change
C:\Users\Kevin\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu24.04LTS_79rhkp1fndgsc\LocalState
to
C:\Users\Kevin\WSL\Acc1dev
Then move the file to the new location. While I’m in regedit, I changed the DistributionName as well. Reboot, because Windows.
Let’s test it.
1
wsl -d Acc1dev
Nice! It starts. Let’s finish setting up the things. Use vi or a similar editor to edit the configuration file.
1
vi /etc/wsl.conf
I typically use the following options in my container config file.
1
2
3
4
5
6
[boot]
systemd=true
[network]
hostname=Acc1dev
[user]
default=kevin
Updates
Remember to run your updates.
1
2
3
sudo apt update
sudo apt upgrade
Perfect! Now, what was I going to do with this?
Whatever, have fun!
Comments powered by Disqus.