-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Remote-SSH Bug]: SSH_AUTH_SOCK
is getting stale over time
#9819
Comments
@hellt thanks for re-opening this as a new issue! |
We are seeing same behavior. From Windows or MacOS VS Code client (latest version). We connect to a Linux RHEL8 host with ssh agent forwarding. First remote-ssh connection succeeds. Then, if you "Developer: Reload Window" or if you "Close Remote Connection" and reconnect again, the env var $SSH_SOCK_AUTH refers to an invalid socket file. You can confirm this by starting a new terminal and typing Furthermore, if you use SSH to acces git repos within the SCM, you will get "access denied" The "solution" is that you have to kill remote vscode server and reconnect again to have succesfull forwarding. Workarounds I found was :
VS Code Version: 1.89.1 |
The workaround specified to set |
I faced this issue on vscode on the remote machine, where was I fixing the tmux.conf (pertaining to SSH key forwarding) & noticed this SSH_AUTH_SOCK stale issue. setting "remote.SSH.useExecServer": false resolved the issue. |
Thanks for the issue, fixed in the next SSH prerelease version |
Hi @hellt! Are you able to verify if this fix works? You can do so by getting the latest pre-release version of the remote-ssh extension and trying these same steps there. We want to make sure we get this bug verified, and the fix is correct, before we release this to stable. Thanks! |
Hi @eleanorjboyd |
Hi @eleanorjboyd, thanks for asking back on this one. Cloud you let us know the specific pre-release version number that includes the possible fix you are referencing? This would allow us to make sure we're testing against the correct codebase. Thx! |
The latest version (v0.113.2024072315) should contain the fixes |
You might also need to use VS Code Insiders to access the newest pre-release version of Remote-SSH. |
@connor4312 @eleanorjboyd Here is what I have after I reconnected using vscode:
the symlink is broken because the target socket doesn't exist
What exists is:
|
If you're keeping a terminal open to check, please watch for any environment variable updates in that terminal (signalled by the |
not sure what you mean, tbh. My current workaround is to run this oneliner whenever the socket var gets stale:
|
Can you share the output of your Remote - SSH log? |
@connor4312
|
In those logs it doesn't look like SSH forwarding is on in your settings (probably If agent forwarding is enabled you should see the substring |
You'd have to manually reestablish the socket upon reconnect, f.e. in |
In my vscode config I tried both with In my Happy to provide more logs if there is a guide how to collect them. ADD1: Here is the log with [23:24:14.728] Log Level: 2 [23:24:14.737] VS Code version: 1.91.1 [23:24:14.737] Remote-SSH version: [email protected] [23:24:14.737] darwin arm64 [23:24:14.738] SSH Resolver called for "ssh-remote+devbox", attempt 1 [23:24:14.738] "remote.SSH.useLocalServer": true [23:24:14.738] "remote.SSH.useExecServer": true [23:24:14.739] "remote.SSH.path": undefined [23:24:14.739] "remote.SSH.configFile": undefined [23:24:14.739] "remote.SSH.useFlock": true [23:24:14.739] "remote.SSH.lockfilesInTmp": false [23:24:14.739] "remote.SSH.localServerDownload": auto [23:24:14.739] "remote.SSH.remoteServerListenOnSocket": false [23:24:14.739] "remote.SSH.showLoginTerminal": false [23:24:14.739] "remote.SSH.defaultExtensions": [] [23:24:14.739] "remote.SSH.loglevel": 2 [23:24:14.739] "remote.SSH.enableDynamicForwarding": true [23:24:14.739] "remote.SSH.enableRemoteCommand": false [23:24:14.739] "remote.SSH.serverPickPortsFromRange": {} [23:24:14.739] "remote.SSH.serverInstallPath": {} [23:24:14.739] "remote.SSH.permitPtyAllocation": false [23:24:14.739] "remote.SSH.preferredLocalPortRange: undefined [23:24:14.739] "remote.SSH.useCurlAndWgetConfigurationFiles: false [23:24:14.748] SSH Resolver called for host: devbox [23:24:14.748] Setting up SSH remote "devbox" [23:24:14.750] Acquiring local install lock: /var/folders/lp/1qf36nz164n99mlvys3rv04m0000gn/T/vscode-remote-ssh-c4ea1055-install.lock [23:24:14.751] Looking for existing server data file at /Users/romandodin/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-c4ea1055-f1e16e1e6214d7c44d078b1f0607b2388f29d729-0.113.2024072315-es/data.json [23:24:14.751] Using commit id "f1e16e1e6214d7c44d078b1f0607b2388f29d729" and quality "stable" for server [23:24:14.753] Install and start server if needed [23:24:14.757] PATH: /Users/romandodin/.rd/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/usr/local/go/bin:/Users/romandodin/.orbstack/bin:/usr/local/bin [23:24:14.757] Checking ssh with "ssh -V" [23:24:14.763] > OpenSSH_9.6p1, LibreSSL 3.3.6 I will let this session to go stale and check the log upon reconnect ADD2: I reconnected after the session got stale and this time around it seems all correct. [11:10:56.151] Log Level: 2 [11:10:56.159] VS Code version: 1.91.1 [11:10:56.159] Remote-SSH version: [email protected] [11:10:56.159] darwin arm64 [11:10:56.160] SSH Resolver called for "ssh-remote+devbox", attempt 1 [11:10:56.161] "remote.SSH.useLocalServer": true [11:10:56.161] "remote.SSH.useExecServer": true [11:10:56.161] "remote.SSH.path": undefined [11:10:56.161] "remote.SSH.configFile": undefined [11:10:56.161] "remote.SSH.useFlock": true [11:10:56.161] "remote.SSH.lockfilesInTmp": false [11:10:56.161] "remote.SSH.localServerDownload": auto [11:10:56.161] "remote.SSH.remoteServerListenOnSocket": false [11:10:56.161] "remote.SSH.showLoginTerminal": false [11:10:56.161] "remote.SSH.defaultExtensions": [] [11:10:56.161] "remote.SSH.loglevel": 2 [11:10:56.161] "remote.SSH.enableDynamicForwarding": true [11:10:56.161] "remote.SSH.enableRemoteCommand": false [11:10:56.161] "remote.SSH.serverPickPortsFromRange": {} [11:10:56.161] "remote.SSH.serverInstallPath": {} [11:10:56.161] "remote.SSH.permitPtyAllocation": false [11:10:56.161] "remote.SSH.preferredLocalPortRange: undefined [11:10:56.161] "remote.SSH.useCurlAndWgetConfigurationFiles: false [11:10:56.180] SSH Resolver called for host: devbox [11:10:56.180] Setting up SSH remote "devbox" [11:10:56.182] Acquiring local install lock: /var/folders/lp/1qf36nz164n99mlvys3rv04m0000gn/T/vscode-remote-ssh-c4ea1055-install.lock [11:10:56.182] Looking for existing server data file at /Users/romandodin/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-c4ea1055-f1e16e1e6214d7c44d078b1f0607b2388f29d729-0.113.2024072315-es/data.json [11:10:56.182] Using commit id "f1e16e1e6214d7c44d078b1f0607b2388f29d729" and quality "stable" for server [11:10:56.184] Install and start server if needed [11:10:56.188] PATH: /Users/romandodin/.rd/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/usr/local/go/bin:/Users/romandodin/.orbstack/bin:/usr/local/bin [11:10:56.188] Checking ssh with "ssh -V" [11:10:56.209] > OpenSSH_9.6p1, LibreSSL 3.3.6 I will keep looking at it through the day. |
Thanks, so it sounds like (in "ADD2") things work for you once |
@connor4312 yes, I've been monitoring it today and it worked without hiccups. Once I got these Thank you and the team for the fixes! |
Great, thanks for confirming! |
marking as verified bc of the comment from @hellt |
Installing v0.113.2024072315 in the stable VS Code also fixed this issue for me. |
Seems to work for me too with Thanks for fixing this! 🙌 |
Is there an existing issue for this bug?
Required Troubleshooting Steps
remote.SSH.useLocalServer
settingConnect Locally
It connects successfully
->
Over time (I presume when the system goes to sleep and ssh connection to the remote gets disconnected), the ssh agent socket file -
$SSH_AUTH_SOCK
- starts to point to a non-existing file.Example:
This, in its turn, makes the SSH agent unavailable in the remote system and the only workaround is to "kill the remote server" which is very annoying.
Expected Behavior
SSH_AUTH_SOCK
refreshes when the remote is reconnected.Steps To Reproduce
file $SSH_AUTH_SOCK
resolves to an existing fileRemote-SSH Log
Remote-SSH Log
Anything else?
Related issue - #9767 - was closed because of the workaround, but doesn't actually provided a long term fix.
This issue is meant to track the cause of the issue.
/cc @danielhass
The text was updated successfully, but these errors were encountered: