Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not connect to WSL2 running Ubuntu-22.04... #221727

Closed
diagonjope opened this issue Jul 15, 2024 · 9 comments
Closed

Can not connect to WSL2 running Ubuntu-22.04... #221727

diagonjope opened this issue Jul 15, 2024 · 9 comments
Assignees
Labels
info-needed Issue requires more information from poster

Comments

@diagonjope
Copy link

Type: Bug

Please take a look at the details provided here ==> https://stackoverflow.com/questions/78733419/can-not-connect-vscode-to-wsl2-running-ubuntu-22-04

VS Code version: Code 1.91.0 (ea1445c, 2024-07-01T18:52:22.949Z)
OS version: Windows_NT x64 10.0.22631
Modes:
Connection to 'WSL: Ubuntu-22.04' could not be established WebSocket close with status code 1006

System Info
Item Value
CPUs Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz (12 x 2592)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 31.91GB (12.81GB free)
Process Argv --folder-uri=vscode-remote://wsl+Ubuntu-22.04/home/diagonjope/mojo-tests --remote=wsl+Ubuntu-22.04 --crash-reporter-id 8875e5f1-e052-45ee-a659-c813b03011c1
Screen Reader no
VM 0%

Connection to 'WSL: Ubuntu-22.04' could not be established WebSocket close with status code 1006

Extensions: none
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
vscoreces:30445986
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonnoceb:30805159
asynctok:30898717
pythonregdiag2:30936856
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
accentitlementsc:30995553
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
chatpanelc:31048052
dsvsc021:30996838
01bff139:31013167
pythoncenvpt:31062603
a69g1124:31058053
dvdeprecation:31068756
dwnewjupyter:31046869
newcmakeconfigv2:31071590
impr_priority:31082723
refactorc:31093864

@vscodenpa
Copy link

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.91.1. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

@diagonjope
Copy link
Author

VS Code updated to latest version. Got the same results and same error persists:

2024-07-15 13:03:25.659 [error] CodeExpectedError: WebSocket close with status code 1006
at WebSocket. (vscode-file://vscode-app/c:/Users/josep/AppData/Local/Programs/Microsoft%20VS%

@aeschli
Copy link
Contributor

aeschli commented Jul 16, 2024

Can you remove the `networkingMode=mirrored`` from your wslconfig file to see if that causes the problem?

@aeschli aeschli added the info-needed Issue requires more information from poster label Jul 16, 2024
@diagonjope
Copy link
Author

Greetings @aeschli ! I commented the line and now VS Code can connect to WSL2 and install extensions in Ubuntu. Thanks for the suggestion!

However, when I do this, I also loose the capability of connecting to the outside world from Ubuntu. So, in order to install or update any package, I have to shutdown WSL, uncomment the "networkingMode=mirrored" line and save the .wslconfig file, initiate a new WSL session, do the update, and then revert everything again.

Do you have any thoughts about how to solve this problem? I've had this problem since last year, and had given up on using WSL until I found the "networkingMode=mirrored" option a couple of weeks ago.

I'd appreciate your comments.

Cheers,

++José

@aeschli
Copy link
Contributor

aeschli commented Jul 16, 2024

We have microsoft/vscode-remote-release#9222 for this and we have contacted the WSL team: microsoft/WSL#11184
It's unclear why networkingMode=mirrored doesn't work for some users.

Can you please collect networking logs by following the instructions below and attach them, together with a description of your distro setup in microsoft/WSL#11184 ?
https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues

@aeschli
Copy link
Contributor

aeschli commented Jul 16, 2024

Marking as dup of microsoft/vscode-remote-release#9222.

@aeschli aeschli closed this as completed Jul 16, 2024
@diagonjope
Copy link
Author

diagonjope commented Jul 16, 2024 via email

@cyh2004
Copy link

cyh2004 commented Jul 21, 2024

I have the same problem. But I seem to have found a workaround.
In /etc/wsl.conf I wrote the following to enable systemctl

[boot]
systemd=true

After deleting the two lines, vscode worked smoothly. I can keep setting "networkingMode=mirrored" in .wslconfig and my vscode can connect to wsl, which has network connection

The content of my .wslconfig:

[wsl2]
networkingMode=mirrored
dnsTunneling=true
firewall=true
autoProxy=true

But the problem arise after I upgrade wsl from Ubuntu 20.04 to Ubuntu 24.04 using do-release-upgrade. Before that, systemd=true and networkingMode=mirrored coexist fairly well.

@klawdyo
Copy link

klawdyo commented Jul 21, 2024

My Pc started this error today

@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Aug 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

5 participants