vscode-remote-release icon indicating copy to clipboard operation
vscode-remote-release copied to clipboard

vscode ssh not connecting, but terminal is able to connect

Open BinghaoLu opened this issue 4 years ago • 8 comments

Hi, everyone:

I am experiencing an connection issue with vscode remote ssh, previously it works fine, however, somedays ago, it suddenly didn't work. Right now, I am still able to connect to the server from terminal, but not from vscode ssh, it keeps asking me to input the password, when I tried it multiple times, it says 'couldn't establish connection', the output is as below, can someone please help up here?

[21:19:01.913] Log Level: 2
[21:19:01.913] [email protected]
[21:19:01.913] win32 x64
[21:19:01.918] SSH Resolver called for "ssh-remote+137.99.3.149", attempt 1
[21:19:01.918] "remote.SSH.useLocalServer": false
[21:19:01.918] "remote.SSH.showLoginTerminal": false
[21:19:01.918] "remote.SSH.remotePlatform": {"137.99.3.149":"linux"}
[21:19:01.918] "remote.SSH.path": undefined
[21:19:01.918] "remote.SSH.configFile": undefined
[21:19:01.918] "remote.SSH.useFlock": true
[21:19:01.918] "remote.SSH.lockfilesInTmp": false
[21:19:01.919] "remote.SSH.localServerDownload": auto
[21:19:01.919] "remote.SSH.remoteServerListenOnSocket": false
[21:19:01.919] "remote.SSH.showLoginTerminal": false
[21:19:01.919] "remote.SSH.defaultExtensions": []
[21:19:01.919] "remote.SSH.loglevel": 2
[21:19:01.919] "remote.SSH.enableDynamicForwarding": true
[21:19:01.919] "remote.SSH.enableRemoteCommand": false
[21:19:01.919] "remote.SSH.serverPickPortsFromRange": {}
[21:19:01.919] "remote.SSH.serverInstallPath": {}
[21:19:01.932] SSH Resolver called for host: 137.99.3.149
[21:19:01.932] Setting up SSH remote "137.99.3.149"
[21:19:01.934] Using commit id "da15b6fd3ef856477bf6f4fb29ba1b7af717770d" and quality "stable" for server
[21:19:01.936] Install and start server if needed
[21:19:01.952] Checking ssh with "ssh -V"
[21:19:01.998] > OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2

[21:19:02.001] Running script with connection command: ssh -T -D 57595 "137.99.3.149" bash
[21:19:02.002] Terminal shell path: C:\Windows\System32\cmd.exe
[21:19:02.211] > ]0;C:\Windows\System32\cmd.exe
[21:19:02.211] Got some output, clearing connection timeout
[21:19:02.294] > [email protected]'s password: 
[21:19:02.294] Showing password prompt
[21:19:06.005] Got password response
[21:19:06.005] "install" wrote data to terminal: "************"
[21:19:06.018] > 
[21:19:06.644] > /home/bil21004/.bashrc: line 98: dirname: command not found
[21:19:06.655] > /home/bil21004/.bashrc: line 98: dirname: command not found
> /home/bil21004/.bashrc: line 23: dirname: command not found
> /home/bil21004/.bashrc: line 24: dirname: command not found
[21:19:06.785] > /home/bil21004/anaconda3/etc/profile.d/conda.sh: line 15: dirname: command not f
> ound
[21:19:06.794] > /home/bil21004/anaconda3/etc/profile.d/conda.sh: line 16: dirname: command not f
> ound
[21:19:06.922] > 8d345006c455: running
[21:19:06.964] > bash: line 180: ldd: command not found
[21:19:06.972] > bash: line 180: head: command not found
> Missing GLIBC >= 2.17!
> Found version
> 8d345006c455$$1$$
> Acquiring lock on /home/bil21004/.vscode-server/bin/da15b6fd3ef856477bf6f4fb29ba
> 1b7af717770d/vscode-remote-lock.bil21004.da15b6fd3ef856477bf6f4fb29ba1b7af717770
> d
> main: line 228: flock: command not found
> Installation already in progress...
> If you continue to see this message, you can try toggling the remote.SSH.useFloc
> k setting
> 8d345006c455: start
> exitCode==24==
> listeningOn====
> osReleaseId==ubuntu==
> arch==x86_64==
> tmpDir==/run/user/1004==
> platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> extInstallTime====
> serverStartTime====
> 8d345006c455: end
> main: line 228: flock: command not found
> main: line 228: flock: command not found
[21:19:06.972] Received install output: 
exitCode==24==
listeningOn====
osReleaseId==ubuntu==
arch==x86_64==
tmpDir==/run/user/1004==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime====

