Skip to content
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]: error connecting with ssh-agent: dial unix: missing address #8043

Closed
3 tasks done
viperML opened this issue Feb 14, 2023 · 6 comments
Closed
3 tasks done
Assignees
Labels
info-needed Issue requires more information from poster ssh Issue in vscode-remote SSH

Comments

@viperML
Copy link

viperML commented Feb 14, 2023

Is there an existing issue for this bug?

  • I have searched the existing issues

Required Troubleshooting Steps

  • I have followed these troubleshooting steps
  • I have tried both values of the remote.SSH.useLocalServer setting

Connect Locally

It connects successfully

->

No response

Expected Behavior

I use the agent to connect to my host. So when using ssh on a terminal, everything works perfectly.

When trying to use the extension, I see this in the logs:

[14:34:51.832] Received install output: local-server-1> Running ssh connection command: "-v -T -D 42285 -o ConnectTimeout=15 chandra bash"
local-server-1> Spawned ssh, pid=19843
OpenSSH_9.1p1, OpenSSL 3.0.7 1 Nov 2022
error connecting with ssh-agent: dial unix: missing address
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535
local-server-1> ssh child died, shutting down

This error log is the same as if I remove SSH_AUTH_SOCK from my shell's environment, and try to ssh:

$ ssh chandra -t ls /var/empty
Connection to chandra closed.

$ unset SSH_AUTH_SOCK

$ ssh chandra -t ls /var/empty
error connecting with ssh-agent: dial unix: missing address
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535

I would say that for some reason this env var (SSH_AUTH_SOCK=/run/user/1000/ssh-agent) is not exported for the extension, but I don't want to jump into conclusions.

It is also important to note that in NixOS we do some wrapping around VSCode which may interfere with its functionality, so please give me any more instructions to debug this.

Steps To Reproduce

No response

Remote-SSH Log

Remote-SSH Log

[15:20:37.748] Log Level: 2
[15:20:37.749] SSH Resolver called for "ssh-remote+chandra", attempt 1
[15:20:37.749] "remote.SSH.useLocalServer": false
[15:20:37.750] "remote.SSH.showLoginTerminal": true
[15:20:37.750] "remote.SSH.remotePlatform": {"gen6":"linux","gen6.ayatsfer.gmail.com.beta.tailscale.net":"linux","chandra":"linux"}
[15:20:37.750] "remote.SSH.path": undefined
[15:20:37.751] "remote.SSH.configFile": undefined
[15:20:37.751] "remote.SSH.useFlock": true
[15:20:37.751] "remote.SSH.lockfilesInTmp": false
[15:20:37.751] "remote.SSH.localServerDownload": off
[15:20:37.752] "remote.SSH.remoteServerListenOnSocket": false
[15:20:37.752] "remote.SSH.showLoginTerminal": true
[15:20:37.752] "remote.SSH.defaultExtensions": []
[15:20:37.752] "remote.SSH.loglevel": 2
[15:20:37.754] "remote.SSH.enableDynamicForwarding": true
[15:20:37.754] "remote.SSH.enableRemoteCommand": false
[15:20:37.754] "remote.SSH.serverPickPortsFromRange": {}
[15:20:37.756] "remote.SSH.serverInstallPath": {"gen6":"/home/ayats/.local/share/code-server","gen6.ayatsfer.gmail.com.beta.tailscale.net":"/home/ayats/.local/share/code-server"}
[15:20:37.759] VS Code version: 1.74.3
[15:20:37.759] Remote-SSH version: [email protected]
[15:20:37.759] linux x64
[15:20:37.760] SSH Resolver called for host: chandra
[15:20:37.760] Setting up SSH remote "chandra"
[15:20:37.762] Using commit id "97dec172d3256f8ca4bfb2143f3f76b503ca0534" and quality "stable" for server
[15:20:37.765] Install and start server if needed
[15:20:37.766] PATH: /nix/store/2nik04ccmv6cfvsl28mfk32mnv797vr2-glib-2.74.3-bin/bin:/run/wrappers/bin:/home/ayats/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:/home/ayats/.nix-profile/bin:/etc/profiles/per-user/ayats/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin
[15:20:37.767] Checking ssh with "ssh -V"
[15:20:37.772] > OpenSSH_9.1p1, OpenSSL 3.0.7 1 Nov 2022

