I am setting up a test environment to try the MOJO language in my Windows 11 Pro laptop (V 10.0.22631 Build 22631). Since MOJO doesn't have a Windows SDK available (yet), I installed WSL2 using Ubuntu-22.04 and the Remote Development extension pack for VSCode on Windows (Version: 1.91.0 (user setup), Commit: ea1445cc7016315d0f5728f8e8b12a45dc0a7286, Date: 2024-07-01T18:52:22.949Z) . Unfortunately, it seems that the client VSCode running on Windows can not connect to the VSCode server running on WSL.
I have looked at all the logs and they seem OK (no mentions of missing components or anything like that, so it doesn't seem to be a path related issue). Based on the line below, found in the renderer.log file of VSCode, it seems to be a connectivity issue, but I have no problem pinging the WSL's IP address from the Windows side
[error\] CodeExpectedError: WebSocket close with status code 1006
at WebSocket.\<anonymous\> (vscode-file://vscode-app/c:/Users/myW11userid/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:694:4130)
My .wslconfig file looks as follows:
\[wsl2\]
memory=4GB
swap=0GB
networkingMode=mirrored
#\[network\]
#generateHosts=true
#generateResolvConf=true
#localhostForwarding=true
\[mojo\]
modularHomePath=/home/myuserid/.modular
The VSCode terminal output generated when I try to run "code ." within a WSL2 Windows terminal looks like this:
\[2024-07-10 22:12:11.986\] Extension version: 0.88.2
\[2024-07-10 22:12:11.987\] L10N bundle: undefined
\[2024-07-10 22:12:12.045\] authorityHierarchy: wsl+Ubuntu-22.04
\[2024-07-10 22:12:12.045\] WSL extension activating for a local WSL instance
\[2024-07-10 22:12:12.062\] Resolving wsl+Ubuntu-22.04, resolveAttempt: 1
\[2024-07-10 22:12:12.063\] NodeExecServer run: C:\\WINDOWS\\System32\\wsl.exe --status
\[2024-07-10 22:12:12.182\] WSL feature installed: true (wsl --status)
\[2024-07-10 22:12:12.183\] NodeExecServer run: C:\\WINDOWS\\System32\\wsl.exe --list --verbose
\[2024-07-10 22:12:12.265\] 3 distros found
\[2024-07-10 22:12:12.265\] Starting VS Code Server inside WSL (wsl2)
\[2024-07-10 22:12:12.265\] Windows build: 22631. Multi distro support: available. WSL path support: enabled
\[2024-07-10 22:12:12.267\] Scriptless setup: false
\[2024-07-10 22:12:12.285\] NodeExecServer run: C:\\WINDOWS\\System32\\wsl.exe -d Ubuntu-22.04 -e sh -c \[ -f '/tmp/vscode-distro-env.gu8Plt' \] && cat '/tmp/vscode-distro-env.gu8Plt' || echo ''
\[2024-07-10 22:12:12.447\] WSL daemon log file: c:\\Users\\myW11userid\\AppData\\Roaming\\Code\\logs\\20240710T181210\\window1\\exthost\\ms-vscode-remote.remote-wsl\\wsl-daemon-20240710T221212.log
\[2024-07-10 22:12:12.453\] Probing if server is already installed: if \[ -d \~/.vscode-server/bin/ea1445cc7016315d0f5728f8e8b12a45dc0a7286 \]; then printf 'install-found '; fi; if \[ -f /etc/alpine-release \]; then printf 'alpine-'; fi; if \[ -s \~/.vscode-server/bin/compatibilty-check \]; then printf 'legacy-'; fi; uname -m;
\[2024-07-10 22:12:12.453\] NodeExecServer run: C:\\WINDOWS\\System32\\wsl.exe -d Ubuntu-22.04 -e sh -c if \[ -d \~/.vscode-server/bin/ea1445cc7016315d0f5728f8e8b12a45dc0a7286 \]; then printf 'install-found '; fi; if \[ -f /etc/alpine-release \]; then printf 'alpine-'; fi; if \[ -s \~/.vscode-server/bin/compatibilty-check \]; then printf 'legacy-'; fi; uname -m;
\[2024-07-10 22:12:12.476\] Using shell environment from invoking shell: /tmp/vscode-distro-env.gu8Plt
\[2024-07-10 22:12:12.619\] Probing result: install-found legacy-x86_64
\[2024-07-10 22:12:12.619\] Server install found in WSL
\[2024-07-10 22:12:12.620\] NodeExecServer run: C:\\WINDOWS\\System32\\wsl.exe -d Ubuntu-22.04 sh -c 'env && VSCODE_WSL_DEBUG_INFO=true "$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" ea1445cc7016315d0f5728f8e8b12a45dc0a7286 stable code-server .vscode-server --host=127.0.0.1 --port=0 --connection-token=1761853726-585650201-4064756048-4203047558 --use-host-proxy --without-browser-env-var --disable-websocket-compression --accept-server-license-terms --log=trace --telemetry-level=all'
\[2024-07-10 22:12:12.630\] Running with cwd: undefined, env: {"Contents removed to shorten post"}
\[2024-07-10 22:12:12.935\] USER=myuserid
\[2024-07-10 22:12:12.935\] VSCODE_WSL_EXT_LOCATION=/mnt/c/Users/myW11userid/.vscode/extensions/ms-vscode-remote.remote-wsl-0.88.2
\[2024-07-10 22:12:12.935\] SHLVL=0
\[2024-07-10 22:12:12.935\] WT_PROFILE_ID={61c54bbd-c2c6-5271-96e7-009a87ff44bf}
\[2024-07-10 22:12:12.935\] HOME=/home/myuserid
\[2024-07-10 22:12:12.935\] DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
\[2024-07-10 22:12:12.935\] WSL_DISTRO_NAME=Ubuntu-22.04
\[2024-07-10 22:12:12.935\] WAYLAND_DISPLAY=wayland-0
\[2024-07-10 22:12:12.935\] LOGNAME=myuserid
\[2024-07-10 22:12:12.935\] NAME=LAPTOP-OEF3GDE7
\[2024-07-10 22:12:12.935\] WSL_INTEROP=/run/WSL/114547_interop
\[2024-07-10 22:12:12.935\] PULSE_SERVER=unix:/mnt/wslg/PulseServer
\[2024-07-10 22:12:12.935\] _=/usr/bin/sh
\[2024-07-10 22:12:12.935\] TERM=xterm-256color
\[2024-07-10 22:12:12.935\] PATH="Contents removed to shorten post"
\[2024-07-10 22:12:12.935\] WT_SESSION=008aab95-7b2c-41f4-b494-183882dcb75a
\[2024-07-10 22:12:12.935\] XDG_RUNTIME_DIR=/run/user/1000/
\[2024-07-10 22:12:12.935\] DISPLAY=:0
\[2024-07-10 22:12:12.935\] LANG=C.UTF-8
\[2024-07-10 22:12:12.935\] SHELL=/bin/bash
\[2024-07-10 22:12:12.935\] PWD=/mnt/c/Users/myW11userid/AppData/Local/Programs/Microsoft VS Code
\[2024-07-10 22:12:12.935\] WSL2_GUI_APPS_ENABLED=1
\[2024-07-10 22:12:12.935\] HOSTTYPE=x86_64
\[2024-07-10 22:12:12.935\] WSLENV=VSCODE_WSL_EXT_LOCATION/up:VSCODE_CLI_REMOTE_ENV/w:ELECTRON_RUN_AS_NODE/w:WT_SESSION:WT_PROFILE_ID:
\[2024-07-10 22:12:12.935\] Setting up server environment: Looking for /home/myuserid/.vscode-server/server-env-setup. Not found.
\[2024-07-10 22:12:12.935\] WSL version: 5.15.153.1-microsoft-standard-WSL2 Ubuntu-22.04
\[2024-07-10 22:12:12.935\] WSL-shell-PID: 114550
\[2024-07-10 22:12:12.935\] Node executable: /home/myuserid/.vscode-server/bin/ea1445cc7016315d0f5728f8e8b12a45dc0a7286/node
\[2024-07-10 22:12:12.935\] Starting server: /home/myuserid/.vscode-server/bin/ea1445cc7016315d0f5728f8e8b12a45dc0a7286/bin/code-server --host=127.0.0.1 --port=0 --connection-token=1761853726-585650201-4064756048-4203047558 --use-host-proxy --without-browser-env-var --disable-websocket-compression --accept-server-license-terms --log=trace --telemetry-level=all
\[2024-07-10 22:12:12.935\] \*
\[2024-07-10 22:12:12.935\] \* Visual Studio Code Server
\[2024-07-10 22:12:12.935\] \*
\[2024-07-10 22:12:12.935\] \* By using the software, you agree to
\[2024-07-10 22:12:12.935\] \* the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
\[2024-07-10 22:12:12.935\] \* the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
\[2024-07-10 22:12:12.935\] \*
\[2024-07-10 22:12:12.935\] Server bound to 127.0.0.1:60847 (IPv4)
\[2024-07-10 22:12:12.935\] Extension host agent listening on 60847
\[2024-07-10 22:12:12.935\]
\[2024-07-10 22:12:12.951\] + CODE_PROFILE=/home/myuserid/.vscode-server/server-env-setup
\[2024-07-10 22:12:12.951\] + printf Setting up server environment: Looking for %s. /home/myuserid/.vscode-server/server-env-setup
\[2024-07-10 22:12:12.951\] + \[ -f /home/myuserid/.vscode-server/server-env-setup \]
\[2024-07-10 22:12:12.951\] + echo Not found.
\[2024-07-10 22:12:12.951\] + VSCODE_REMOTE_BIN=/home/myuserid/.vscode-server/bin
\[2024-07-10 22:12:12.951\] + uname -r
\[2024-07-10 22:12:12.951\] + WSL_VERSION=5.15.153.1-microsoft-standard-WSL2
\[2024-07-10 22:12:12.951\] + echo WSL version: 5.15.153.1-microsoft-standard-WSL2 Ubuntu-22.04
\[2024-07-10 22:12:12.951\] + dirname /mnt/c/Users/myW11userid/.vscode/extensions/ms-vscode-remote.remote-wsl-0.88.2/scripts/wslServer.sh
\[2024-07-10 22:12:12.951\] + /mnt/c/Users/myW11userid/.vscode/extensions/ms-vscode-remote.remote-wsl-0.88.2/scripts/wslDownload.sh ea1445cc7016315d0f5728f8e8b12a45dc0a7286 stable /home/myuserid/.vscode-server/bin
\[2024-07-10 22:12:12.951\] + \[ ! -d /home/myuserid/.vscode-server/bin/ea1445cc7016315d0f5728f8e8b12a45dc0a7286 \]
\[2024-07-10 22:12:12.951\] + RC=0
\[2024-07-10 22:12:12.951\] + \[ 0 -ne 0 \]
\[2024-07-10 22:12:12.951\] + echo WSL-shell-PID: 114550
\[2024-07-10 22:12:12.951\] + echo Node executable: /home/myuserid/.vscode-server/bin/ea1445cc7016315d0f5728f8e8b12a45dc0a7286/node
\[2024-07-10 22:12:12.951\] + echo Starting server: /home/myuserid/.vscode-server/bin/ea1445cc7016315d0f5728f8e8b12a45dc0a7286/bin/code-server --host=127.0.0.1 --port=0 --connection-token=1761853726-585650201-4064756048-4203047558 --use-host-proxy --without-browser-env-var --disable-websocket-compression --accept-server-license-terms --log=trace --telemetry-level=all
\[2024-07-10 22:12:12.951\] + \[ -f /etc/alpine-release \]
\[2024-07-10 22:12:12.951\] + uname -m
\[2024-07-10 22:12:12.951\] + \[ x86_64 = aarch64 \]
\[2024-07-10 22:12:12.951\] + /home/myuserid/.vscode-server/bin/ea1445cc7016315d0f5728f8e8b12a45dc0a7286/bin/code-server --host=127.0.0.1 --port=0 --connection-token=1761853726-585650201-4064756048-4203047558 --use-host-proxy --without-browser-env-var --disable-websocket-compression --accept-server-license-terms --log=trace --telemetry-level=all
\[2024-07-10 22:12:12.952\] Started local proxy server on 50534.
\[2024-07-10 22:12:12.953\] WSL resolver response: 127.0.0.1:50534
\[2024-07-10 22:12:12.953\] To debug connection issues, open a local browser on http://127.0.0.1:50534/version
\[2024-07-10 22:12:12.953\] Extension host environment: {"Contents removed to shorten post"}
\[2024-07-10 22:12:12.985\] Using executable (0) to forward requests from local 50534 to remote 60847
\[2024-07-10 22:12:12.985\] NodeExecServer run: C:\\WINDOWS\\System32\\wsl.exe -d Ubuntu-22.04 -e /home/myuserid/.vscode-server/bin/ea1445cc7016315d0f5728f8e8b12a45dc0a7286/node -e const net = require('net'); process.stdin.pause(); const client = net.createConnection({ host: '127.0.0.1', port: 60847 }, () =\> { client.pipe(process.stdout); process.stdin.pipe(client); }); client.on('close', function (hadError) { console.error(hadError ? 'Remote close with error' : 'Remote close'); process.exit(hadError ? 1 : 0); }); client.on('error', function (err) { process.stderr.write(err && (err.stack || err.message) || String(err)); });
\[2024-07-10 22:14:23.674\] Exec (0) stderr: Error: connect ETIMEDOUT 127.0.0.1:60847
\[2024-07-10 22:14:23.674\] at TCPConnectWrap.afterConnect \[as oncomplete\] (node:net:1595:16)
\[2024-07-10 22:14:23.674\] Exec (0) stderr: Remote close with error
\[2024-07-10 22:14:23.687\] Exec (0) has terminated with status 1 and message undefined.
\[2024-07-10 22:14:23.687\] Exec (0): Local close
The contents of the renderer.log file in the VSCode logs folder has the following (shortened) contents:
2024-07-10 17:43:26.626 \[info\] Started local extension host with pid 46940.
2024-07-10 17:43:27.136 \[info\] Invoking resolveAuthority(wsl)...
2024-07-10 17:43:27.137 \[info\] \[LocalProcess0\]\[resolveAuthority(wsl,1)\]\[0ms\] obtaining proxy...
2024-07-10 17:43:27.137 \[info\] \[LocalProcess0\]\[resolveAuthority(wsl,1)\]\[0ms\] invoking...
2024-07-10 17:43:28.089 \[info\] \[LocalProcess0\]\[resolveAuthority(wsl,1)\]\[868ms\] returned WebSocket(127.0.0.1:52679)
2024-07-10 17:43:28.090 \[info\] resolveAuthority(wsl) returned 'WebSocket(127.0.0.1:52679)' after 870 ms
2024-07-10 17:43:28.090 \[info\] Creating a socket (renderer-Management-225b1a55-5248-4f52-81ac-d149e21e52a9)...
2024-07-10 17:43:28.090 \[info\] Creating a socket (renderer-ExtensionHost-33da5493-2d13-4cae-b1cd-f8fd391f89d3)...
\*\*2024-07-10 17:45:38.286 \[info\] Creating a socket (renderer-Management-225b1a55-5248-4f52-81ac-d149e21e52a9) returned an error after 130292 ms.
2024-07-10 17:45:38.286 \[error\] CodeExpectedError: WebSocket close with status code 1006
at WebSocket.\<anonymous\> (vscode-file://vscode-app/c:/Users/myW11userid/AppData/Local/Programs/\*\*Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:694:4130)
2024-07-10 17:45:38.287 \[error\] \[remote-connection\]\[Management \]\[225b1…\]\[initial\]\[WebSocket(127.0.0.1:52679)\] socketFactory.connect() failed or timed out. Error:
2024-07-10 17:45:38.287 \[error\] CodeExpectedError: WebSocket close with status code 1006
at WebSocket.\<anonymous\> (vscode-file://vscode-app/c:/Users/myW11userid/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:694:4130)
2024-07-10 17:45:38.288 \[error\] \[remote-connection\]\[attempt 1\] An error occurred in initial connection! Will retry... Error:
2024-07-10 17:45:38.288 \[error\] CodeExpectedError: WebSocket close with status code 1006
at WebSocket.\<anonymous\> (vscode-file://vscode-app/c:/Users/myW11userid/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:694:4130)
I would appreciate any advice.
Cheers