[21:19:06.973] Server installation process already in progress - waiting and retrying
[21:19:07.990] Running script with connection command: ssh -T -D 57595 "137.99.3.149" bash
[21:19:07.991] Terminal shell path: C:\Windows\System32\cmd.exe
[21:19:08.204] > ]0;C:\Windows\System32\cmd.exe
[21:19:08.204] Got some output, clearing connection timeout
[21:19:08.289] > [email protected]'s password: 
[21:19:08.289] Showing password prompt
[21:19:08.441] "install" terminal command done
[21:19:08.441] Install terminal quit with output: 
[21:19:15.142] "install" terminal command done
[21:19:15.142] Install terminal quit with output: ]0;C:\Windows\System32\cmd.exe[email protected]'s password: 
[21:19:15.142] Received install output: ]0;C:\Windows\System32\cmd.exe[email protected]'s password: 
[21:19:15.142] Failed to parse remote port from server output
[21:19:15.142] Resolver error: Error: 
	at Function.Create (c:\Users\bil21004\.vscode\extensions\ms-vscode-remote.remote-ssh-0.78.0\out\extension.js:1:586041)
	at Object.t.handleInstallOutput (c:\Users\bil21004\.vscode\extensions\ms-vscode-remote.remote-ssh-0.78.0\out\extension.js:1:584693)
	at Object.t.tryInstall (c:\Users\bil21004\.vscode\extensions\ms-vscode-remote.remote-ssh-0.78.0\out\extension.js:1:681924)
	at processTicksAndRejections (node:internal/process/task_queues:96:5)
	at async c:\Users\bil21004\.vscode\extensions\ms-vscode-remote.remote-ssh-0.78.0\out\extension.js:1:644564
	at async Object.t.withShowDetailsEvent (c:\Users\bil21004\.vscode\extensions\ms-vscode-remote.remote-ssh-0.78.0\out\extension.js:1:647909)
	at async Object.t.resolve (c:\Users\bil21004\.vscode\extensions\ms-vscode-remote.remote-ssh-0.78.0\out\extension.js:1:645643)
	at async c:\Users\bil21004\.vscode\extensions\ms-vscode-remote.remote-ssh-0.78.0\out\extension.js:1:722950
[21:19:15.145] ------




[21:19:18.025] Password dialog canceled
[21:19:18.025] "install" terminal command canceled
[21:19:18.025] > [email protected]'s password:
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
[21:19:18.026] Showing password prompt

BinghaoLu avatar May 15 '22 01:05 BinghaoLu

it also says below from a small window on the bottom right of vscode:

the remote host may not meet vscode server prerequisites for glibc and libstdc++

BinghaoLu avatar May 15 '22 01:05 BinghaoLu

Did you make any changes to your .bashrc file? I'm seeing several errors in your logs in relation to that

tanhakabir avatar May 16 '22 16:05 tanhakabir

Did you make any changes to your .bashrc file? I'm seeing several errors in your logs in relation to that

Hi, thank you for you reply, I did some changes in .bashrc file, to make sure it enter some specific conda environment when I open an terminal and it has been working well for a long time, here is my current '.bashrc' file, thanks.

#export PATH="/usr/bin:$PATH"
#
#export PATH="/home/bil21004/anaconda3/bin:$PATH"  # commented out by conda initialize
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/bil21004/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/home/bil21004/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/home/bil21004/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/home/bil21004/anaconda3/bin:$PATH"
        #export PATH="/home/bil21004/anaconda3/envs/binghao/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

source activate binghao
#conda activate binghao

BinghaoLu avatar May 16 '22 16:05 BinghaoLu

How to fix it? I also meet the same issue

Tzy010822 avatar Sep 26 '22 11:09 Tzy010822

@BinghaoLu

Tzy010822 avatar Sep 26 '22 11:09 Tzy010822

I ran into this issue as well. In my case, the root cause appears to be an AutoRun command that Anaconda adds that breaks cmd.exe. This is what command prompts look like on my end:

Microsoft Windows [Version 10.0.22621.674]
(c) Microsoft Corporation. All rights reserved.
& was unexpected at this time.

[process exited with code 1 (0x00000001)]

You can check if Anaconda added this AutoRun command by running the following in PowerShell:

Get-ItemProperty -ea Ignore ('HKCU:', 'HKLM:' -replace '$', '\Software\Microsoft\Command Processor') AutoRun

In my case this returned this command as one of the values:

AutoRun      : if exist & if exist & if exist "C:\Users\<username>\Miniconda3\condabin\conda_hook.bat" "C:\Users\<username>\Miniconda3\condabin\conda_hook.bat"

Running the following in an elevated PowerShell removed the AutoRun command.

Get-ItemProperty -ea Ignore ('HKCU:', 'HKLM:' -replace '$', '\Software\Microsoft\Command Processor') AutoRun |
  Remove-ItemProperty -Name AutoRun

In my case, this was due to not calling conda init correctly. See this Stack Overflow for more details on the issue and how to fix it.

bradarm avatar Oct 12 '22 23:10 bradarm

In my case, by adding this line in the vscode settings (JSON) file works.

 "remote.SSH.useLocalServer": false

afterglow-nju avatar Nov 10 '22 08:11 afterglow-nju

These are all issues. Something might be wrong with your bashrc or conda configuration, and the machine is missing some other commands that we need

[21:19:06.644] > /home/bil21004/.bashrc: line 98: dirname: command not found [21:19:06.655] > /home/bil21004/.bashrc: line 98: dirname: command not found /home/bil21004/.bashrc: line 23: dirname: command not found /home/bil21004/.bashrc: line 24: dirname: command not found [21:19:06.785] > /home/bil21004/anaconda3/etc/profile.d/conda.sh: line 15: dirname: command not f ound [21:19:06.794] > /home/bil21004/anaconda3/etc/profile.d/conda.sh: line 16: dirname: command not f ound [21:19:06.922] > 8d345006c455: running [21:19:06.964] > bash: line 180: ldd: command not found [21:19:06.972] > bash: line 180: head: command not found Missing GLIBC >= 2.17!

roblourens avatar Dec 17 '22 19:12 roblourens