Reputation: 724
I encontered this problem when was trying to connect jenkins agent trough the ssh. I've passed all the steps as described here: https://acloudguru.com/blog/engineering/adding-a-jenkins-agent-node, except one - instead yum install java-1.8.0-openjdk
I've used apt install default-jre
, which in the end has gave me openjdk 11.0.13 2021-10-19
. After the all trying launch the agent I am getting error:
java.io.IOException: Malformed SSH byte string.
at com.trilead.ssh2.packets.TypesReader.readByteString(TypesReader.java:132)
at com.trilead.ssh2.packets.TypesReader.readMPINT(TypesReader.java:117)
at com.trilead.ssh2.signature.RSAKeyAlgorithm.decodePublicKey(RSAKeyAlgorithm.java:113)
at com.trilead.ssh2.signature.RSAKeyAlgorithm.decodePublicKey(RSAKeyAlgorithm.java:28)
at com.trilead.ssh2.KnownHosts.addHostkey(KnownHosts.java:108)
at com.trilead.ssh2.KnownHosts.initialize(KnownHosts.java:410)
at com.trilead.ssh2.KnownHosts.initialize(KnownHosts.java:438)
at com.trilead.ssh2.KnownHosts.<init>(KnownHosts.java:87)
at hudson.plugins.sshslaves.verifiers.KnownHostsFileKeyVerificationStrategy.getPreferredKeyAlgorithms(KnownHostsFileKeyVerificationStrategy.java:108)
at hudson.plugins.sshslaves.SSHLauncher$1.call(SSHLauncher.java:425)
at hudson.plugins.sshslaves.SSHLauncher$1.call(SSHLauncher.java:421)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
[01/04/22 15:30:12] Launch failed - cleaning up connection
[01/04/22 15:30:12] [SSH] Connection closed.
Please, help me to understand, what happens and how can it be resolved. I am newbuy with jenkins and not familiar with java. Googling of this problem did not supply some sensible result to me. Thank you.
Upvotes: 0
Views: 553
Reputation: 56
This is most likely due to incorrect content of the KnownHosts file. Therefore, make sure that the KnownHosts file is correct with the content of id_rsa.pub(public file), if it is incorrect, you will need to add it after Host name or IP address. Such as;
HOSTNAME ssh-rsa AAAAB3NzaC1yc...
Upvotes: 2