microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.68k stars 295 forks source link

VS Code Dev Container error when using WSL. #9357

Open SaurabhHarwande opened 10 months ago

SaurabhHarwande commented 10 months ago

I am trying to setup Dev Containers on my windows machine using WSL 2 hosted Alpine distro. The Apline distro has podman setup locally and am able to run containers on it.

Settings used on VS Code are as follows :

{
    "dev.containers.dockerPath": "podman",
    "dev.containers.executeInWSL": true,
    "dev.containers.executeInWSLDistro": "Alpine"
}

Trying to open a folder inside the container results in error. The set up details and logs are as given below:

Looks like we are trying to run ls for a Windows local path on a WSL 2 host distro. Maybe using wslpath -u instead of wslpath -w should help?

Steps to Reproduce:

  1. Clone the following repository https://github.com/microsoft/vscode-remote-try-node.git
  2. Install Dev Containers extension for VS code
  3. Press F1 and select Dev Containers: Open Folder in Container
  4. Select the cloned folder as target

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

Qwarctick commented 9 months ago

Maybe try to upgrade your extension, or downgrade to v0.309.0

https://github.com/microsoft/vscode-remote-release/issues/9064#issuecomment-1747913455

dwidge commented 8 months ago

This also happens on win11 and wsl2 and 0.349.0. Rollback to 0.309.0 fixed it. The command run manually in wsl: ls -a $(wslpath -w c:/Users/me/Desktop/devc) (fails) ls -a $(wslpath -u c:/Users/me/Desktop/devc) (works)

barrymw commented 6 months ago

I'm also getting the same issue, but the part that I find interesting, is that when I click the Reopen in Container: image It then fails with the "An error occurred setting up the container" dialog, and the output terminal showing the ls -a c:/users.... That is standard. I then click OK on this dialog: image And then Ctrl+Shift+P and run "Dev Containers: Reopen in Container"... and it works!?!? image

I have no idea why it responds differently, but at least it works. As an FYI, this is with Dev Containers v0.366.0 (pre-release) and VSCode 1.89.1.

solidDoWant commented 5 months ago

Seeing this on v0.362.0 as well. Using the Dev Containers: Reopen in Container command negates the issue on this version as well.

lucabandMSFT commented 4 months ago

same here with v0.369.0. Also using the Dev Containers: Reopen in Container command negates the issue on this version as well.

vnabet commented 4 months ago

Same here. A rollback to version 0.309 works and barrymw's strange solution with the latest version of the extension also works

tempcvrohch commented 4 months ago

My env crashes 1 step earlier just after wslpath -w /home/user/{{removed}} but no indication about the error itself, the wslpath returns \\wsl.localhost\Ubuntu-22.04\home\user\{{removed}}.

Switching from v0.375.1 (current) to v0.377.0 (pre-release) fixed this for me.

guzitajiu123 commented 3 months ago

you can copy your project in wsl to the default workspace , e.g, /mnt/d/code/myapp to /home/{me}/code/myapp. this is available for me