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

Cannot connect to WSL with mirrored networking #9222

Closed
Berrysoft opened this issue Nov 22, 2023 · 20 comments
Closed

Cannot connect to WSL with mirrored networking #9222

Berrysoft opened this issue Nov 22, 2023 · 20 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug wsl Issue in vscode-remote WSL

Comments

@Berrysoft
Copy link

  • VSCode Version: 1.84.2
  • Local OS Version: Windows 11 (10.0.25997)
  • Remote OS Version: Linux version 5.15.133.1-microsoft-standard-WSL2
  • Remote Extension/Connection Type: WSL
  • Logs:
2023-11-22 23:44:26.652 [info] $getCanonicalURI invoked for authority (wsl)
2023-11-22 23:44:26.658 [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-wsl, startup: false, activationEvent: 'onResolveRemoteAuthority:wsl'
2023-11-22 23:44:26.718 [info] [resolveAuthority(wsl,1)][0ms] activating remote resolvers wsl+arch
2023-11-22 23:44:26.718 [info] [resolveAuthority(wsl,1)][0ms] activating resolver for wsl+arch...
2023-11-22 23:44:26.718 [info] [resolveAuthority(wsl,1)][0ms] invoking final resolve()...
2023-11-22 23:44:26.837 [warning] Using default string since no string found in i18n bundle that has the key: [Starting VS Code in WSL ({0})](command:remote-wsl.showLog)/{0} is distro name. do not change link format [message](command), only change message{Locked="](command:remote-wsl.showLog)"}
2023-11-22 23:44:27.731 [info] [resolveAuthority(wsl,1)][1013ms] waiting...
2023-11-22 23:44:27.776 [info] [resolveAuthority(wsl,1)][1057ms] setting tunnel factory...
2023-11-22 23:44:27.776 [info] [resolveAuthority(wsl,1)][1058ms] returned 127.0.0.1:60926

Steps to Reproduce:

  1. Enable networkingMode=mirrored in .wslconfig.
  2. code . in WSL.

Does this issue occur when you try this locally?: No
Does this issue occur when you try this locally and all extensions are disabled?: No

@github-actions github-actions bot added the wsl Issue in vscode-remote WSL label Nov 22, 2023
@zmcNotafraid
Copy link

zmcNotafraid commented Nov 24, 2023

Same problem.And I found this issue was caused by latest system version updated.


When I run wsl.exe --shutdown, then restart wsl. This issue was fixed.But after a long time system sleep, the bug is shown again.

@Charles5277
Copy link

Charles5277 commented Nov 24, 2023

Same situation here

After I added the experimental settings, VS Code can no longer access WSL.

.wslconfig

[wsl2]
  memory=32GB
  processors=8

[experimental]
  networkingMode=mirrored
  dnsTunneling=true
  autoProxy=true
  • VS Code version: 1.84.2
  • WSL version: 2.0.11.0

@aeschli
Copy link
Contributor

aeschli commented Dec 5, 2023

Running with with networkingMode=mirrored works for me.
What does the WSL log show?

@Berrysoft
Copy link
Author

Which log do you refer to? How to obtain the WSL log?

@aeschli
Copy link
Contributor

aeschli commented Dec 5, 2023

Command: WSL: Show Log...

@Berrysoft
Copy link
Author

Berrysoft commented Dec 5, 2023

There's no such command, maybe because the plugin stucks when trying to connect WSL.

The extension host log:

2023-12-06 00:06:30.368 [info] Extension host with pid 24672 started
2023-12-06 00:06:30.403 [info] ExtensionService#_doActivateExtension vscode.git-base, startup: true, activationEvent: '*', root cause: vscode.git
2023-12-06 00:06:30.465 [info] ExtensionService#_doActivateExtension vscode.git, startup: true, activationEvent: '*'
2023-12-06 00:06:30.465 [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '*'
2023-12-06 00:06:30.630 [info] Eager extensions activated
2023-12-06 00:06:30.782 [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: false, activationEvent: 'onStartupFinished'
2023-12-06 00:06:30.782 [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'
2023-12-06 00:06:30.783 [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-wsl-recommender, startup: false, activationEvent: 'onStartupFinished'
2023-12-06 00:06:30.783 [info] ExtensionService#_doActivateExtension vscode.github-authentication, startup: false, activationEvent: 'onStartupFinished', root cause: GitHub.vscode-pull-request-github
2023-12-06 00:06:30.783 [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-wsl, startup: false, activationEvent: 'onStartupFinished'
2023-12-06 00:06:30.784 [info] ExtensionService#_doActivateExtension usernamehw.errorlens, startup: false, activationEvent: 'onStartupFinished'
2023-12-06 00:06:30.787 [info] ExtensionService#_doActivateExtension vadimcn.vscode-lldb, startup: false, activationEvent: 'onStartupFinished'
2023-12-06 00:06:30.792 [info] ExtensionService#_doActivateExtension vscodevim.vim, startup: false, activationEvent: 'onStartupFinished'
2023-12-06 00:06:30.911 [error] No bundle location found for extension ms-vscode-remote.remote-wsl-recommender
2023-12-06 00:06:31.040 [info] ExtensionService#_doActivateExtension GitHub.vscode-pull-request-github, startup: false, activationEvent: 'onStartupFinished'
2023-12-06 00:06:32.727 [info] Extension host terminating: renderer closed the MessagePort
2023-12-06 00:06:32.741 [error] Canceled: Canceled
	at new f (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:108614)
	at n.U (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:134:10873)
	at F.<computed>.z.charCodeAt.F.<computed> (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:134:8315)
	at i.g (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:139130)
	at i.executeCommand (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:138568)
	at $.registerCommand.description (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:137892)
	at i.h (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:139669)
	at i.g (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:138661)
	at i.executeCommand (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:138568)
	at Object.executeCommand (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:140:21329)
	at x0.reset (c:\Users\**********\.vscode\extensions\github.vscode-pull-request-github-0.76.1\dist\extension.js:2003:7116)
	at x0.dispose (c:\Users\**********\.vscode\extensions\github.vscode-pull-request-github-0.76.1\dist\extension.js:2003:7387)
	at o (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:30:754)
	at h.cb (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:136:9843)
	at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:136:7793
	at Array.map (<anonymous>)
	at h.Y (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:136:7781)
	at h.terminate (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:136:8051)
	at o.terminate (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:140:1513)
	at a (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:153:9817)
	at MessagePortMain.<anonymous> (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:153:6242)
	at MessagePortMain.emit (node:events:513:28)
	at MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:2:367) setContext undefined
2023-12-06 00:06:32.749 [info] Extension host with pid 24672 exiting with code 0
2023-12-06 00:06:33.513 [info] Extension host with pid 24644 started
2023-12-06 00:06:33.513 [info] Skipping acquiring lock for c:\Users\**********\AppData\Roaming\Code\User\workspaceStorage\d3fa3e921653199d1b2cd39d3ce11394.
2023-12-06 00:06:33.514 [info] $getCanonicalURI invoked for authority (wsl)
2023-12-06 00:06:33.528 [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-wsl, startup: false, activationEvent: 'onResolveRemoteAuthority:wsl'
2023-12-06 00:06:33.596 [info] [resolveAuthority(wsl,1)][0ms] activating remote resolvers wsl+arch
2023-12-06 00:06:33.596 [info] [resolveAuthority(wsl,1)][0ms] activating resolver for wsl+arch...
2023-12-06 00:06:33.596 [info] [resolveAuthority(wsl,1)][0ms] invoking final resolve()...
2023-12-06 00:06:33.711 [warning] Using default string since no string found in i18n bundle that has the key: [Starting VS Code in WSL ({0})](command:remote-wsl.showLog)/{0} is distro name. do not change link format [message](command), only change message{Locked="](command:remote-wsl.showLog)"}
2023-12-06 00:06:34.612 [info] [resolveAuthority(wsl,1)][1015ms] waiting...
2023-12-06 00:06:35.626 [info] [resolveAuthority(wsl,1)][2030ms] waiting...
2023-12-06 00:06:36.642 [info] [resolveAuthority(wsl,1)][3045ms] waiting...
2023-12-06 00:06:36.754 [info] [resolveAuthority(wsl,1)][3158ms] setting tunnel factory...
2023-12-06 00:06:36.754 [info] [resolveAuthority(wsl,1)][3158ms] returned 127.0.0.1:57911

@aeschli
Copy link
Contributor

aeschli commented Dec 6, 2023

In the terminal view, you should see a tab 'WSL'

@Berrysoft
Copy link
Author

I cannot find any tab named 'WSL'. The terminal tab is empty inside and cannot launch a WSL shell.

And by the way, this error only occurs on the Windows Insider Canary.

@aeschli aeschli added the bug Issue identified by VS Code Team member as probable bug label Dec 6, 2023
@arnmar
Copy link

arnmar commented Dec 16, 2023

I am also facing the same problem. Switched to mirrored network mode and now I cannot connect to WSL.

@jklincn
Copy link

jklincn commented Jan 25, 2024

Hey! I also meet this problem. I can use VSCode to connect to WSL, but the speed is very slow. It takes about 40 seconds to open the first terminal. My .wslconfig only set the networkingMode.

  • Hardware: Intel i9-13905H with 32G memory
  • VSCode Version: 1.85.2
  • OS Version: Windows 11 10.0.22621.3007
  • WSL Version: 2.0.14.0
  • kernel Version: 5.15.133.1-1

@4riful
Copy link

4riful commented Jan 25, 2024

same issue here after I removed

[wsl2]
networkingMode=mirrored
it working fine

@bamurtaugh
Copy link
Member

Thanks all for the continued feedback. For those who are still experiencing this: to help the WSL team take a closer look, could you please take a trace? https://github.com/microsoft/WSL/blob/master/diagnostics/collect-networking-logs.ps1.

@Clockwork-Muse
Copy link

Started hitting this earlier today when my VSCode instance updated to 1.86, although reverting to an earlier version of VSCode/remote extensions did not seem to help.

Logs with mirrored networking off and able to connect to WSL/open a folder from VSCode.
WslLogs-2024-02-01_14-44-18-CanOpen.zip

Logs with mirrored networking on and not able to connect to WSL/open a folder in VSCode.
WslLogs-2024-02-01_14-48-45-CantConnect.zip

Both log collections were performed by shutting down wsl via wsl --shutdown, waiting an appropriate amount of time, starting the log collection script, then opening the Ubuntu application/WSL window, and then attempting to connect inside WSL

@charstal
Copy link

charstal commented Feb 5, 2024

Same problem.

@FleischKarussel
Copy link

Also affected here,
I'm also not sure if mirroredmode is still experimental or not?

Specs:
Hardware: AMD Ryzen 7 PRO 5850U with 32G memory
VSCode Version: 1.86.2
WSL-Version: 2.0.14.0
Kernelversion: 5.15.133.1-1
Windows-Version: 10.0.22631.3155

@aeschli
Copy link
Contributor

aeschli commented Feb 20, 2024

@craigloewen-msft We need the help of the WSL team here

What's the state of mirroredmode? I see there are many open issues on this also in the WSL inbox.
Is there a FAQ that helps to debug and fix these issues?

@bamurtaugh
Copy link
Member

I've also opened an issue on the WSL side: microsoft/WSL#11184.

@zhangqian1992
Copy link

Has this bug been fixed?

@Berrysoft
Copy link
Author

This week I've found that the bug has been fixed in the latest canary Windows. As the original author of the issue, I'll close it till the bug re-occurs.

@chanpreetdhanjal
Copy link

Hi. Can you please collect networking logs by following the instructions below?
https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues

@microsoft microsoft locked and limited conversation to collaborators Apr 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug wsl Issue in vscode-remote WSL
Projects
None yet
Development

No branches or pull requests