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

Failed to retrieve IDEs: nodename nor servname provided,or not known #534

Closed
rtorrente opened this issue Feb 13, 2025 · 8 comments · Fixed by #539
Closed

Failed to retrieve IDEs: nodename nor servname provided,or not known #534

rtorrente opened this issue Feb 13, 2025 · 8 comments · Fixed by #539
Assignees

Comments

@rtorrente
Copy link

Since coder 2.19.0, ssh config seems to not be created in .ssh/config, this lead to Failed to retrieve IDEs: nodename nor servname provided,or not known and it's now impossible to use coder.

If i run coder-ssh with cli, coder config is added in .ssh/config, jetbrains plugin doesn't add anything

Maybe it's due to this ? #531

Coder : v2.19.0
Coder Jetbrains Plugins : v2.18.0
MacOs

@finomen
Copy link

finomen commented Feb 16, 2025

Same issue on windows and linux
Coder v2.19.0+2f32b11
Coder Jetbrains Plugin v2.18.0

@Naroh091
Copy link

Same here, same versions
Coder v2.19.0+2f32b11
Coder Jetbrains Plugin 2.18.0

Meanwhile, downgrading the plugin to 2.17.0 fixes the issue: https://github.com/coder/jetbrains-coder/releases/tag/v2.17.0

@code-asher
Copy link
Member

code-asher commented Feb 18, 2025

Hmm yeah #521 does seem the most likely culprit.

Is this from the "connect" button on the front page of the plugin, or is it from the recent connections page by clicking the Coder entry on the sidebar?

If it is the recent connections page, my guess is we broke existing connections by replacing the old coder-jetbrains--workspace--agent--host entries with the new coder-jetbrains--host--* entry. We may need to map those to the new host format, probably in RecentWorkspaceConnection.toWorkspaceProjectIDE (we have done similar conversions there in the past from old to new formats to maintain backwards compat so I think it will be straightforward).

cc @bcpeinhardt

Thank you for the bug report!

@finomen
Copy link

finomen commented Feb 18, 2025

Is this from the "connect" button on the front page of the plugin, or is it from the recent connections page by clicking the Coder entry on the sidebar?

Tried:

  1. With link from coder page
  2. Create new connection from gateway with "Connect to Coder" button
  3. Use recent connection

In all cases plugin does not modify .ssh/config

v2.18.1 is the same
v2.17.0 works

Gateway v2024.3.3

@code-asher
Copy link
Member

code-asher commented Feb 18, 2025

Hmm interesting thank you for the update, that might be a different bug then what I was mentioning, or is in addition to that bug. Would you be able to gather the logs and post them or send them to me? Or, if you can scan them for any additional errors or anything that looks off, particularly from CoderCLIManager.

@finomen
Copy link

finomen commented Feb 18, 2025

Hmm interesting thank you for the update, that might be a different bug then what I was mentioning, or is in addition to that bug. Would you be able to gather the logs and post them or send them to me? Or, if you can scan them for any additional errors or anything that looks off, particularly from CoderCLIManager.

2025-02-16 10:37:08,177 [ 299602]   INFO - CoderWorkspaceProjectIDEStepView - Initializing workspace step for admin/Default.main
2025-02-16 10:37:08,180 [ 299605]   INFO - CoderWorkspaceProjectIDEStepView - Configuring Coder CLI...
2025-02-16 10:37:09,296 [ 300721]   INFO - CoderCLIManager - `C:\Users\finom\AppData\Local\coder-gateway\XXXXXX\coder-windows-amd64.exe version --output json`: {
  "version": "v2.19.0+2f32b11",
  "build_time": "2025-02-04T07:53:51Z",
  "external_url": "https://github.com/coder/coder/commit/2f32b11831a236ed550f35b2296b8f948eb64f4e",
  "slim": true,
  "agpl": false,
  "boring_crypto": false
}

2025-02-16 10:37:10,428 [ 301853]   INFO - CoderCLIManager - `C:\Users\finom\AppData\Local\coder-gateway\XXXXXX\coder-windows-amd64.exe version --output json`: {
  "version": "v2.19.0+2f32b11",
  "build_time": "2025-02-04T07:53:51Z",
  "external_url": "https://github.com/coder/coder/commit/2f32b11831a236ed550f35b2296b8f948eb64f4e",
  "slim": true,
  "agpl": false,
  "boring_crypto": false
}

