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
Related
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 [...]
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.
I have this error when I try to configure a slave node in Jenkins with SSH agent. How can I resolve this?
[11/07/17 13:13:05] [SSH] Checking java version of java
[11/07/17 13:13:05] [SSH] java -version returned 1.8.0_151.
[11/07/17 13:13:05] [SSH] Starting sftp client.
[11/07/17 13:13:05] [SSH] Remote file system root /home/Jenkins does not exist. Will try to create it...
java.io.IOException: Could not copy slave.jar into '/home/Jenkins' on slave
at hudson.plugins.sshslaves.SSHLauncher.copySlaveJar(SSHLauncher.java:1152)
at hudson.plugins.sshslaves.SSHLauncher.access$400(SSHLauncher.java:145)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:816)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:793)
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.io.IOException: Failed to mkdir /home/Jenkins
at hudson.plugins.sshslaves.SFTPClient.mkdirs(SFTPClient.java:83)
at hudson.plugins.sshslaves.SSHLauncher.copySlaveJar(SSHLauncher.java:1120)
... 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 hudson.plugins.sshslaves.SFTPClient.mkdirs(SFTPClient.java:81)
... 8 more
[11/07/17 13:13:05] Launch failed - cleaning up connection
[11/07/17 13:13:05] [SSH] Connection closed.
It looks like you haven't set up the home directory for the user that you logged in as over ssh, and the /home directory is locked down so that user cannot create it (as it should be). You probably just need to create /home/jenkins on the slave machine with the appropriate permissions for the user running slave.jar.
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)
An error occurs when I try to set up a Jenkins node. I am using Jenkins ver. 2.46. I am using ssh keys to authenticate the node.
Both master and node are Ubuntu 16.10, running 4.8.0-37-generic kernel and openjdk version "1.8.0_121"
err I get:
[02/18/17 13:09:57] [SSH] Opening SSH connection to 10.171.0.1:22.
[02/18/17 13:09:59] [SSH] Authentication successful.
[02/18/17 13:09:59] [SSH] The remote users environment is:
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]="3" [2]="46" [3]="1" [4]="release" [5]="x86_64-pc-linux-gnu")
BASH_VERSION='4.3.46(1)-release'
DIRSTACK=()
EUID=1004
GROUPS=()
HOME=/var/jenkins
HOSTNAME=wanda
HOSTTYPE=x86_64
IFS=$' \t\n'
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LOGNAME=jenkins
MACHTYPE=x86_64-pc-linux-gnu
MAIL=/var/mail/jenkins
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
PIPESTATUS=([0]="0")
PPID=22036
PS4='+ '
PWD=/var/jenkins
SHELL=/bin/bash
SHELLOPTS=braceexpand:hashall:interactive-comments
SHLVL=1
SSH_CLIENT='10.144.72.139 33520 22'
SSH_CONNECTION='10.144.72.139 33520 10.171.0.1 22'
TERM=dumb
UID=1004
USER=jenkins
XDG_RUNTIME_DIR=/run/user/1004
XDG_SESSION_ID=116
_=']'
[02/18/17 13:09:59] [SSH] Checking java version of java
[02/18/17 13:10:00] [SSH] java -version returned 1.8.0_121.
[02/18/17 13:10:00] [SSH] Starting sftp client.
[02/18/17 13:10:01] [SSH] Copying latest slave.jar...
[02/18/17 13:10:05] [SSH] Copied 717,563 bytes.
Expanded the channel window size to 4MB
[02/18/17 13:10:05] [SSH] Starting slave process: cd "/var/jenkins" && java -jar slave.jar
<===[JENKINS REMOTING CAPACITY]===>channel started
Slave.jar version: 3.4.1
ERROR: Unexpected error in launching an agent. This is probably a bug in Jenkins
java.util.concurrent.CancellationException
at java.util.concurrent.FutureTask.report(FutureTask.java:121)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:767)
at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:262)
at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
hudson.util.IOException2: Slave start aborted.
at hudson.plugins.sshslaves.SSHLauncher.startSlave(SSHLauncher.java:992)
at hudson.plugins.sshslaves.SSHLauncher.access$400(SSHLauncher.java:139)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:738)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:719)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.InterruptedException
at java.lang.Object.wait(Native Method)
at hudson.remoting.Request.call(Request.java:147)
at hudson.remoting.Channel.call(Channel.java:821)
at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:520)
at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:390)
at hudson.plugins.sshslaves.SSHLauncher.startSlave(SSHLauncher.java:989)
... 7 more
ERROR: Connection terminated
java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2624)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:3099)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:853)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:349)
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)
Slave JVM has not reported exit code. Is it still running?
[02/18/17 13:10:08] [SSH] Connection closed.
I've entered too small value in advanced settings:
Connection Timeout in Seconds