VSCode Remote-SSH连接树莓派4遇ECONNREFUSED错误求助
VSCode Remote-SSH连接树莓派4遭遇ECONNREFUSED错误
我尝试通过微软Remote-SSH扩展将VSCode连接到树莓派4,但每次都会出现ECONNREFUSED错误,错误日志如下:
[14:49:20.954] Starting forwarding server. localPort 58139 -> socksPort 58137 -> remotePort 44131 [14:49:20.954] Forwarding server listening on 58139 [14:49:20.954] Waiting for ssh tunnel to be ready [14:49:20.955] [Forwarding server 58139] Got connection 0 [14:49:20.956] Tunneled 44131 to local port 58139 [14:49:20.957] Resolved "ssh-remote+192.168.42.1" to "127.0.0.1:58139" [14:49:20.958] Failed to set up socket for dynamic port forward to remote port 44131: connect ECONNREFUSED 127.0.0.1:58137. Is the remote port correct? [14:49:20.965] ------ [14:49:20.980] [Forwarding server 58139] Got connection 1 [14:49:20.981] Failed to set up socket for dynamic port forward to remote port 44131: connect ECONNREFUSED 127.0.0.1:58137. Is the remote port correct?
VSCode能成功SSH登录树莓派并安装VSCode Server,但不久后连接就会失败。
相关配置信息
创建SSH主机的命令
ssh -i ~/.ssh/rsa_file pi@192.168.42.1
树莓派的SSH配置文件内容
Port 22 AllowTcpForwarding yes AllowAgentForwarding yes AllowStreamLocalForwarding yes DisableForwarding no TCPKeepAlive yes
本地SSH配置
Host vscode_to_pi HostName 192.168.42.1 IdentityFile ~/.ssh/rsa_file User pi ForwardAgent yes ForwardX11 yes PubKeyAcceptedKeyTypes=+ssh-rsa HostKeyAlgorithms=+ssh-rsa StrictHostKeyChecking=no
已尝试的解决方法
- 查阅GitHub相关Issue并尝试对应方案
- 查阅Stack Overflow相关问题并尝试对应方案
- 终止主机上的VSCode Server并重新安装
- 重启VSCode
补充说明
- 树莓派通过WiFi适配器连接,连接期间无法访问互联网,但能正常安装VSCode Server
- Remote-SSH扩展设置中,Enable Agent Forwarding和Enable Dynamic Forwarding已开启
- Local Server Download已关闭,因为连接树莓派时无法下载内容
- 树莓派4的Debian版本为
11.3 - VSCode版本为
1.76.2 - Remote-SSH扩展版本为
v0.101.2023032415
恳请帮忙解决该连接问题。
内容的提问来源于stack exchange,提问作者ZontarZon
相关产品推荐
相关产品推荐

