Getting " Cannot run program "bash"" while building chef in jenkins - linux

I have installed chef-plugin in jenkins and did the following configurations:
Run chef client on remote host:
enabled: checked
ssh host: "remote host"
ssh login: root
chef_json template: "{
"run-list" :[
"recipe[test]"
]
}"
color output: checked
and got the following error:
Started by user swetha sreeramoju
Building in workspace C:\.jenkins\workspace\chef-sample
[2015-05-27 19:06:44 +0530] INFO: [34m[47mrendering ERB template[0m[0m
[2015-05-27 19:06:44 +0530] INFO: [34m[47mparsing JSON string[0m[0m
[2015-05-27 19:06:44 +0530] INFO: [34m[47msaving JSON to file[0m[0m
[2015-05-27 19:06:44 +0530] INFO: [2m[1m[34m[47m[4mchef json url[0m[0m[0m[0m[0m[34m[47m : http://localhost:8080/jenkins//job/chef-sample/ws/chef.json[0m[0m
[2015-05-27 19:06:44 +0530] INFO: [2m[1m[34m[47m[4mhost[0m[0m[0m[0m[0m[34m[47m : 10.0.12.209[0m[0m
$ bash -c "ssh root#10.0.12.209 sudo chef-client -l info -j http://localhost:8080/jenkins//job/chef-sample/ws/chef.json "
ERROR: Cannot run program "bash": CreateProcess error=2, The system cannot find the file specified (Java::JavaIo::IOException)
java.lang.ProcessBuilder.start(Unknown Source)
hudson.Proc$LocalProc.<init>(Proc.java:244)
hudson.Proc$LocalProc.<init>(Proc.java:216)
hudson.Launcher$LocalLauncher.launch(Launcher.java:816)
hudson.Launcher$ProcStarter.start(Launcher.java:382)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:440)
org.jruby.javasupport.JavaMethod.invokeDirect(JavaMethod.java:304)
org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:52)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:134)
org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:64)
org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:112)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:126)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:163)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:70)
org.jruby.ast.FCallSpecialArgNode.interpret(FCallSpecialArgNode.java:45)
org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:64)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:112)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:126)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:163)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:70)
org.jruby.ast.CallManyArgsNode.interpret(CallManyArgsNode.java:59)
org.jruby.ast.CallOneArgFixnumNode.interpret(CallOneArgFixnumNode.java:59)
org.jruby.ast.IfNode.interpret(IfNode.java:110)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.ast.IfNode.interpret(IfNode.java:116)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:268)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:220)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:236)
org.jruby.ast.CallThreeArgNode.interpret(CallThreeArgNode.java:61)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:209)
org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:160)
org.jruby.runtime.Interpreted19Block.yieldSpecific(Interpreted19Block.java:133)
org.jruby.runtime.Block.yieldSpecific(Block.java:99)
org.jruby.ast.ZYieldNode.interpret(ZYieldNode.java:25)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.ast.RescueNode.executeBody(RescueNode.java:224)
org.jruby.ast.RescueNode.interpret(RescueNode.java:119)
org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:204)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:196)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:177)
org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:188)
org.jruby.ast.FCallOneArgBlockNode.interpret(FCallOneArgBlockNode.java:34)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:112)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:126)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:163)
org.jruby.javasupport.proxy.JavaProxyConstructor$2.invoke(JavaProxyConstructor.java:224)
org.jruby.proxy.hudson.tasks.Builder$Proxy2.perform(Unknown Source)
hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:764)
hudson.model.Build$BuildExecution.build(Build.java:205)
hudson.model.Build$BuildExecution.doRun(Build.java:162)
hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
hudson.model.Run.execute(Run.java:1744)
hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
hudson.model.ResourceController.execute(ResourceController.java:98)
hudson.model.Executor.run(Executor.java:374)
Build step 'Run chef client on remote host' marked build as failure
Finished: FAILURE
Chef client and server is running in Linux machine, and jenkins is configured in Windows7.

The problems seems a bit wider as explained here SSH+slaves+and+Cygwin:
This is because Jenkins is trying to call Windows API and execute "/bin/bash" without going through Cygwin path translation. Windows interprets /bin/bash as c:\bin\bash.exe, and unless that path exists, it will fail.
A quick solutions is to pass from a linux node.
Another quick possibility is to make an on-demand Jenkins node out of the Chef-client linux machine (a few clicks) and run there the proper shell line (although it's probably more an hack):
chef-client -l info -j http://localhost:8080/jenkins//job/chef-sample/ws/chef.json

Jenkins client and server is running in Linux machine, and jenkins is configured in Windows7.
That makes no sense.
What's "Jenkins client"? The browser that you used to connect to Jenkins? You can connect through any browser on any OS. It has no affect whatsoever on the execution. The execution happens on master/slave nodes.
"Jenkins [...] server is running in Linux". OK. But then why does your log say Building in workspace C:\.jenkins\workspace\chef-sample. Clearly it is running on Windows node. So either there is a Windows slave node that you are not mentioning, or the Jenkins server is not on Linux but on Windows.
"Jenkins is configured in Windows7". Well, that just continues to add to the confusion. Is Jenkins server running on Windows or Linux, you just said "Linux" in the previous sentence.
Your issue is that you cannot run bash in Jenkins on Windows (and everything points to that being the case here), unless you have a bash equivalent (Cygwin) installed on Windows

Related

Debugger not working in WebStorm and WSL - File wslproxy is not executable

I'm running WebStorm 2022.2.2 on Windows and my Node.js project is sitting in WSL2 Ubuntu distribution, and I'm trying to get the debugger working for my setup with no success so far.
This is the error popping up as soon as I press the debug button:
2022-09-24 11:38:49,751 [61701563] INFO - #c.i.j.d.JavaScriptDebugProcess - JSDebugger publish port: 58315
2022-09-24 11:38:49,861 [61701673] INFO - #c.i.e.r.ExecutionUtil - Error running 'my-project:dev':<br>Failed to prepare environment: File is not executable: /mnt/c/Users/MyPC/AppData/Local/JetBrains/Toolbox/apps/WebStorm/ch-0/222.4167.31/bin/wslproxy (C:\Users\MyPC\AppData\Local\JetBrains\Toolbox\apps\WebStorm\ch-0\222.4167.31\bin\wslproxy)
com.intellij.execution.ExecutionException: Failed to prepare environment: File is not executable: /mnt/c/Users/MyPC/AppData/Local/JetBrains/Toolbox/apps/WebStorm/ch-0/222.4167.31/bin/wslproxy (C:\Users\MyPC\AppData\Local\JetBrains\Toolbox\apps\WebStorm\ch-0\222.4167.31\bin\wslproxy)
at com.intellij.javascript.nodejs.execution.NodeTargetRun.prepareCommandLine(NodeTargetRun.kt:129)
at com.intellij.javascript.nodejs.execution.NodeTargetRun.startProcessEx(NodeTargetRun.kt:138)
at com.intellij.javascript.nodejs.execution.NodeTargetRun.startProcess(NodeTargetRun.kt:103)
at com.github.iguissouma.nxconsole.buildTools.rc.NxRunProfileState.startProcess(NxRunProfileState.kt:70)
at com.intellij.javascript.nodejs.execution.NodeBaseRunProfileState$Companion.runInBackground(NodeBaseRunProfileState.kt:58)
at com.intellij.javascript.nodejs.execution.NodeBaseRunProfileState$Companion.access$runInBackground(NodeBaseRunProfileState.kt:41)
at com.intellij.javascript.nodejs.execution.NodeBaseRunProfileState$Companion$executeUnderProgress$1.run(NodeBaseRunProfileState.kt:49)
at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:442)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$5(CoreProgressManager.java:493)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:252)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:188)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:175)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:252)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.Exception: File is not executable: /mnt/c/Users/MyPC/AppData/Local/JetBrains/Toolbox/apps/WebStorm/ch-0/222.4167.31/bin/wslproxy (C:\Users\MyPC\AppData\Local\JetBrains\Toolbox\apps\WebStorm\ch-0\222.4167.31\bin\wslproxy)
at com.intellij.execution.wsl.WslToolsKt.getTool(WslTools.kt:17)
at com.intellij.execution.wsl.WslProxy.<init>(WslProxy.kt:101)
at com.intellij.execution.wsl.target.WslTargetEnvironment.getWslPort(WslTargetEnvironment.kt:88)
at com.intellij.execution.wsl.target.WslTargetEnvironment.<init>(WslTargetEnvironment.kt:79)
at com.intellij.execution.wsl.target.WslTargetEnvironmentRequest.prepareEnvironment(WslTargetEnvironmentRequest.kt:68)
at com.intellij.javascript.nodejs.execution.NodeTargetRun.prepareCommandLine(NodeTargetRun.kt:122)
... 26 more
Caused by: com.intellij.execution.wsl.ProcessExistedNotZeroException: Can't execute test -x /mnt/c/Users/MyPC/AppData/Local/JetBrains/Toolbox/apps/WebStorm/ch-0/222.4167.31/bin/wslproxy: 1.
at com.intellij.execution.wsl.WslProcessToolsKt.waitProcess(WslProcessTools.kt:37)
at com.intellij.execution.wsl.WslProcessToolsKt.runCommand(WslProcessTools.kt:19)
at com.intellij.execution.wsl.WslProcessToolsKt.runCommand$default(WslProcessTools.kt:14)
at com.intellij.execution.wsl.WslToolsKt.getTool(WslTools.kt:14)
... 31 more
What do I have to do in order to get the Debugger working?

Error While configuring Jenkins Controller and Agent using amazon EC2 instance

I'm trying to configure Jenkins Controller and Agent (maven server as agent node), but I'm getting an error while launching my node.
This is the error
"Error: A JNI error has occurred, please check your installation and try again"
I have double-checked my configurations. created new user in maven and given it sudo access, configured ssh to allow password based authentication.
I dont know what to do as I'm new to this concept. Please help me out.**
[09/24/22 16:28:17] [SSH] Opening SSH connection to 172.31.31.40:22.
[09/24/22 16:28:17] [SSH] WARNING: SSH Host Keys are not being verified. Man-in-the-middle attacks may be possible against this connection.
[09/24/22 16:28:17] [SSH] Authentication successful.
[09/24/22 16:28:17] [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=()
BASH_ARGV=()
BASH_CMDS=()
BASH_EXECUTION_STRING=set
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="4" [1]="2" [2]="46" [3]="2" [4]="release" [5]="x86_64-koji-linux-gnu")
BASH_VERSION='4.2.46(2)-release'
DIRSTACK=()
EUID=1001
GROUPS=()
HOME=/home/jenkins
HOSTNAME=ip-172-31-31-40.ec2.internal
HOSTTYPE=x86_64
IFS=$' \t\n'
LANG=en_US.UTF-8
LESSOPEN='||/usr/bin/lesspipe.sh %s'
LOGNAME=jenkins
MACHTYPE=x86_64-koji-linux-gnu
MAIL=/var/mail/jenkins
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/usr/local/bin:/usr/bin
PIPESTATUS=([0]="0")
PPID=22937
PS4='+ '
PWD=/home/jenkins
SHELL=/bin/bash
SHELLOPTS=braceexpand:hashall:interactive-comments
SHLVL=1
SSH_CLIENT='172.31.93.109 40612 22'
SSH_CONNECTION='172.31.93.109 40612 172.31.31.40 22'
TERM=dumb
UID=1001
USER=jenkins
XDG_RUNTIME_DIR=/run/user/1001
XDG_SESSION_ID=56
_=/etc/bashrc
Checking Java version in the PATH
openjdk version "1.8.0_342"
OpenJDK Runtime Environment (build 1.8.0_342-b07)
OpenJDK 64-Bit Server VM (build 25.342-b07, mixed mode)
[09/24/22 16:28:17] [SSH] Checking java version of /home/jenkins/jdk/bin/java
Couldn't figure out the Java version of /home/jenkins/jdk/bin/java
bash: /home/jenkins/jdk/bin/java: No such file or directory
[09/24/22 16:28:17] [SSH] Checking java version of java
[09/24/22 16:28:17] [SSH] java -version returned 1.8.0_342.
[09/24/22 16:28:17] [SSH] Starting sftp client.
[09/24/22 16:28:17] [SSH] Copying latest remoting.jar...
Source agent hash is 8D575C4C8219E6AB2039295EC545C6C3. Installed agent hash is 8D575C4C8219E6AB2039295EC545C6C3
Verified agent jar. No update is necessary.
Expanded the channel window size to 4MB
[09/24/22 16:28:18] [SSH] Starting agent process: cd "/home/jenkins" && java -jar remoting.jar -workDir /home/jenkins -jar-cache /home/jenkins/remoting/jarCache
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: hudson/remoting/Launcher has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)
Agent JVM has terminated. Exit code=1
[09/24/22 16:28:18] Launch failed - cleaning up connection
[09/24/22 16:28:18] [SSH] Connection closed.```
The core error is pretty clear ...
You have no JAVA_HOME defined as shown in the env dump, log shows: Launcher has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
In English, that means you are trying to run the agent on Java 8 (ie: java -version returned 1.8.0_342) , when Java 11 is the required minimum for Jenkins 2.357+ / LTS 2.361.1+: Blog post, Enhancement Proposal, Upgrade Guide, Change Log, Community post w/upgrade instructions
ps: you should also address: WARNING: SSH Host Keys are not being verified. Man-in-the-middle attacks may be possible against this connection

hudson*.groovy not found in jenkins

I am trying to configure jenkins job with groovy scripts, I donot know what I am doing wrong with the configuration that I could not execute even a simple groovy command like
println System.getenv("PATH")
it shows the following stack trace when the jenkins tries to build then following error is thrown
[workspace] $ groovy "C:\Program Files (x86)\Jenkins\jobs\{Project_Name}\workspace\hudson2392295018240496017.groovy"
The system cannot find the file specified
FATAL: command execution failed
java.io.IOException: Cannot run program "groovy" (in directory "C:\Program Files (x86)\Jenkins\jobs\{Project_Name}\workspace"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:780)
at hudson.Launcher$ProcStarter.start(Launcher.java:360)
at hudson.Launcher$ProcStarter.join(Launcher.java:367)
at hudson.plugins.groovy.Groovy.perform(Groovy.java:110)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:772)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:160)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:535)
at hudson.model.Run.execute(Run.java:1732)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:234)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 16 more
Build step 'Execute Groovy script' marked build as failure
Finished: FAILURE
I am using default groovy version in jenkins configuration and have installed the jenkins plugins for groovy.
I am new to both jenkins and groovy.
Thanks in advance.
You need to have an install of Groovy which your Jenkins can see - which is the default option
Alternatively, you can add one in the global config
which can then be used in the build step
Started by user anonymous
Building in workspace /Users/xxxxxx/.jenkins/jobs/gr/workspace
[workspace] $ groovy /Users/xxxxx/.jenkins/jobs/gr/workspace/hudson5419917819864291744.groovy
build
/Users/xxxxxx/perl5/perlbrew/bin:/Users/xxxxx/perl5/perlbrew/perls/perl-5.16.0/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
Finished: SUCCESS

Jenkins SSH slave fails to create /home/<user>/jenkins

When configuring an ssh slave on Jenkins, which runs on an ec2 instance, I get the following error message when I click on the "Launch Slave Agent".
[08/06/14 18:41:46] [SSH] Opening SSH connection to ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com:22.
[08/06/14 18:41:46] [SSH] Authentication successful.
[08/06/14 18:41:46] [SSH] The remote users environment is:
[08/06/14 18:41:46] [SSH] Starting sftp client.
[08/06/14 18:41:46] [SSH] SFTP failed. Copying via SCP.
[08/06/14 18:41:46] [SSH] Remote file system root /home/<user>/jenkins does not exist. Will try to create it...
Failed to create /home/<user>/jenkins
[08/06/14 18:41:46] [SSH] Copying latest slave.jar...
hudson.util.IOException2: Could not copy slave.jar into '/home/<user>/jenkins' on slave
at hudson.plugins.sshslaves.SSHLauncher.copySlaveJarUsingSCP(SSHLauncher.java:967)
at hudson.plugins.sshslaves.SSHLauncher.copySlaveJar(SSHLauncher.java:926)
at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:596)
at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:228)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.io.IOException: Error during SCP transfer.
at com.trilead.ssh2.SCPClient.put(SCPClient.java:523)
at hudson.plugins.sshslaves.SSHLauncher.copySlaveJarUsingSCP(SSHLauncher.java:965)
... 7 more
Caused by: java.io.IOException: Remote scp terminated unexpectedly.
at com.trilead.ssh2.SCPClient.readResponse(SCPClient.java:50)
at com.trilead.ssh2.SCPClient.sendBytes(SCPClient.java:140)
at com.trilead.ssh2.SCPClient.put(SCPClient.java:519)
... 8 more
[08/06/14 18:41:46] [SSH] Connection closed.
Jenkins configuration for this node is as follows :
Please note that I've set JavaPath property because Jenkins "Couldn't figure out the Java version of java" (that's the error message I was getting)
Any idea how I could fix this issue ? Thanks
I have had same issue. After reading the following post talking about new version, realized something wrong on the SSH plugin that i'm using.
So I have visited to Manage plugins --> Installed --> searched 'SSH' (disabled SSH related clients by removing selection)
Basically you need:
Disabled - SSH Slaves plugin (probably comes with Jenkins)
Added SSH plugin (version 2.4).
Which resolved the issue, that i have had and successfully connected after other setups shown in this doc from step 6, JENKINS-SETTING UP MASTER SLAVE ENVIRONMENT. ( slave.jar -jnlpUrl....)
Hope this will help someone in future.
You need to provide a valid path on the ec2 instance to which the user has an access.
I was experiencing the same thing, no environment variables
The remote users environment is:
(empty)
.
.
.
I set the home directory that i was using for a new one for the jenkins user (example: /jenkinsFolder) and enabled the shell for jenkins in /etc/passwd (it was disabled)
then I was able to see environment variables when launching the slave.

Groovy Compilation error :Unrecognized Windows Sockets error

Environment :
Jenkins Server (Linux)
Senkins slave agent (Windows )
Build :Gradle
Project : EasyB ,Selenium,Groovy
I am getting a compilation error while trying to compile my easyB + selenium project.
We use gradle to manage the project.
The projects compiles fine on local desktop, but fails when we try to compile it via a Jenkins job - using a windows slave agent, it throws a compilation error.
The error is bit cryptic- java.net.SocketException: Unrecognized Windows Sockets error: 10106: socket
Grails users have reported a similar problem- which they attributed to overuse of a port. But that cant be the case in this situation ?
I wonder if Gradle is trying to download stuff ?
But that also doesn't make too much sense - since the compilation runs fine- if I run it when logged in directly to the windows slave agent machine.
Compilation error
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':compileGroovy'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:68)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:34)
at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter$1.run(CacheLockHandlingTaskExecuter.java:34)
at org.gradle.cache.internal.DefaultCacheAccess$2.create(DefaultCacheAccess.java:200)
at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:172)
at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:198)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:137)
at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:83)
at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter.execute(CacheLockHandlingTaskExecuter.java:32)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:247)
at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:192)
at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:177)
at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:36)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:31)
at org.gradle.cache.internal.DefaultCacheAccess$1.create(DefaultCacheAccess.java:111)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:126)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:109)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:129)
at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:155)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:110)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:78)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:38)
at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:39)
at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:25)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
at org.gradle.launcher.cli.ActionAdapter.execute(ActionAdapter.java:30)
at org.gradle.launcher.cli.ActionAdapter.execute(ActionAdapter.java:22)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:200)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:173)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:138)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:48)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.Main.main(Main.java:39)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
Caused by: org.gradle.internal.UncheckedException: java.net.SocketException: Unrecognized Windows Sockets error: 10106: socket
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:39)
at org.gradle.messaging.remote.internal.inet.TcpIncomingConnector.accept(TcpIncomingConnector.java:66)
at org.gradle.messaging.remote.internal.HandshakeIncomingConnector.accept(HandshakeIncomingConnector.java:45)
at org.gradle.messaging.remote.internal.DefaultMultiChannelConnector.accept(DefaultMultiChannelConnector.java:57)
at org.gradle.messaging.remote.internal.DefaultMessagingServer.accept(DefaultMessagingServer.java:43)
at org.gradle.process.internal.DefaultWorkerProcessFactory$DefaultWorkerProcessBuilder.build(DefaultWorkerProcessFactory.java:77)
at org.gradle.api.internal.tasks.compile.daemon.CompilerDaemonManager.startDaemon(CompilerDaemonManager.java:92)
at org.gradle.api.internal.tasks.compile.daemon.CompilerDaemonManager.getDaemon(CompilerDaemonManager.java:52)
at org.gradle.api.internal.tasks.compile.daemon.DaemonGroovyCompiler.execute(DaemonGroovyCompiler.java:47)
at org.gradle.api.internal.tasks.compile.daemon.DaemonGroovyCompiler.execute(DaemonGroovyCompiler.java:34)
at org.gradle.api.internal.tasks.compile.NormalizingGroovyCompiler.delegateAndHandleErrors(NormalizingGroovyCompiler.java:99)
at org.gradle.api.internal.tasks.compile.NormalizingGroovyCompiler.execute(NormalizingGroovyCompiler.java:48)
at org.gradle.api.internal.tasks.compile.NormalizingGroovyCompiler.execute(NormalizingGroovyCompiler.java:34)
at org.gradle.api.internal.tasks.compile.DelegatingGroovyCompiler.execute(DelegatingGroovyCompiler.java:29)
at org.gradle.api.internal.tasks.compile.DelegatingGroovyCompiler.execute(DelegatingGroovyCompiler.java:20)
at org.gradle.api.internal.tasks.compile.IncrementalJavaCompilerSupport.execute(IncrementalJavaCompilerSupport.java:33)
at org.gradle.api.internal.tasks.compile.IncrementalJavaCompilerSupport.execute(IncrementalJavaCompilerSupport.java:23)
at org.gradle.api.tasks.compile.GroovyCompile.compile(GroovyCompile.java:77)
at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:196)
at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:102)
at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:99)
at org.gradle.api.tasks.compile.GroovyCompile_Decorated.invokeMethod(Unknown Source)
at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$4.execute(AnnotationProcessingTaskFactory.java:150)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$4.execute(AnnotationProcessingTaskFactory.java:145)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:472)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:461)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:60)
... 57 more
Caused by: java.net.SocketException: Unrecognized Windows Sockets error: 10106: socket
at org.gradle.messaging.remote.internal.inet.TcpIncomingConnector.accept(TcpIncomingConnector.java:61)
... 83 more
It looks like that error is a WSAEPROVIDERFAILEDINIT error. From the link:
Service provider failed to initialize.
The requested service provider could not be loaded or initialized. This error is returned if either a service provider's DLL could not be loaded (LoadLibrary failed) or the provider's WSPStartup or NSPStartup function failed.
This might be caused by Java being launched by a wrapper, but not receiving all the correct environment variables:
A quick search over at Sun's Java site (for "10106") turned up this thread: "java.net.SocketException: Unrecognized Windows Sockets error: 10106: create" at http://forum.java.sun.com/thread.jsp...hreadID=329241
The thread seems to suggest that your environment variable for "system root" might be incorrect, and that it needs to be reset. Or, as an alternative, you can set/select "Append Environment to Native Environment"
(Note, that link is dead, this one works though: Unrecognized Windows Sockets error: 10106: create)
So, I guess look into seeing how Jenkins is being launched.

Resources