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 set hostkey preference" error on Debian 11 #6612

Open
coldsource opened this issue Jul 28, 2023 · 7 comments
Open

"failed to set hostkey preference" error on Debian 11 #6612

coldsource opened this issue Jul 28, 2023 · 7 comments

Comments

@coldsource
Copy link

Hi,

I'm using libgit2 in a C++ project and since several weeks (I guess after a library upgrade) I get this error while calling git_remote_fetch() :
"failed to set hostkey preference: The requested method(s) are not currently supported"

Project has not changed at all on our side, so I suppose it's an update from libgit2. Might be related to issue 6496 ?

Do you have any solution ? Should I change something on my side or just wait for an upgrade ?

Regards,

@ethomson
Copy link
Member

🤔 Not sure yet what the trouble is. What version of libssh2 are you using?

@coldsource
Copy link
Author

root@srvdev:~# dpkg -l | grep libgit
ii  libgit2-1.1:amd64                     1.1.0+dfsg.1-4+deb11u1                                        amd64        low-level Git library
ii  libgit2-dev:amd64                     1.1.0+dfsg.1-4+deb11u1                                        amd64        low-level Git library (development files)

@ethomson
Copy link
Member

Sorry - to be clear, I'm looking for the version of libssh2 (not libgit2 - fun subtle naming issue there).

@coldsource
Copy link
Author

Sorry I misunderstood, here it is :
ii libssh2-1:amd64 1.9.0-2 amd64 SSH2 client-side library
ii libssh2-1-dev:amd64 1.9.0-2 amd64 SSH2 client-side library (development headers)

@ethomson
Copy link
Member

ethomson commented Aug 2, 2023

I can reproduce this on Debian 11. If I have only ecdsa-sha2-nistp256 entries in my known hosts file (and thus, that's the only method being passed to libssh2_session_method_pref), it fails in this manner.

libssh2_session_method_pref is documented to ignore unknown method, but if there's only one method that's unknown (or presumably if all methods are unknown), it does appear to return METHOD_NOT_SUPPORTED. 🤔

I wonder if we should ignore such errors and let negotiation continue. This is - after all - just setting the preference correct?

/cc @carlosmn

@Qix-
Copy link
Contributor

Qix- commented Dec 1, 2023

Getting this on Windows, not sure what the fix is. I'm able to clone and push just fine from cmd.exe, but running my application that works fine under WSL (EDIT: and macos) doesn't otherwise work on the windows end.

failed to set hostkey preference: The requested method(s) are not currently supported; class=Ssh (23)

Not sure how to work around this, unfortunately.

@HaraldValantic
Copy link

Getting this error also on Windows 10 and Ubuntu 22.04.
Ignoring METHOD_NOT_SUPPORTED errors seems to work fine as work around for me.

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

No branches or pull requests

4 participants