我在vmware装了一个linux虚拟机,用vscode remote远程可以正常连接虚拟机。
为了实现自动化,我用vmrun命令行工具no gui方式启动虚拟机,然后再用vscode remote连接虚拟机,但是总是连接失败,但如果我打开finalshell,就又可以连接了,一关闭finalshell,vscode的远程连接就会断,请问这是为什么?
关闭finalshell后,vscode断连出现的报错日志。
[21:38:11.185] Log Level: 2
[21:38:11.201] VS Code version: 1.81.1
[21:38:11.201] Remote-SSH version: remote-ssh@0.102.0
[21:38:11.201] win32 x64
[21:38:11.206] SSH Resolver called for "ssh-remote+terminal", attempt 1
[21:38:11.206] "remote.SSH.useLocalServer": false
[21:38:11.207] "remote.SSH.showLoginTerminal": true
[21:38:11.207] "remote.SSH.remotePlatform": {"terminal":"linux"}
[21:38:11.207] "remote.SSH.path": undefined
[21:38:11.207] "remote.SSH.configFile": undefined
[21:38:11.207] "remote.SSH.useFlock": true
[21:38:11.208] "remote.SSH.lockfilesInTmp": false
[21:38:11.208] "remote.SSH.localServerDownload": auto
[21:38:11.208] "remote.SSH.remoteServerListenOnSocket": false
[21:38:11.208] "remote.SSH.showLoginTerminal": true
[21:38:11.208] "remote.SSH.defaultExtensions": []
[21:38:11.208] "remote.SSH.loglevel": 2
[21:38:11.209] "remote.SSH.enableDynamicForwarding": true
[21:38:11.209] "remote.SSH.enableRemoteCommand": false
[21:38:11.209] "remote.SSH.serverPickPortsFromRange": {}
[21:38:11.209] "remote.SSH.serverInstallPath": {}
[21:38:11.215] SSH Resolver called for host: terminal
[21:38:11.215] Setting up SSH remote "terminal"
[21:38:11.223] Using commit id "6c3e3dba23e8fadc360aed75ce363ba185c49794" and quality "stable" for server
[21:38:11.226] Install and start server if needed
[21:38:11.231] Checking ssh with "C:\Program Files (x86)\VMware\VMware Workstation\bin\ssh.exe -V"
[21:38:11.233] Got error from ssh: spawn C:\Program Files (x86)\VMware\VMware Workstation\bin\ssh.exe ENOENT
[21:38:11.233] Checking ssh with "C:\Windows\system32\ssh.exe -V"
[21:38:11.235] Got error from ssh: spawn C:\Windows\system32\ssh.exe ENOENT
[21:38:11.235] Checking ssh with "C:\Windows\ssh.exe -V"
[21:38:11.236] Got error from ssh: spawn C:\Windows\ssh.exe ENOENT
[21:38:11.236] Checking ssh with "C:\Windows\System32\Wbem\ssh.exe -V"
[21:38:11.237] Got error from ssh: spawn C:\Windows\System32\Wbem\ssh.exe ENOENT
[21:38:11.237] Checking ssh with "C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe -V"
[21:38:11.238] Got error from ssh: spawn C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe ENOENT
[21:38:11.239] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.exe -V"
[21:38:11.278] > OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3
[21:38:11.281] Running script with connection command: "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 52040 terminal bash
[21:38:11.283] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[21:38:28.290] Resolver error: Error: Connecting with SSH timed out
at m.Timeout (c:\Users\廖志荣\.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:584271)
at Timeout._onTimeout (c:\Users\廖志荣\.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:680601)
at listOnTimeout (node:internal/timers:559:17)
at process.processTimers (node:internal/timers:502:7)
[21:38:28.298] ------
[21:38:32.668] > ssh: connect to host 192.168.217.128 port 22: Connection timed out
> 过程试图写入的管道不存在。
> ]0;C:\WINDOWS\System32\cmd.exe
[21:38:32.669] Got some output, clearing connection timeout
[21:38:33.938] "install" terminal command done
[21:38:33.938] Install terminal quit with output: ]0;C:\WINDOWS\System32\cmd.exe