VSCode Remote-SSH problem caused by cmd.exe crashed. 'Could not establish connection to "ServerName": Got bad result from install script'

huangapple go评论45阅读模式
英文:

VSCode Remote-SSH problem caused by cmd.exe crashed. 'Could not establish connection to "ServerName": Got bad result from install script'

问题

我之前能够使用VSCode的Remote-SSH扩展从我的Windows 10 PC连接到Linux服务器而没有任何问题。然而,现在我面临一个奇怪的问题,我收到一个错误消息,说:

无法建立与"MyServerName"的连接:从安装脚本中获得了错误结果

我尝试重新安装VSCode并尝试删除文件C:\Users\<your_user_name>\.ssh\known_host,但都没有解决我的问题。

此外,我注意到我无法正常打开cmd.exe。每当我尝试打开它时,它会弹出然后立即关闭,而PowerShell可以正常工作。

我怀疑这可能是导致我的问题的原因。如果我能解决cmd.exe崩溃的问题,那么Remote-SSH的问题也可能会得到解决。

在注意到cmd.exe崩溃的问题后,我发现"Windows Terminal"和"wt.exe"都不见了。尽管尝试从Microsoft Store重新安装Windows Terminal,但我仍然无法像以前那样打开cmd.exe。

参考已解决重新安装终端的方法:

有人可以帮助我解决这个问题吗?我已经陷在这里很长时间了。

英文:

I was able to connect to a Linux server from my Windows 10 PC using VSCode's Remote-SSH extension without any issues before. However, I am now facing a strange problem where I get an error message that says:

Could not establish connection to &quot;MyServerName&quot;: Got bad result from install script

I have tried reinstalling VSCode and also tried to delete the file C:\Users\&lt;your_user_name&gt;\.ssh\known_host, but none of them worked for me.

Furthermore, I noticed that I cannot open cmd.exe normally on my Windows PC. Whenever I try to open it, it just pops up and then closes immediately, while PowerShell works fine.

I suspect that this might be the cause of my issue. If I can solve the issue with cmd.exe crashing, then the Remote-SSH issue might also be resolved.

After noticing the issue with cmd.exe crashing, I discovered that both "Windows Terminal" and "wt.exe" were missing. Despite attempting to reinstall Windows Terminal from the Microsoft Store, I am still unable to open cmd.exe as I could before.

reference solved reinstall terminal's method:

Could someone please help me with this issue? I have been stuck on this for a long time.

答案1

得分: 1

I finally solved the issue by both the answer of @ZhangGe6 from this post!! and Could not establish connection to "hostname". I would provide a clear and complete process explanation in the hopes that it may help anyone else who is facing the same problem as me.

In short, the issue was indeed caused by cmd.exe crashing. Therefore, we need to resolve this problem. You can follow the bullet list steps to solve it. If you don't know how to do it, I will explain it in more detail below the bullet list.

Solution:

  • Change the registry values Autorun in HKEY_CURRENT_USER\Software\Microsoft\Command Processor from if exists to a blank (as this link suggests). Detail step as following:

2. Registry Values Located in Registry Editor, to open it: Type &#39;regedit&#39; in the Run command window, and then press Enter.&#39;

3. Now you can change the registry values &quot;Autorun&quot; in &quot;HKEY_CURRENT_USER\Software\Microsoft\Command Processor&quot; from &quot;if exists&quot; to a blank.

After doing that, my cmd.exe works fine! However, the usual problem faced by VSCode Remote-SSH "Could not establish connection to hostname" appear again.

  • You can simplify the solution by deleting the fingerprint saved within the known_hosts file. In Windows, this is placed at C:\Users\&lt;your_user_name&gt;\.ssh\known_host reference post.

Finally, Remote SSH works again.

英文:

I finally solved the issue by both the answer of @ZhangGe6 from this post!! and Could not establish connection to "hostname".
I would provide a clear and complete process explanation in the hopes that it may help anyone else who is facing the same problem as me.

In short, the issue was indeed caused by cmd.exe crashing. Therefore, we need to resolve this problem. You can follow the bullet list steps to solve it. If you don't know how to do it, I will explain it in more detail below the bullet list.

Solution:

  • Change the registry values Autorun in HKEY_CURRENT_USER\Software\Microsoft\Command Processor from if exists to a blank (as this link suggests). Detail step as following:
1. To open Run command window, you can either:
(1-1) Use the shortcut keys: &#39;Windows + R&#39;, or 
(1-2) Right Click &quot;Start&quot;, and click &quot;Run&quot; to open. 

2. Registry Values Located in Registry Editor, to open it:
Type &#39;regedit&#39; in the Run command window, and then press Enter.&#39;

3. Now you can change the registry values &quot;Autorun&quot; in &quot;HKEY_CURRENT_USER\Software\Microsoft\Command Processor&quot; from &quot;if exists&quot; to a blank.

After doing that, my cmd.exe works fine! However, the usual problem faced by VSCode Remote-SSH "Could not establish connection to hostname" appear again.

  • You can simplify the solution by deleting the fingerprint saved within the known_hosts file. In Windows, this is placed at C:\Users\&lt;your_user_name&gt;\.ssh\known_host reference post.

Finally, Remote SSH works again.

huangapple
  • 本文由 发表于 2023年4月4日 11:50:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/75925380.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定