Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-28623

Getting “ Cannot run program ”bash“” while building chef in jenkins

    Details

    • Similar Issues:

      Description

      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.

      I have tried running the "chef-client -l info -j http://localhost:8080/jenkins//job/chef-sample/ws/chef.json" command in Putty, I have replaced localhost and added the ipaddress of where jenkins is running. But am facing connection error.

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              Unassigned
              Reporter:
              swetha644 swetha sreeramoju
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: