I am trying to launch Jenkins slave via Jenkins and getting this error , I opened all the required ports, also installed Jenkins in Slave machine - jenkins

SSHLauncher{host='172.31.45.245', port=22, credentialsId='1', jvmOptions='', javaPath='', prefixStartSlaveCmd='', suffixStartSlaveCmd='', launchTimeoutSeconds=60, maxNumRetries=10, retryWaitTime=15, sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.NonVerifyingKeyVerificationStrategy, tcpNoDelay=true, trackCredentials=true}
[03/24/21 16:14:07] [SSH] Opening SSH connection to 172.31.45.245:22.
[03/24/21 16:14:07] [SSH] WARNING: SSH Host Keys are not being verified. Man-in-the-middle attacks may be possible against this connection.
ERROR: Server rejected the 1 private key(s) for ubuntu (credentialId:1/method:publickey)
[03/24/21 16:14:07] [SSH] Authentication failed.
Authentication failed.
[03/24/21 16:14:07] Launch failed - cleaning up connection
[03/24/21 16:14:07] [SSH] Connection closed

Try by changing the below settings in each of the slave machine.
Host Key Verification Strategy - Non Verifying Verification Strategy
Jenkins-43062
CloudBees Snippet

Related

DockerComputerSSHConnector$DockerSSHLauncher is missing its descriptor

I am running a Jenkins Master and Jenkins agent on a different machine. I m using the docker api plugin to create the agent in a docker container. It seems the SSH keypair seems find as Jenkins Master is able to SSH into my agent
SSHLauncher{host='XXXXX', port=49874, credentialsId='InstanceIdentity', jvmOptions='', javaPath='', prefixStartSlaveCmd='', suffixStartSlaveCmd='', launchTimeoutSeconds=60, maxNumRetries=10, retryWaitTime=15, sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.NonVerifyingKeyVerificationStrategy, tcpNoDelay=true, trackCredentials=true}
[07/30/22 00:21:46] [SSH] Opening SSH connection to XXXXX:49874.
[07/30/22 00:21:46] [SSH] WARNING: SSH Host Keys are not being verified. Man-in-the-middle attacks may be possible against this connection.
[07/30/22 00:21:46] [SSH] Authentication successful.
[07/30/22 00:21:46] [SSH] The remote user's environment is:
BASH=/usr/bin/bash
BASHOPTS=cmdhist:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
BASH_ALIASES=()
BASH_ARGC=()
In the end it gave me an error as below:
USER=jenkins
_=/etc/bashrc
ERROR: class io.jenkins.docker.connector.DockerComputerSSHConnector$DockerSSHLauncher is missing its descriptor
java.lang.AssertionError: class io.jenkins.docker.connector.DockerComputerSSHConnector$DockerSSHLauncher is missing its descriptor
at jenkins.model.Jenkins.getDescriptorOrDie(Jenkins.java:1631)
at hudson.model.AbstractDescribableImpl.getDescriptor(AbstractDescribableImpl.java:43)
at hudson.plugins.sshslaves.SSHLauncher.checkJavaIsInPath(SSHLauncher.java:524)
at hudson.plugins.sshslaves.SSHLauncher.lambda$launch$0(SSHLauncher.java:449)
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)
[07/30/22 00:21:46] Launch failed - cleaning up connection
[07/30/22 00:21:46] [SSH] Connection closed.

Unable to connect to Jenkins Agent after upgrade

