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

WSL: Failed to connect to the remote extension host server. Error: Command failed #5425

Closed
galtom opened this issue Aug 7, 2021 · 1 comment
Labels
wsl Issue in vscode-remote WSL

Comments

@galtom
Copy link

galtom commented Aug 7, 2021

VSCode Version: 1.59.0
Local OS Version: Windows 10 Pro 21H1
Remote OS Version: Ubunutu 20.04 and Ubuntu 18.04
Remote Extension/Connection Type: WSL

Logs:

[2021-08-07 17:55:31.319] Resolving wsl+Ubuntu-20.04, resolveAttempt: 1
[2021-08-07 17:55:31.402] Starting VS Code Server inside WSL (Ubuntu-20.04)
[2021-08-07 17:55:31.402] Extension version: 0.58.2, Windows build: 19043. Multi distro support: available. WSL path support: enabled

In Developer Tools:

ERR Error: Command failed: C:\Windows\System32\wsl.exe -d Ubuntu-20.04 sh -c [ -f '/tmp/vscode-distro-env.jSWdqa' ] && cat '/tmp/vscode-distro-env.jSWdqa' || echo ''
	at checkExecSyncError (child_process.js:625:11)
	at Object.execFileSync (child_process.js:643:15)
	at Object.func [as execFileSync] (electron/js2c/asar_bundle.js:5:1846)
	at Object.h [as executeCommand] (c:\Users\thomas\.vscode\extensions\ms-vscode-remote.remote-wsl-0.58.2\dist\extension.js:1:276626)
	at D.getResolvedOptions (c:\Users\thomas\.vscode\extensions\ms-vscode-remote.remote-wsl-0.58.2\dist\extension.js:1:262664)
	at c:\Users\thomas\.vscode\extensions\ms-vscode-remote.remote-wsl-0.58.2\dist\extension.js:1:263569
	at new Promise (<anonymous>)
	at D._resolve (c:\Users\thomas\.vscode\extensions\ms-vscode-remote.remote-wsl-0.58.2\dist\extension.js:1:263107)
	at c:\Users\thomas\.vscode\extensions\ms-vscode-remote.remote-wsl-0.58.2\dist\extension.js:1:262120
	at C._withProgress (c:\Users\thomas\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:85:44908)
	at C.withProgress (c:\Users\thomas\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:85:44662)
	at Object.withProgress (c:\Users\thomas\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:94:29933)
	at D.resolve (c:\Users\thomas\.vscode\extensions\ms-vscode-remote.remote-wsl-0.58.2\dist\extension.js:1:261971)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async v.$resolveAuthority (c:\Users\thomas\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:90:18925)

Steps to Reproduce:

Call Remote SSH: New WSL window

What happens the commad:

If I run the command in powershell C:\Windows\System32\wsl.exe -d Ubuntu-20.04 sh -c [ -f '/tmp/vscode-distro-env.jSWdqa' ] && cat '/tmp/vscode-distro-env.jSWdqa' || echo '' the error message is: -f: 1: [: missing ].

~ ❯ C:\Windows\System32\wsl.exe -d Ubuntu-20.04 sh -c [ -f '/tmp/vscode-distro-env.jSWdqa' ] && cat '/tmp/vscode-distro-env.jSWdqa' || echo ''
-f: 1: [: missing ]

If I run the sh -c command enclosed with " the file content gets displayed:

~ ❯ C:\Windows\System32\wsl.exe -d Ubuntu-20.04 sh -c "[ -f '/tmp/vscode-distro-env.jSWdqa' ] && cat '/tmp/vscode-distro-env.jSWdqa' || echo"
LESSOPEN=| /usr/bin/lesspipe %s
USER=thomas
SHLVL=1
WT_PROFILE_ID={07b52e3e-de2c-5db4-bd2d-ba144ed6c273}
HOME=/home/thomas
OLDPWD=/home/thomas/workspace/php/custom_wordpress_opcnet_form
WSL_DISTRO_NAME=Ubuntu-20.04
LOGNAME=thomas
NAME=Code
WSL_INTEROP=/run/WSL/7_interop
_=/mnt/c/Users/thomas/AppData/Local/Programs/Microsoft VS Code/bin/code
TERM=xterm-256color
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Python27/:/mnt/c/Python27/Scripts:/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/mnt/c/Python39/Scripts/:/mnt/c/Python39/:/mnt/c/Python38/Scripts/:/mnt/c/Python38/:/mnt/c/Program Files (x86)/Intel/iCLS Client/:/mnt/c/Program Files/Intel/iCLS Client/:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/mnt/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/mnt/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/mnt/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/mnt/c/Program Files/PuTTY/:/mnt/c/Program Files/Microsoft SQL Server/130/Tools/Binn/:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/nodejs/:/mnt/c/Program Files (x86)/STMicroelectronics/STM32 ST-LINK Utility/ST-LINK Utility:/mnt/c/Program Files (x86)/Mercurial:/mnt/c/Program Files (x86)/dotnet/:/mnt/c/Program Files/PowerShell/7/:/mnt/c/Program Files (x86)/GNU Tools ARM Embedded/6 2017-q2-update/bin:/mnt/c/Users/thomas/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/thomas/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/thomas/.dotnet/tools:/mnt/c/Users/thomas/AppData/Roaming/npm:/snap/bin
WT_SESSION=569b8d1f-c47b-4909-b27d-c5f23d1f71ae
LANG=hu_HU.UTF-8
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
SHELL=/bin/bash
LESSCLOSE=/usr/bin/lesspipe %s %s
PWD=/tmp
XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
HOSTTYPE=x86_64
WSLENV=ELECTRON_RUN_AS_NODE/w:WT_SESSION::WT_PROFILE_ID
@galtom galtom changed the title WSL: Failed to connect to the remote extension host server Error: Command failed WSL: Failed to connect to the remote extension host server. Error: Command failed Aug 7, 2021
@github-actions github-actions bot added the wsl Issue in vscode-remote WSL label Aug 7, 2021
@galtom
Copy link
Author

galtom commented Aug 10, 2021

Hi!

Found the issue. The problem was "Use Legacy Console" in cmd.exe. After turned off (right click on the Title bar of the windows of cmd.exe, and select Properties. On the Options tab disable the "Use Legacy Console" option), the WSL remote extension is working again.
If you try to run bash in cmd and got Unsupported console settings. In order to use this feature, the legacy console must be disabled. , your cmd is running in legacy mode, which affects all other consoles too.

@galtom galtom closed this as completed Aug 10, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Sep 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
wsl Issue in vscode-remote WSL
Projects
None yet
Development

No branches or pull requests

1 participant