[15:20:37.773] Running script with connection command: ssh -T -D 37945 -o ConnectTimeout=15 chandra bash
[15:20:38.229] > error connecting with ssh-agent: dial unix: missing address
> kex_exchange_identification: Connection closed by remote host
> Connection closed by UNKNOWN port 65535
[15:20:38.229] Got some output, clearing connection timeout
[15:20:38.460] "install" terminal command done
[15:20:38.460] Install terminal quit with output: Connection closed by UNKNOWN port 65535
[15:20:38.460] Received install output: Connection closed by UNKNOWN port 65535
[15:20:38.461] Failed to parse remote port from server output
[15:20:38.462] Resolver error: Error: 
	at g.Create (/home/ayats/.local/share/code/extensions/ms-vscode-remote.remote-ssh-0.97.2023020215/out/extension.js:1:584147)
	at t.handleInstallOutput (/home/ayats/.local/share/code/extensions/ms-vscode-remote.remote-ssh-0.97.2023020215/out/extension.js:1:582761)
	at t.tryInstall (/home/ayats/.local/share/code/extensions/ms-vscode-remote.remote-ssh-0.97.2023020215/out/extension.js:1:680758)
	at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
	at async /home/ayats/.local/share/code/extensions/ms-vscode-remote.remote-ssh-0.97.2023020215/out/extension.js:1:643114
	at async t.withShowDetailsEvent (/home/ayats/.local/share/code/extensions/ms-vscode-remote.remote-ssh-0.97.2023020215/out/extension.js:1:646432)
	at async t.resolve (/home/ayats/.local/share/code/extensions/ms-vscode-remote.remote-ssh-0.97.2023020215/out/extension.js:1:644164)
	at async /home/ayats/.local/share/code/extensions/ms-vscode-remote.remote-ssh-0.97.2023020215/out/extension.js:1:721759
[15:20:38.463] ------

Anything else?

Everything works perfectly fine on my Windows machine

Versions:

VSCode 1.14.3
NixOS built from nixpkgs 9b97ad7b4330aacda9b2343396eb3df8a853b4fc
Tried with both versions v0.97.2023020215 and v0.96.0

@viperML viperML added the ssh Issue in vscode-remote SSH label Feb 14, 2023
@eleanorjboyd
Copy link
Member

Hi! Can you include the full remote ssh logs? Additionally, what do you mean by "SSH_AUTH_SOCK from my shell's environment" where are you setting this?

@eleanorjboyd eleanorjboyd added the info-needed Issue requires more information from poster label Feb 14, 2023
@viperML
Copy link
Author

viperML commented Feb 15, 2023

Can you include the full remote ssh logs?

There are no logs on the remote machine.

what do you mean by "SSH_AUTH_SOCK from my shell's environment" where are you setting this?

My Linux distribution automatically sets it at some point in the login process. It is present on my shell, but I am not sure if it is present during vscode's connection

@NobbZ
Copy link

NobbZ commented Feb 16, 2023

Are you starting VScode from the GUI or the terminal?

If started from the terminal in a shell session that has a proper SSH_AUTH_SOCK set, does it work there?

@viperML
Copy link
Author

viperML commented Feb 16, 2023

Are you starting VScode from the GUI or the terminal?

If started from the terminal in a shell session that has a proper SSH_AUTH_SOCK set, does it work there?

I hadn't tried this yet, but starting it from a terminal with proper SSH_AUTH_SOCK set does work fine.

So my guess is that SSH_AUTH_SOCK is set just for my shell, but not for any program launched from my graphical interface (gdm + sway + wofi), which could be misconfiguration of my Linux installation

@viperML
Copy link
Author

viperML commented Feb 16, 2023

Closing as this turned out to be an issue with my Linux distribution

@viperML viperML closed this as completed Feb 16, 2023
@NobbZ
Copy link

NobbZ commented Feb 17, 2023

I agree with the close, though want to add, that it is not necessarily the distribution itself.

Other distributions might have the same or similar problems. I think this is more of a thing of the full stack that is involved in initiating the user session and the expectations made by the components.

Here we were able to reproduce the issue only with certain display managers/greeters and only for wayland sessions.

At the end it boiled down to, some combinations did source/evaluate /etc/profile, others did not, and the variable in question was set by yet another file sourced through that.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster ssh Issue in vscode-remote SSH
Projects
None yet
Development

No branches or pull requests

3 participants