Home > Software design >  Remote-SSH in VS Code: The vscode server failed to start SSH problem
Remote-SSH in VS Code: The vscode server failed to start SSH problem

Time:03-28

I use Remote-SSH to connect to my Macbook(Windows->Mac OS). It worked good, but one day the connection failed and I can't connect to my Mac afterwards. The Remote-SSH in my VS Code can still open connect to my linux machine.
The error log shows some issue with python and /node directory. I'm currently using python 3.9.10 in my Mac and it works perfect(already added in path). I've tried some troubleshooting methods but none of them works:
1.Remote-SSH: Kill VS Code Server on Host
2.rm -rf ~/.vscode-server command
3.Upgrade my gcc/g /clang version
Here is the main error log:

20:18:56.206] > 
> Server did not start successfully. Full server log at /Users/karlpython/.vscode-server/.c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1.log >>>
> /Users/karlpython/.vscode-server/bin/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1/bin/code-server: line 10: python: command not found
> usage: dirname string [...]
> usage: dirname string [...]
> /Users/karlpython/.vscode-server/bin/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1/bin/code-server: line 13: /node: No such file or directory
> <<< End of server log

see full log here:

[20:18:45.370] Log Level: 2
[20:18:45.371] [email protected]
[20:18:45.371] win32 x64
[20:18:45.376] SSH Resolver called for "ssh-remote 192.168.0.103", attempt 1
[20:18:45.376] "remote.SSH.useLocalServer": false
[20:18:45.377] "remote.SSH.showLoginTerminal": false
[20:18:45.377] "remote.SSH.remotePlatform": {"192.168.0.103":"macOS","192.168.0.101":"linux","124.223.189.199":"linux"}
[20:18:45.377] "remote.SSH.path": undefined
[20:18:45.377] "remote.SSH.configFile": C:\Users\Cheng ZX\.ssh\config
[20:18:45.377] "remote.SSH.useFlock": true
[20:18:45.377] "remote.SSH.lockfilesInTmp": false
[20:18:45.379] "remote.SSH.localServerDownload": auto
[20:18:45.379] "remote.SSH.remoteServerListenOnSocket": false
[20:18:45.380] "remote.SSH.showLoginTerminal": false
[20:18:45.380] "remote.SSH.defaultExtensions": []
[20:18:45.380] "remote.SSH.loglevel": 2
[20:18:45.380] "remote.SSH.enableDynamicForwarding": true
[20:18:45.380] "remote.SSH.enableRemoteCommand": false
[20:18:45.380] "remote.SSH.serverPickPortsFromRange": {}
[20:18:45.381] "remote.SSH.serverInstallPath": {}
[20:18:45.394] SSH Resolver called for host: 192.168.0.103
[20:18:45.394] Setting up SSH remote "192.168.0.103"
[20:18:45.443] Using commit id "c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1" and quality "stable" for server
[20:18:45.447] Install and start server if needed
[20:18:45.449] Checking ssh with "ssh -V"
[20:18:46.299] > OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2

[20:18:46.514] Using SSH config file "C:\Users\Cheng ZX\.ssh\config"
[20:18:46.514] Running script with connection command: ssh -T -D 8936 -F "C:\Users\Cheng ZX\.ssh\config" "192.168.0.103" bash
[20:18:46.516] Terminal shell path: C:\Windows\System32\cmd.exe
[20:18:48.026] > ]0;C:\Windows\System32\cmd.exe
[20:18:48.027] Got some output, clearing connection timeout
[20:18:48.292] > 
> 
> 
> 
> 
[20:18:48.343] > 78d72181e11d: running
[20:18:48.369] > Acquiring lock on /Users/karlpython/.vscode-server/bin/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1/vscode-remote-lock.karlpython.c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1
> \ln /Users/karlpython/.vscode-server/bin/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1/vscode-remote-lock.karlpython.c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1.target /Users/karlpython/.vscode-server/bin/c722
> ca6c7eed3d7987c0d5c3df5c45f6b15e77d1/vscode-remote-lock.karlpython.c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1
[20:18:48.390] > Found existing installation at /Users/karlpython/.vscode-server/bin/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1...
> Checking /Users/karlpython/.vscode-server/.c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1.log and /Users/karlpython/.vscode-server/.c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1.pid for a running server
> Looking for server with pid: 11226
[20:18:48.412] > Starting server with command... /Users/karlpython/.vscode-server/bin/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1/bin/code-server --start-server --host=127.0.0.1 --accept-server-license-terms --enable-remo
> te-auto-shutdown --port=0 --telemetry-level all   &> "/Users/karlpython/.vscode-server/.c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1.log" < /dev/null
> printenv:
>     SHELL=/bin/zsh
>     TMPDIR=/var/folders/jx/nykz6h1d6fv30yf5q4gz8sm40000gn/T/
>     SSH_CLIENT=192.168.0.105 8941 22
>     USER=karlpython
>     VSCODE_AGENT_FOLDER=/Users/karlpython/.vscode-server
>     PATH=/usr/bin:/bin:/usr/sbin:/sbin
>     PWD=/Users/karlpython
>     SHLVL=1
>     HOME=/Users/karlpython
>     LOGNAME=karlpython
>     SSH_CONNECTION=192.168.0.105 8941 192.168.0.103 22
>     _=/usr/bin/printenv
> Removing old logfile at /Users/karlpython/.vscode-server/.c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1.log
[20:18:48.430] > 
> Spawned remote server: 12137
> Waiting for server log...
[20:18:48.442] > 
[20:18:48.456] > Waiting for server log...
[20:18:48.495] > Waiting for server log...
[20:18:48.534] > Waiting for server log...
[20:18:48.576] > Waiting for server log...
[20:18:48.625] > Waiting for server log...
[20:18:48.675] > Waiting for server log...
[20:18:48.722] > Waiting for server log...
[20:18:48.771] > Waiting for server log...
[20:18:48.820] > Waiting for server log...
[20:18:48.876] > Waiting for server log...
[20:18:48.927] > Waiting for server log...
[20:18:48.975] > Waiting for server log...
[20:18:49.025] > Waiting for server log...
[20:18:49.076] > Waiting for server log...
[20:18:49.127] > Waiting for server log...
[20:18:49.176] > Waiting for server log...
[20:18:49.226] > Waiting for server log...
[20:18:49.276] > Waiting for server log...
[20:18:49.330] > Waiting for server log...
[20:18:49.379] > Waiting for server log...
[20:18:49.478] > Waiting for server log...
[20:18:49.586] > Waiting for server log...
[20:18:49.628] > Waiting for server log...
> Waiting for server log...
[20:18:49.657] > Waiting for server log...
[20:18:49.689] > Waiting for server log...
[20:18:49.739] > Waiting for server log...
[20:18:49.792] > Waiting for server log...
[20:18:49.844] > Waiting for server log...
[20:18:49.896] > Waiting for server log...
[20:18:49.957] > Waiting for server log...
[20:18:50.011] > Waiting for server log...
[20:18:50.066] > Waiting for server log...
[20:18:50.119] > Waiting for server log...
[20:18:50.172] > Waiting for server log...
[20:18:50.224] > Waiting for server log...
[20:18:50.271] > Waiting for server log...
[20:18:50.322] > Waiting for server log...
[20:18:50.379] > Waiting for server log...
[20:18:50.430] > Waiting for server log...
[20:18:50.488] > Waiting for server log...
[20:18:50.546] > Waiting for server log...
[20:18:50.603] > Waiting for server log...
[20:18:50.653] > Waiting for server log...
[20:18:50.705] > Waiting for server log...
[20:18:50.755] > Waiting for server log...
[20:18:50.804] > Waiting for server log...
[20:18:50.854] > Waiting for server log...
[20:18:50.909] > Waiting for server log...
[20:18:50.961] > Waiting for server log...
[20:18:51.011] > Waiting for server log...
[20:18:51.069] > Waiting for server log...
[20:18:51.119] > Waiting for server log...
[20:18:51.171] > Waiting for server log...
[20:18:51.222] > Waiting for server log...
[20:18:51.271] > Waiting for server log...
[20:18:51.326] > Waiting for server log...
[20:18:51.377] > Waiting for server log...
[20:18:51.430] > Waiting for server log...
[20:18:51.477] > Waiting for server log...
[20:18:51.536] > Waiting for server log...
[20:18:51.582] > Waiting for server log...
[20:18:51.636] > Waiting for server log...
[20:18:51.692] > Waiting for server log...
[20:18:51.743] > Waiting for server log...
[20:18:51.794] > Waiting for server log...
[20:18:51.843] > Waiting for server log...
[20:18:51.899] > Waiting for server log...
[20:18:51.946] > Waiting for server log...
[20:18:52.003] > Waiting for server log...
[20:18:52.055] > Waiting for server log...
[20:18:52.103] > Waiting for server log...
[20:18:52.160] > Waiting for server log...
[20:18:52.219] > Waiting for server log...
[20:18:52.272] > Waiting for server log...
[20:18:52.326] > Waiting for server log...
[20:18:52.368] > Waiting for server log...
[20:18:52.425] > Waiting for server log...
[20:18:52.470] > Waiting for server log...
[20:18:52.526] > Waiting for server log...
[20:18:52.577] > Waiting for server log...
[20:18:52.625] > Waiting for server log...
[20:18:52.678] > Waiting for server log...
[20:18:52.726] > Waiting for server log...
[20:18:52.776] > Waiting for server log...
[20:18:52.826] > Waiting for server log...
[20:18:52.876] > Waiting for server log...
[20:18:52.927] > Waiting for server log...
[20:18:52.972] > Waiting for server log...
[20:18:53.023] > Waiting for server log...
[20:18:53.074] > Waiting for server log...
[20:18:53.127] > Waiting for server log...
[20:18:53.179] > Waiting for server log...
[20:18:53.226] > Waiting for server log...
[20:18:53.276] > Waiting for server log...
[20:18:53.322] > Waiting for server log...
[20:18:53.370] > Waiting for server log...
[20:18:53.411] > Waiting for server log...
[20:18:53.463] > Waiting for server log...
[20:18:53.524] > Waiting for server log...
[20:18:53.571] > Waiting for server log...
[20:18:53.626] > Waiting for server log...
[20:18:53.678] > Waiting for server log...
[20:18:53.738] > Waiting for server log...
[20:18:53.793] > Waiting for server log...
[20:18:53.846] > Waiting for server log...
[20:18:53.905] > Waiting for server log...
[20:18:53.956] > Waiting for server log...
[20:18:54.004] > Waiting for server log...
[20:18:54.105] > Waiting for server log...
[20:18:54.112] > Waiting for server log...
[20:18:54.170] > Waiting for server log...
[20:18:54.236] > Waiting for server log...
[20:18:54.289] > Waiting for server log...
[20:18:54.343] > Waiting for server log...
[20:18:54.404] > Waiting for server log...
[20:18:54.459] > Waiting for server log...
[20:18:54.509] > Waiting for server log...
[20:18:54.559] > Waiting for server log...
[20:18:54.606] > Waiting for server log...
[20:18:54.661] > Waiting for server log...
[20:18:54.711] > Waiting for server log...
[20:18:54.760] > Waiting for server log...
[20:18:54.821] > Waiting for server log...
[20:18:54.869] > Waiting for server log...
[20:18:54.923] > Waiting for server log...
[20:18:54.968] > Waiting for server log...
[20:18:55.020] > Waiting for server log...
[20:18:55.069] > Waiting for server log...
[20:18:55.121] > Waiting for server log...
[20:18:55.169] > Waiting for server log...
[20:18:55.227] > Waiting for server log...
[20:18:55.286] > Waiting for server log...
[20:18:55.343] > Waiting for server log...
[20:18:55.405] > Waiting for server log...
[20:18:55.454] > Waiting for server log...
[20:18:55.509] > Waiting for server log...
[20:18:55.560] > Waiting for server log...
[20:18:55.611] > Waiting for server log...
[20:18:55.660] > Waiting for server log...
[20:18:55.713] > Waiting for server log...
[20:18:55.772] > Waiting for server log...
[20:18:55.821] > Waiting for server log...
[20:18:55.871] > Waiting for server log...
[20:18:55.921] > Waiting for server log...
[20:18:55.979] > Waiting for server log...
[20:18:56.038] > Waiting for server log...
[20:18:56.083] > Waiting for server log...
[20:18:56.127] > Waiting for server log...
[20:18:56.177] >  
> *
> * Reminder: You may only use this software with Visual Studio family products,
> * as described in the license (https://go.microsoft.com/fwlink/?linkid=2077057)
> *
> 
[20:18:56.206] > 
> Server did not start successfully. Full server log at /Users/karlpython/.vscode-server/.c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1.log >>>
> /Users/karlpython/.vscode-server/bin/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1/bin/code-server: line 10: python: command not found
> usage: dirname string [...]
> usage: dirname string [...]
> /Users/karlpython/.vscode-server/bin/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1/bin/code-server: line 13: /node: No such file or directory
> <<< End of server log
> 78d72181e11d: start
> exitCode==32==
> listeningOn====
> osReleaseId==Darwin==
> arch==arm64==
> tmpDir==/tmp==
> platform==macOS==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> extInstallTime====
> serverStartTime==8000==
> 78d72181e11d: end
[20:18:56.206] Received install output: 
exitCode==32==
listeningOn====
osReleaseId==Darwin==
arch==arm64==
tmpDir==/tmp==
platform==macOS==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime==8000==

[20:18:56.207] Resolver error: Error: The VS Code Server failed to start
    at Function.ServerInstallError (c:\Users\Cheng ZX\.vscode\extensions\ms-vscode-remote.remote-ssh-0.76.0\out\extension.js:1:585975)
    at p (c:\Users\Cheng ZX\.vscode\extensions\ms-vscode-remote.remote-ssh-0.76.0\out\extension.js:1:579824)
    at Object.t.handleInstallOutput (c:\Users\Cheng ZX\.vscode\extensions\ms-vscode-remote.remote-ssh-0.76.0\out\extension.js:1:583109)
    at Object.t.tryInstall (c:\Users\Cheng ZX\.vscode\extensions\ms-vscode-remote.remote-ssh-0.76.0\out\extension.js:1:681777)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async c:\Users\Cheng ZX\.vscode\extensions\ms-vscode-remote.remote-ssh-0.76.0\out\extension.js:1:644417
    at async Object.t.withShowDetailsEvent (c:\Users\Cheng ZX\.vscode\extensions\ms-vscode-remote.remote-ssh-0.76.0\out\extension.js:1:647762)
    at async Object.t.resolve (c:\Users\Cheng ZX\.vscode\extensions\ms-vscode-remote.remote-ssh-0.76.0\out\extension.js:1:645496)
    at async c:\Users\Cheng ZX\.vscode\extensions\ms-vscode-remote.remote-ssh-0.76.0\out\extension.js:1:722803
[20:18:56.213] ------




[20:18:56.690] > 
[20:18:58.053] "install" terminal command done
[20:18:58.053] Install terminal quit with output: 

CodePudding user response:

I've somehow figured it out. Mac OS 12.3 has removed python2. By replacing python command with python3 in the 'code-server' file can fix this.

see also this issue on github:https://github.com/microsoft/vscode-remote-release/issues/6442

CodePudding user response:

Previously, the MAC built-in Python 2.7 will lead to various problems such as confusion of Python version. The built-in Python will be deleted in the new version 12.3 launched on the March 15th. Maybe this is the reason that leads to the problem of Python version recognition in vscode connecting Mac. For your current problems, I think we can solve them with the following methods:

  1. find the line

    /Users/karlpython/.vscode-server/bin/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1/bin/code-server: line 10: python: command not found

  2. Find the instruction file according to the error content prompt

  3. Replace the full path of python3 in the current Mac with the original path and restart

  • Related