2025-02-16 10:37:10,429 [ 301854]   INFO - CoderCLIManager - Configuring SSH config at C:\Users\finom\.ssh\config
2025-02-16 10:37:10,440 [ 301865]   INFO - CoderCLIManager - No workspaces and no existing config blocks to remove
2025-02-16 10:37:10,441 [ 301866]   INFO - CoderWorkspaceProjectIDEStepView - Connecting with SSH and uploading worker if missing... (attempt 1)
2025-02-16 10:37:10,442 [ 301867]   INFO - CoderSettings - Resolving binary for WINDOWS AMD64
2025-02-16 10:37:10,442 [ 301867]   INFO - CoderSettings - Resolving binary for WINDOWS AMD64
2025-02-16 10:37:11,589 [ 303014]   INFO - CoderCLIManager - `C:\Users\finom\AppData\Local\coder-gateway\XXXXXX\coder-windows-amd64.exe version --output json`: {
  "version": "v2.19.0+2f32b11",
  "build_time": "2025-02-04T07:53:51Z",
  "external_url": "https://github.com/coder/coder/commit/2f32b11831a236ed550f35b2296b8f948eb64f4e",
  "slim": true,
  "agpl": false,
  "boring_crypto": false
}

2025-02-16 10:37:11,858 [ 303283]   INFO - net.schmizz.sshj.transport.random.JCERandom - Creating new SecureRandom.
2025-02-16 10:37:12,297 [ 303722]   INFO - #c.i.s.NamedPipeAgentConnector - Failed to connect to the named pipe \\.\pipe\openssh-ssh-agent: java.io.FileNotFoundException: \\.\pipe\openssh-ssh-agent (The system cannot find the file specified)
2025-02-16 10:37:12,334 [ 303759]   WARN - com.hierynomus.sshj.userauth.keyprovider.OpenSSHKeyV1KeyFile - Error reading public key file: java.io.IOException: Public key decoding failed
2025-02-16 10:37:12,352 [ 303777]   WARN - #c.i.s.i.s.sshj - Failed to connect. Brief info: SSH connection to [email protected]:22
 * With altered connection settings:
  - authMethods: PublicKey(privateKeys=[C:\Users\finom\.ssh\id_rsa, C:\Users\finom\.ssh\id_ecdsa, C:\Users\finom\.ssh\id_ecdsa_sk, C:\Users\finom\.ssh\id_ed25519, C:\Users\finom\.ssh\id_ed25519_sk, C:\Users\finom\.ssh\id_xmss, C:\Users\finom\.ssh\id_dsa], agent=ALL), Password, KeyboardInteractive
  - ciphers: [[email protected], aes128-ctr, aes192-ctr, aes256-ctr, [email protected], [email protected]]
  - hostKeyAlgorithms: [[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], ssh-ed25519, ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521, [email protected], [email protected], rsa-sha2-512, rsa-sha2-256]
  - hostKeyVerifier: OpenSSH-like host key verifier (knownHostsFile=[C:\Users\finom\.ssh\known_hosts, C:\Users\finom\.ssh\known_hosts2, C:\Users\finom\__PROGRAMDATA__\ssh\ssh_known_hosts, C:\Users\finom\__PROGRAMDATA__\ssh\ssh_known_hosts2], strictHostKeyChecking=ASK, hashKnownHosts=false)
  - kexAlgorithms: [curve25519-sha256, [email protected], ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, diffie-hellman-group-exchange-sha256, diffie-hellman-group16-sha512, diffie-hellman-group18-sha512, diffie-hellman-group14-sha256]
  - macs: [[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], hmac-sha2-256, hmac-sha2-512]
  - user: coder
 * With auth agent pageant
java.net.UnknownHostException: No such host is known (coder-jetbrains-XXXXXXX-bg--admin--default.main)
	at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
	at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:52)
	at java.base/java.net.InetAddress$PlatformResolver.lookupByName(InetAddress.java:1211)
	at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1828)
	at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:1139)
	at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1818)
	at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1688)
	at com.intellij.ssh.impl.sshj.SshjConnectionUtilKt.connectPlatform(SshjConnectionUtil.kt:854)
	at com.intellij.ssh.impl.sshj.SshjConnectionUtilKt.setUpSessionForSshJ$lambda$13(SshjConnectionUtil.kt:222)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
	at com.intellij.util.concurrency.ChildContext$runInChildContext$1.invoke(propagation.kt:103)
	at com.intellij.util.concurrency.ChildContext$runInChildContext$1.invoke(propagation.kt:103)
	at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:109)
	at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:103)
	at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:735)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:732)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:732)
	at java.base/java.lang.Thread.run(Thread.java:1583)

