7

I have:

VSCode v1.46.0

remote-wsl extension v0.44.3

Windows 10 OS build 19041.329

Docker Desktop v2.3.0.3

I am trying to open VSCode within the docker-desktop wsl and I get the below error every time. I have gone to the directory listed and see the node file I am not sure what to do?

[2020-06-17 20:30:27.337] Resolving wsl+docker-desktop, resolveAttempt: 1
[2020-06-17 20:30:27.462] Starting VS Code Server inside WSL (docker-desktop)
[2020-06-17 20:30:27.463] Extension version: 0.44.3, Windows build: 19041. Multi distro support: available. WSL path support: enabled
[2020-06-17 20:30:27.751] Probing if server is already installed: C:\WINDOWS\System32\wsl.exe -d docker-desktop -e sh -c "[ -d ~/.vscode-server/bin/a5d1cc28bb5da32ec67e86cc50f84c67cc690321 ] && printf found || ([ -f /etc/alpine-release ] && printf alpine-; uname -m)"
[2020-06-17 20:30:28.100] Probing result: found
[2020-06-17 20:30:28.100] Server install found in WSL
[2020-06-17 20:30:28.101] Launching C:\WINDOWS\System32\wsl.exe -d docker-desktop sh -c '"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" a5d1cc28bb5da32ec67e86cc50f84c67cc690321 stable .vscode-server 0  ' in c:\Users\Eric\.vscode\extensions\ms-vscode-remote.remote-wsl-0.44.3}
[2020-06-17 20:30:28.345] Setting up server environment: Looking for /root/.vscode-server/server-env-setup. Not found.
[2020-06-17 20:30:28.345] WSL version: 4.19.104-microsoft-standard docker-desktop
[2020-06-17 20:30:28.345] WSL2-shell-PID: 1036
[2020-06-17 20:30:28.345] Starting server: /root/.vscode-server/bin/a5d1cc28bb5da32ec67e86cc50f84c67cc690321/server.sh  --port=0 --use-host-proxy --enable-remote-auto-shutdown 
[2020-06-17 20:30:28.347] /root/.vscode-server/bin/a5d1cc28bb5da32ec67e86cc50f84c67cc690321/server.sh: line 12: /root/.vscode-server/bin/a5d1cc28bb5da32ec67e86cc50f84c67cc690321/node: not found
[2020-06-17 20:30:28.347] VS Code Server for WSL closed unexpectedly.
[2020-06-17 20:30:28.347] For help with startup problems, go to
[2020-06-17 20:30:28.347] https://code.visualstudio.com/docs/remote/troubleshooting#_wsl-tips
[2020-06-17 20:30:29.404] WSL Daemon exited with code 0
ericv
  • 71
  • 1
  • 1
  • 2
  • I have the same issue when opening a window in WSL. I have a remote-container window in parallel, where the same code of the vs code server is executed inside of a docker container. So I guess, something is missing in the docker-desktop distribution to launch node. Replacing node by pointing to a local node installation did not help me. Still investigating further. – Matthias Wiedemann Jun 18 '20 at 21:38

5 Answers5

11

Had a very similar problem today. VScode been working for a long time and stopped today suddenly.

/home/user/.vscode-server/bin/b5afea7e86cc50f84c67cc690321/server.sh --port=0 --use-host-proxy --enable-remote-auto-shutdown
VS Code Server for WSL closed unexpectedly

In WSL console, the server.sh is empty somehow.
My resolution: Remove WSL extension. rm -rf ./vscode-server. Reinstall WSL extension to reconstruct the corrupted file.

Hugo Noro
  • 3,145
  • 2
  • 13
  • 19
Kai Zhang
  • 155
  • 1
  • 9
3

The problem is, that the vscode-server, which is installed to the WSL, is not compatible with the distro given by Docker Desktop. You should use an official Linux distribution from Microsoft Store, i.e. Ubuntu.

The docker-desktop distro is coming from Alpine Linux which is based on a libc variant called musl-libc. But the vscode-server, which is installed by the wsl extension is build against glibc.

You can see this by doing this in wsl: apk update && apk add binutils and then

readelf -l /root/.vscode-server/bin/a5d1cc28bb5da32ec67e86cc50f84c67cc690321/node | grep "program interpreter"
      [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]

But in Alpine, this library does not exist and that is why the error message reports not found.

So I was wondering, why the vscode server is working inside of an Alpine container with the Remote Container extension. For example starting alpine:3.9, the above check shows the following:

readelf -l /root/.vscode-server/bin/a5d1cc28bb5da32ec67e86cc50f84c67cc690321/node | grep "program interpreter"
      [Requesting program interpreter: /lib/ld-musl-x86_64.so.1]

For some reason, the Remote-Container extension has some detection mechanism for Alpine and is using a different build of the vscode server. My suggestion is, that you can file an issue on https://github.com/microsoft/vscode-remote-release/issues for this problem. Otherwise, use another WSL distro or use the container extension.

Some references on this topic:

Matthias Wiedemann
  • 1,313
  • 12
  • 22
1

In my case the fix to this was:

  • open Docker for Windows settings
  • untick "Use the WSL 2 base engine" then click "Apply & Restart"
  • tick "Use the WSL 2 base engine" again then click "Apply & Restart"

The next time I ran "Remote WSL: New Window" it connected again properly

miff2000
  • 51
  • 5
  • This works for me after updating docker. I was getting the error `.vscode-server/server-env-setup not found` on WSL. Thanks – Second2None Feb 17 '22 at 22:52
1

I had to restart WSL

wsl --shutdown
wsl
Tashi
  • 477
  • 4
  • 12
0

For me the cause was the /etc/wsl.conf file on my Debian instance. I disabled automount a while back, but this is necessary for the WSL extension to work. So I put it back on, and it worked.

[automount]
enabled = true
MonkeyDreamzzz
  • 3,978
  • 1
  • 39
  • 36