Upgraded Jenkins from 2.257 to 2.339. After the upgrade none of the nodes are able to connect to the master. Jenkins is hosted on Amazon Linux. This is error I am getting when I try to connect a node to the controller:
Logs from Windows Agent :
SSHLauncher{host='172.*.*.*', port=22, credentialsId='3f7dbc2d-7850-4506-a356-24328ded5b43', jvmOptions='', javaPath='', prefixStartSlaveCmd='', suffixStartSlaveCmd='', launchTimeoutSeconds=210, maxNumRetries=10, retryWaitTime=15, sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.ManuallyTrustedKeyVerificationStrategy, tcpNoDelay=true, trackCredentials=true}
[03/20/22 14:38:59] [SSH] Opening SSH connection to 172.*.*.*.
[03/20/22 14:38:59] [SSH] SSH host key matches key seen previously for this host. Connection will be allowed.
[03/20/22 14:38:59] [SSH] Authentication successful.
[03/20/22 14:38:59] [SSH] The remote user's environment is:
ALLUSERSPROFILE='C:\<some folder>'
ANDROID_HOME='C:\<some path>'
ANDROID_NDK_HOME='C:\<some path>'
APPDATA='C:\Users\<jenkis user>\AppData\Roaming'
BASH=/bin/bash
BASHOPTS=cmdhist:complete_fullquote:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
BASH_ALIASES=()
BASH_ARGC=()
BASH_ARGV=()
BASH_CMDS=()
BASH_EXECUTION_STRING=set
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="4" [1]="4" [2]="12" [3]="3" [4]="release" [5]="x86_64-unknown-cygwin")
BASH_VERSION='4.4.12(3)-release'
COMPUTERNAME=EC2AMAZ-ML17J1C
COMSPEC='C:\Windows\system32\cmd.exe'
CYGWIN=sshd
CYG_SYS_BASHRC=1
CommonProgramFiles='C:\Program Files\Common Files'
CommonProgramW6432='C:\Program Files\Common Files'
DIRSTACK=()
EUID=197608
GROUPS=()
GTK_BASEPATH='C:\Program Files (x86)\GtkSharp\2.12\'
HOME=/home/<some path>
HOMEDRIVE=C:
HOMEPATH='\cygwin64\home\<some path>'
HOSTNAME=someserver
HOSTTYPE=x86_64
IFS=$' \t\n'
JAVA_HOME='C:\Program Files\Java\jdk1.8.0_144'
LOCALAPPDATA='C:\Users\<somem user>\AppData\Local'
LOGNAME=<login user>
LOGONSERVER='\\someserver
M2_HOME='C:\apache-maven-3.3.9'
MACHTYPE=x86_64-unknown-cygwin
MAIL=/var/spool/mail//Jenkins
MAVEN_HOME='C:\apache-maven-3.3.9'
NUMBER_OF_PROCESSORS=4
OPTERR=1
OPTIND=1
OS=Windows_NT
OSTYPE=cygwin
PATH=''
PATHEXT='.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC'
PIPESTATUS=([0]="0")
PPID=5896
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER='Intel64 Family 6 Model 85 Stepping 7, GenuineIntel'
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=5507
PROGRAMFILES='C:\Program Files'
PS4='+ '
PSModulePath='%ProgramFiles%\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files (x86)\AWS Tools\PowerShell\'
PUBLIC='C:\Users\Public'
PWD=/home/<somepath>
ProgramData='C:\ProgramData'
ProgramW6432='C:\Program Files'
SHELL=/bin/bash
SHELLOPTS=braceexpand:hashall:interactive-comments
SHLVL=1
SSH_AUTH_SOCK=/tmp/ssh-xQ6x4PUqHRF7/agent.34688
SSH_CLIENT='172.*.*.* 52306 22'
SSH_CONNECTION='172.*.*.* 52306 172.*.*.* 22'
SYSTEMDRIVE=C:
SYSTEMROOT='C:\Windows'
TERM=dumb
UID=197608
USER=<some user>
USERDOMAIN=someserver
USERNAME=<some user>
USERPROFILE='C:\Users\<some user>'
VS140COMNTOOLS='C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\'
WINDIR='C:\Windows'
_=
[03/20/22 14:38:59] [SSH] Checking java version of c:\<some path>/jdk/bin/java
Couldn't figure out the Java version of c:\<some path>/jdk/bin/java
bash: c:<some path>/jdk/bin/java: No such file or directory
[03/20/22 14:38:59] [SSH] Checking java version of java
[03/20/22 14:38:59] [SSH] java -version returned 1.8.0_191.
[03/20/22 14:38:59] [SSH] Starting sftp client.
[03/20/22 14:39:00] [SSH] Copying latest remoting.jar...
java.io.IOException: Could not copy remoting.jar into 'c:\<some path>' on agent
at hudson.plugins.sshslaves.SSHLauncher.copyAgentJar(SSHLauncher.java:702)
at hudson.plugins.sshslaves.SSHLauncher.access$300(SSHLauncher.java:113)
at hudson.plugins.sshslaves.SSHLauncher$1.call(SSHLauncher.java:445)
at hudson.plugins.sshslaves.SSHLauncher$1.call(SSHLauncher.java:412)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: invalid len argument
at com.trilead.ssh2.SFTPv3Client.read(SFTPv3Client.java:1232)
at com.trilead.ssh2.jenkins.SFTPClient$SFTPInputStream.read(SFTPClient.java:172)
at com.google.common.io.ByteStreams.toByteArrayInternal(ByteStreams.java:191)
at com.google.common.io.ByteStreams.toByteArray(ByteStreams.java:238)
at hudson.plugins.sshslaves.SSHLauncher.readInputStreamIntoByteArrayAndClose(SSHLauncher.java:760)
at hudson.plugins.sshslaves.SSHLauncher.copyAgentJar(SSHLauncher.java:671)
... 7 more
[03/20/22 14:39:00] Launch failed - cleaning up connection
[03/20/22 14:39:00] [SSH] Connection closed.
REST API
Jenkins 2.339
I have 3 different nodes (Windows, Ubuntu and mac). I get the same error on all three:
Caused by: java.lang.IllegalArgumentException: invalid len argument
Appreciate any info to resolve this.
Thanks
There is an open issue about your problem: https://issues.jenkins.io/browse/JENKINS-67258.
According to one of the participant of this issue, a solution is to:
[...] upgrading SSH Build Agents / SSH Slaves Plugin to version 1.32.0 and beyond [...]

Jenkins Slave not responding to create work space

My Jenkins is not able to create work space due to a permission issue. I don't how to resolve this issue.
[12/30/19 17:21:18] [SSH] Checking java version of java
[12/30/19 17:21:18] [SSH] java -version returned 11.0.5.
[12/30/19 17:21:18] [SSH] Starting sftp client.
[12/30/19 17:21:18] [SSH] Remote file system root /home/jenkins/agent/workspace does not exist. Will try to create it...
java.io.IOException: Could not copy remoting.jar into '/home/jenkins/agent/workspace' on agent
at hudson.plugins.sshslaves.SSHLauncher.copyAgentJar(SSHLauncher.java:702)
at hudson.plugins.sshslaves.SSHLauncher.access$300(SSHLauncher.java:113)
at hudson.plugins.sshslaves.SSHLauncher$1.call(SSHLauncher.java:445)
at hudson.plugins.sshslaves.SSHLauncher$1.call(SSHLauncher.java:412)
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:834)
Caused by: java.io.IOException: Failed to mkdir /home/jenkins/agent
at com.trilead.ssh2.jenkins.SFTPClient.mkdirs(SFTPClient.java:91)
at com.trilead.ssh2.jenkins.SFTPClient.mkdirs(SFTPClient.java:86)
at hudson.plugins.sshslaves.SSHLauncher.copyAgentJar(SSHLauncher.java:659)
... 7 more
Caused by: com.trilead.ssh2.SFTPException: Permission denied (SSH_FX_PERMISSION_DENIED: The user does not have sufficient permissions to perform the operation.)
at com.trilead.ssh2.SFTPv3Client.expectStatusOKMessage(SFTPv3Client.java:555)
at com.trilead.ssh2.SFTPv3Client.mkdir(SFTPv3Client.java:955)
at com.trilead.ssh2.jenkins.SFTPClient.mkdirs(SFTPClient.java:89)
[12/30/19 17:21:18] Launch failed - cleaning up connection
[12/30/19 17:21:18] [SSH] Connection closed.

Jenkins master fails to init a session to Windows 10 with OpenSSH

I have Windows 10 with installed latest beta of OpenSSH for windows. I am trying to use it as a slave for my Jenkins. This is the content of the log on the master:
[05/14/18 22:46:45] [SSH] Opening SSH connection to 10.10.10.10:22.
[05/14/18 22:46:45] [SSH] WARNING: SSH Host Keys are not being verified. Man-in-the-middle attacks may be possible against this connection.
[05/14/18 22:46:45] [SSH] Authentication successful.
[05/14/18 22:46:45] [SSH] The remote user's environment is:
....
[05/14/18 22:46:45] [SSH] Checking java version of java
[05/14/18 22:46:45] [SSH] java -version returned 1.8.0_151.
[05/14/18 22:46:45] [SSH] Starting sftp client.
[05/14/18 22:46:45] [SSH] Copying latest slave.jar...
[05/14/18 22:46:45] [SSH] Copied 762,466 bytes.
Expanded the channel window size to 4MB
[05/14/18 22:46:45] [SSH] Starting slave process: cd "C:\jenkins" && java -jar slave.jar -jar-cache "C:\jenkins\remoting\jarCache"
<===[JENKINS REMOTING CAPACITY]===><===[JENKINS REMOTING CAPACITY]===>ERROR: Unexpected error in launching a slave. This is probably a bug in Jenkins.
hudson.remoting.RequestAbortedException
Exception in thread "main" java.io.EOFException: unexpected stream termination
ERROR: Connection terminated
at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:408) at hudson.remoting.Request.call(Request.java:176)
java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2671)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:3146)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:858)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:354)
at hudson.remoting.ObjectInputStreamEx.<init>(ObjectInputStreamEx.java:48)
at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:35)
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:63)
Caused: java.io.IOException: Unexpected termination of the channel
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:77)
at hudson.remoting.Channel.call(Channel.java:951)
at hudson.remoting.ChannelBuilder.build(ChannelBuilder.java:353) at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:549)
at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:416)
at hudson.plugins.sshslaves.SSHLauncher.startSlave(SSHLauncher.java:1110)
at hudson.plugins.sshslaves.SSHLauncher.access$500(SSHLauncher.java:148)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:845)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:820)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at hudson.remoting.Launcher.main(Launcher.java:743)
at hudson.remoting.Launcher.runWithStdinStdout(Launcher.java:691)
at hudson.remoting.Launcher.run(Launcher.java:373)[05/14/18 22:46:47] Launch failed - cleaning up connection
at hudson.remoting.Launcher.main(Launcher.java:283)
[05/14/18 22:46:47] [SSH] Connection closed.
So, ssh auth is successful, but for some reason starting the client jar fails. I am not sure what exactly I should check. Have anyone else had a struggle with Win 10 and OpenSSH?
Please see the comments in JENKINS-42856 and follow the instructions to configure OpenSSH
Test that you can run commands without tty by executing a command like this one
ssh USERNAME#AGENT_HOST /bin/bash -c ls

Unable to start jenkins slave

When i try to start my jenkins slave, the slave exists with error:
[04/14/17 17:22:06] [SSH] Checking java version of java
[04/14/17 17:22:06] [SSH] java -version returned 1.7.0_121.
[04/14/17 17:22:06] [SSH] Starting sftp client.
[04/14/17 17:22:06] [SSH] Copying latest slave.jar...
[04/14/17 17:22:06] [SSH] Copied 719,269 bytes.
Expanded the channel window size to 4MB
[04/14/17 17:22:06] [SSH] Starting slave process: cd "/home/jenkins" && java -jar slave.jar -text
<===[JENKINS REMOTING CAPACITY]===><===[HUDSON TRANSMISSION BEGINS]===channel started
Slave JVM has not reported exit code. Is it still running?
[04/14/17 17:22:11] Launch failed - cleaning up connection
ERROR: Connection terminated
java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2625)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:3100)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:854)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:350)
at hudson.remoting.ObjectInputStreamEx.<init>(ObjectInputStreamEx.java:48)
at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:34)
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:59)
Caused: java.io.IOException: Unexpected termination of the channel
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:73)
[04/14/17 17:22:11] [SSH] Connection closed.
Is there anyway to fix this? I've googled, and googled, and googled, but can't find anything to solve this problem.
I haven't faced the same issue, but I guess it may be linked to this:
https://issues.jenkins-ci.org/browse/JENKINS-27624
(It is in case your Jenkins version is 2.54 - minimum java version should be 8)

Resources