This is from my attempts with v2.18.0. I could collect full logs tomorrow, is there any option to get more logs from plugin?

@code-asher
Copy link
Member

code-asher commented Feb 18, 2025

Gateway has a "collect logs" button that will gather up all the logs (the cog icon in the lower left). The plugin logs everything to the idea.log file I believe with is zipped up by that button or can be retrieved manually.

But I think we are good on logs, based on the above it seems that it does not write to the SSH file because it thinks there are no workspaces. Which does make sense, with wildcards we do not need to waste time fetching the workspaces and it seems we use an empty set: https://github.com/coder/jetbrains-coder/pull/521/files#diff-4853bc9588279b804a87818f27e8dec76045b44c0df6d10df0d5ab75515f4018R115

But, that means there is a bug when there is no existing config and the workspaces are empty, the plugin aborts early because it thinks there is nothing to do. This is valid for the non-wildcard case, but not the wildcard case, where workspaces are always empty. cc @bcpeinhardt

@g33z
Copy link

g33z commented Feb 19, 2025

Heeeeyyyy I want to add some info since it's the same here - with coder plugin version 2.18.1 in JetBrains Gateway, in Windows als well as new installations in Pop!_OS as well as Ubuntu.

In your .ssh/config the plugin created entries like so before:

Linux

# --- START CODER JETBRAINS coder.mydomain.com
Host coder-jetbrains--myworkspace.main--coder.mydomain.com
  ProxyCommand /home/linuxuser/.local/share/coder-gateway/coder.mydomain.com/coder-linux-amd64 --global-config /home/linuxuser/.local/share/coder-gateway/coder.mydomain.com/config --url https://coder.mydomain.com ssh --stdio --usage-app=jetbrains coderuser/myworkspace.main
  ConnectTimeout 0
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  LogLevel ERROR
  SetEnv CODER_SSH_SESSION_TYPE=JetBrains
Host coder-jetbrains--myworkspace.main--coder.mydomain.com--bg
  ProxyCommand /home/linuxuser/.local/share/coder-gateway/coder.mydomain.com/coder-linux-amd64 --global-config /home/linuxuser/.local/share/coder-gateway/coder.mydomain.com/config --url https://coder.mydomain.com ssh --stdio --usage-app=disable coderuser/myworkspace.main
  ConnectTimeout 0
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  LogLevel ERROR
  SetEnv CODER_SSH_SESSION_TYPE=JetBrains
# --- END CODER JETBRAINS coder.mydomain.com

which are being overwrittenremoved with the new version.

For me the error was, that the ssh host ("nodename or servername") could not be found:
No such host is known (coder-jetbrains-coder.mydomain.com-bg--coderuser--myworkspace.main)

But for a workaround this can be re-added, as an example, like so:

Linux

Host coder-jetbrains-coder.*
  ProxyCommand /home/linuxuser/.local/share/coder-gateway/coder.mydomain.com/coder-linux-amd64 --global-config /home/linuxuser/.local/share/coder-gateway/coder.mydomain.com/config --url https://coder.mydomain.com ssh --stdio --usage-app=jetbrains coderuser/myworkspace.main
  ConnectTimeout 0
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  LogLevel ERROR
  SetEnv CODER_SSH_SESSION_TYPE=JetBrains

Windows

Host coder-jetbrains-coder.*
  ProxyCommand C:\Users\WINDOWSUSER\AppData\Local\coder-gateway\coder.mydomain.com/coder-windows-amd64 --global-config C:\Users\WINDOWSUSER\AppData\Local\coder-gateway\coder.mydomain.com/config --url https://coder.mydomain.com ssh --stdio --usage-app=jetbrains coderuser/myworkspace.main
  ConnectTimeout 0
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  LogLevel ERROR
  SetEnv CODER_SSH_SESSION_TYPE=JetBrains

Note me leaving out any # --- START CODER JETBRAINS coder.mydomain.com and # --- END CODER JETBRAINS coder.mydomain.com tags, of course, so this would not be removed when re-opening Gateway and trying to connect.

Please keep in mind that the coder plugin will not be able to remove this entry for you in the future, once this has been fixed!
After updating to a version with a fix, you must remove the entry manually again!!

I am using this opportunity to a) contribute to this project as can be seen above as well as b) thank you, @code-asher and everyone alse in the process of creating this awesome thing right here!!1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants