Steps to Reproduce:
No steps to reproduce the problem. I didn't change any settings, suddenly when I open the vscode, it pops up with error to connect with the WSL server.
Here are the logs:
[2020-04-23 06:54:29.085] Resolving wsl+Ubuntu-18.04, resolveAttempt: 1
[2020-04-23 06:54:29.389] Starting VS Code Server inside WSL (Ubuntu-18.04)
[2020-04-23 06:54:29.389] Extension version: 0.44.2, Windows build: 17134. Multi distro support: not available. WSL path support: enabled
[2020-04-23 06:54:30.483] Probing if server is already installed: C:\WINDOWS\System32\wsl.exe sh -c "[ -d ~/.vscode-server/bin/ff915844119ce9485abfe8aa9076ec76b5300ddd ] && printf found || ([ -f /etc/alpine-release ] && printf alpine-; uname -m)"
[2020-04-23 06:54:31.381] Probing result: found
[2020-04-23 06:54:31.381] Server install found in WSL
[2020-04-23 06:54:31.382] Launching C:\WINDOWS\System32\wsl.exe sh -c '"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" ff915844119ce9485abfe8aa9076ec76b5300ddd stable .vscode-server 0 ' in c:\Users\Name\.vscode\extensions\ms-vscode-remote.remote-wsl-0.44.2}
[2020-04-23 06:54:31.928] sh: 1: /scripts/wslServer.sh: not found
[2020-04-23 06:54:31.928] VS Code Server for WSL closed unexpectedly.
[2020-04-23 06:54:31.928] For help with startup problems, go to
[2020-04-23 06:54:31.928] https://code.visualstudio.com/docs/remote/troubleshooting#_wsl-tips
I have tried to reboot the WSL to solve the problem, but that does not work for me. I also have checked the directory c:\Users\Name\.vscode\extensions\ms-vscode-remote.remote-wsl-0.44.2 and I can find the `/scripts/wslServer.sh' file.
I just got this issue too. I installed the Windows May 2020 Update yesterday and then installed Ubuntu (20.04) using WSL 2. This was all working just fine
However, today I decided to install Docker Desktop (Edge) for Windows using the WSL2 Backend. After rebooting I started getting this error and I couldn't fix it. I even tried reinstalling vscode. If you run the code executable inside of WSL it gives you the following error
Input/output error: code
So I tried to see if it was a path problem, so from inside the Ubuntu shell I went to /mnt/c and did an ls command. And this showed the error:
Cannot open directory '.': Input/output error
That led me to this: https://github.com/microsoft/WSL/issues/4377
Which was the key ingredient. I went to powershell and did wsl.exe --shutdown.
This caused Docker Desktop to restart and then when I ran the code command line from Ubuntu again, it fixed everything up. Now it's working. I am not sure if that is the problem you are having or maybe some other root cause. But you should check that you can access /mnt/c correctly. Not sure what Docker did to mess it up on the initial restart, but it also might be a bug to report to them.
thanks @giampierod , that fixed it for me too.
I just got this issue too. I installed the Windows May 2020 Update yesterday and then installed Ubuntu (20.04) using WSL 2. This was all working just fine
However, today I decided to install Docker Desktop (Edge) for Windows using the WSL2 Backend. After rebooting I started getting this error and I couldn't fix it. I even tried reinstalling vscode. If you run the code executable inside of WSL it gives you the following error
Input/output error: codeSo I tried to see if it was a path problem, so from inside the Ubuntu shell I went to
/mnt/cand did anlscommand. And this showed the error:Cannot open directory '.': Input/output error
That led me to this: microsoft/WSL#4377
Which was the key ingredient. I went to powershell and did
wsl.exe --shutdown.This caused Docker Desktop to restart and then when I ran the code command line from Ubuntu again, it fixed everything up. Now it's working. I am not sure if that is the problem you are having or maybe some other root cause. But you should check that you can access /mnt/c correctly. Not sure what Docker did to mess it up on the initial restart, but it also might be a bug to report to them.
That worked for me as well.
Thank you, it fixed the mistake for me @giampierod
Happened to me too, worked as well
Thank you! @giampierod
I also experienced the error mentioned above. In the Powershell, I then executed wsl -l -v and saw that my Debian distro, into which I tap with VSCode, was running although I had no process actually executing it (anymore).
Instead of wsl --shutdown I executed wsl --terminate Debian, which only terminates the specified distro. After it was stopped, I opened VSCode again and the error was gone. Thank you for the solution, @giampierod!
I also have Docker installed but the Docker distros were stopped the entire time on my system.
I was having this problem specifically with vscode (WSL was working).
My fix was to simply rename/delete ~/.vscode-server and then it worked normally.
I was having this problem specifically with vscode (WSL was working).
My fix was to simply rename/delete~/.vscode-serverand then it worked normally.
this it okay, but better to do wsl.exe --shutdown in script
mee too have both 20.04 and 18.04, 18.04 didn't worked, after wsl.exe --shutdown it did
I had the same error, if you have a docker using WSL you should change the default distribution.
Change default distribution: wslconfig /setdefault Ubuntu
I was having this problem specifically with vscode (WSL was working).
My fix was to simply rename/delete~/.vscode-serverand then it worked normally.this it okay, but better to do wsl.exe --shutdown in script
Why?
In my case, the root cause appears to have been an incomplete mounting of Windows paths under /mnt/c/... from Ubuntu (20.04) and possibly also an incomplete value for the PATH env var. The aforementioned fix of "wsl.exe --shutdown" from Powershell fixed things; VSCode server reinstalled on next execution attempt from WSL.
@giampierod Thanks you very much. Your fix works well for me.
@alfonsovgs: Thanks! Setting the Ubuntu distribution as default WSL distribution fixed the error!

Click the Green Button in the lower left hand corner of the VSC...........
Click on
"Remote-WSL: New Window using Distro.." at the top of the VSC field.
Then choose Ubuntu and it works great. The Ubuntu Windows WSL2 works with both the Windows and Linux systems which allows you to work in both environments. Here is some documentation on this subject https://ubuntu.com/blog/ubuntu-on-wsl-2-is-generally-available This may be the workaround for this issue.
If you click on
Remote-WSL: New Window
I get the same error. So maybe its a matter of choosing the correct Remote-WSL
Also, I did install the Ubuntu Windows download https://www.microsoft.com/en-us/p/ubuntu/9nblggh4msv6?activetab=pivot:overviewtab
Insted of determination, add something like
to profile and
your podman will be docker
I have debian and not ubuntu installed on wsl and face the same. Should I install ubuntu?
@tik9 I don't wont to advocate Ubuntu for VSCode Server installation but don't use Docker Desktop or any other distro with Docker daemon or Podman installed. The chosen distro can be declared the default WSL distro later if VS Code requires it.
To restart the specific distro wsl --terminate is enough! Next time when the distro will be started the entire path env will be recreated. I strongly oppose such old good solutions in the style " if the problem doesn't disappear close all opened windows and reboot your Windows twice.
To restart the specific distro wsl --terminate is enough! Next time when the distro will be started the entire path env will be recreated. I strongly oppose such old good solutions in the style " if the problem doesn't disappear close all opened windows and reboot your Windows twice.
this is not related to question, sorry.
i switched to .devcontainers and can do much more in a way more stable, including dind stuff and e2e tests, etc.
just forget about wsl/wsl 2.0 and start using your own prebuild corporate images using .devcontainers,
no offense, cheers
wsl is too slow, even wsl2
Closing. The underlying problem is in WSL: https://github.com/microsoft/WSL/issues/4377
We have https://github.com/microsoft/vscode-remote-release/issues/3387 to improve the error message and point user to the workaround.
I just got this issue too. I installed the Windows May 2020 Update yesterday and then installed Ubuntu (20.04) using WSL 2. This was all working just fine
However, today I decided to install Docker Desktop (Edge) for Windows using the WSL2 Backend. After rebooting I started getting this error and I couldn't fix it. I even tried reinstalling vscode. If you run the code executable inside of WSL it gives you the following error
Input/output error: codeSo I tried to see if it was a path problem, so from inside the Ubuntu shell I went to
/mnt/cand did anlscommand. And this showed the error:Cannot open directory '.': Input/output error
That led me to this: microsoft/WSL#4377
Which was the key ingredient. I went to powershell and did
wsl.exe --shutdown.This caused Docker Desktop to restart and then when I ran the code command line from Ubuntu again, it fixed everything up. Now it's working. I am not sure if that is the problem you are having or maybe some other root cause. But you should check that you can access /mnt/c correctly. Not sure what Docker did to mess it up on the initial restart, but it also might be a bug to report to them.
I had the exact same error message, but it had nothing to do with this solution. I had disabled automount windows drives before, and after I had my windows drives mounted under /mnt, or enabled automount windows drives when starting new terminal, this problem is solved.
I know this is stupid but I have to remind that mounting windows drives is vital that this extension can work.
Further info: https://devblogs.microsoft.com/commandline/automatically-configuring-wsl/
Most helpful comment
I just got this issue too. I installed the Windows May 2020 Update yesterday and then installed Ubuntu (20.04) using WSL 2. This was all working just fine
However, today I decided to install Docker Desktop (Edge) for Windows using the WSL2 Backend. After rebooting I started getting this error and I couldn't fix it. I even tried reinstalling vscode. If you run the code executable inside of WSL it gives you the following error
Input/output error: codeSo I tried to see if it was a path problem, so from inside the Ubuntu shell I went to
/mnt/cand did anlscommand. And this showed the error:Cannot open directory '.': Input/output error
That led me to this: https://github.com/microsoft/WSL/issues/4377
Which was the key ingredient. I went to powershell and did
wsl.exe --shutdown.This caused Docker Desktop to restart and then when I ran the code command line from Ubuntu again, it fixed everything up. Now it's working. I am not sure if that is the problem you are having or maybe some other root cause. But you should check that you can access /mnt/c correctly. Not sure what Docker did to mess it up on the initial restart, but it also might be a bug to report to them.