I'm having trouble running Ubuntu for WSL2 in my Windows Terminal as a regular user.
Instead of getting a bash prompt I get the following, and I think it's because I have more than one Ubuntu Distro with the same name, see below:
Windows Version:Microsoft Windows [Version 10.0.19044.1586]
WSL Version: 0.0.0.0
Are you using WSL1 or WSL2: WSL2
Kernel Version: Linux version 5.10.102.1-microsoft-standard-WSL2 (oe-user@oe-host) (x86_64-msft-linux-gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.34.0.20200220) #1 SMP Wed Mar 2 00:30:59 UTC 2022
Steps to Reproduce:
Open Windows Terminal as a non-admin account.
Click the down arrow tab at the top and select Ubuntu.
A new tab appears with the follow error message:
Cannot create a file when that file already exists.
[process exited with code 4294967295 (0xffffffff)]You can now close this terminal with Ctrl+D, or press Enter to restart.
I think the issue has to do with the fact that there are two Ubuntu Distros named Ubuntu but that have a different GUID/UUID in the registry:
wsl -l -v NAME STATE VERSION* Ubuntu Running 2 Ubuntu Stopped 2PS C:\Users\me-user> reg query hkcu\software\microsoft\windows\currentversion\lxssHKEY_CURRENT_USER\software\microsoft\windows\currentversion\lxss DefaultVersion REG_DWORD 0x2 DefaultDistribution REG_SZ {c329c2ee-fd20-4986-873a-351737eaf399}HKEY_CURRENT_USER\software\microsoft\windows\currentversion\lxss\AppxInstallerCacheHKEY_CURRENT_USER\software\microsoft\windows\currentversion\lxss\{97307d71-8998-42a4-9600-ff372b6ec1ee}HKEY_CURRENT_USER\software\microsoft\windows\currentversion\lxss\{c329c2ee-fd20-4986-873a-351737eaf399}If you'll notice the 1st one has values, but the 2nd one does not:
First one:
PS C:\Users\me-user> reg query "hkcu\software\microsoft\windows\currentversion\lxss\{97307d71-8998-42a4-9600-ff372b6ec1ee}" /v DistributionNameHKEY_CURRENT_USER\software\microsoft\windows\currentversion\lxss\{97307d71-8998-42a4-9600-ff372b6ec1ee} DistributionName REG_SZ UbuntuPS C:\Users\me-user> reg query "hkcu\software\microsoft\windows\currentversion\lxss\{97307d71-8998-42a4-9600-ff372b6ec1ee}"HKEY_CURRENT_USER\software\microsoft\windows\currentversion\lxss\{97307d71-8998-42a4-9600-ff372b6ec1ee} State REG_DWORD 0x1 DistributionName REG_SZ Ubuntu Version REG_DWORD 0x2 BasePath REG_SZ C:\Users\me-user\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState Flags REG_DWORD 0xf DefaultUid REG_DWORD 0x0 PackageFamilyName REG_SZ CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc2nd One
PS C:\Users\me-user> reg query "hkcu\software\microsoft\windows\currentversion\lxss\{c329c2ee-fd20-4986-873a-351737eaf399}" /v DistributionNameHKEY_CURRENT_USER\software\microsoft\windows\currentversion\lxss\{c329c2ee-fd20-4986-873a-351737eaf399} DistributionName REG_SZ Ubuntu(No other keys / values)
I noticed that the default wsl is set to the 2nd one c329c2ee-fd20-4986-873a-351737eaf399:
DefaultDistribution REG_SZ {c329c2ee-fd20-4986-873a-351737eaf399}
Is it safe to change the Default Distribution to "the 1st One" {97307d71-8998-42a4-9600-ff372b6ec1ee} so that I no longer see the error message when trying to open it in Window Terminal?
Also see:https://github.com/microsoft/WSL/issues/7998
Cannot create a file when that file already exists.[process exited with code 4294967295 (0xffffffff)]You can now close this terminal with Ctrl+D, or press Enter to restart.