Sun
Sun

Reputation: 3564

Jenkins - java.io.IOException: Cannot run program "/usr/local/bin/bash"

I am using Jenkings in Linux_Machine_1. It have around 20 jobs(successfully running jobs)

I copied .jenkins folder to Linux_Machine_2. I started Jenkins in Linux_Machine_2.

I tried to run one of the jobs and I am getting below error:

 Started by user anonymous
    Building in workspace /home/portaldev/.jenkins/workspace/Trunk_Build
    [Trunk_Build] $ /usr/local/bin/bash -xe /tmp/hudson1846171411013031358.sh
    FATAL: command execution failed
    java.io.IOException: Cannot run program "/usr/local/bin/bash" (in directory "/home/portaldev/.jenkins/workspace/Trunk_Build"): error=2, No such file or directory
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
        at hudson.Proc$LocalProc.<init>(Proc.java:244)
        at hudson.Proc$LocalProc.<init>(Proc.java:216)
        at hudson.Launcher$LocalLauncher.launch(Launcher.java:763)
        at hudson.Launcher$ProcStarter.start(Launcher.java:353)
        at hudson.Launcher$ProcStarter.join(Launcher.java:360)
        at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:91)
        at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:60)
        at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
        at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)
        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:586)
        at hudson.model.Run.execute(Run.java:1576)
        at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
        at hudson.model.ResourceController.execute(ResourceController.java:88)
        at hudson.model.Executor.run(Executor.java:241)
    Caused by: java.io.IOException: error=2, No such file or directory
        at java.lang.UNIXProcess.forkAndExec(Native Method)
        at java.lang.UNIXProcess.<init>(UNIXProcess.java:135)
        at java.lang.ProcessImpl.start(ProcessImpl.java:130)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1021)
        ... 16 more
    Build step 'Execute shell' marked build as failure
    An attempt to send an e-mail to empty list of recipients, ignored.
    Finished: FAILURE

After I created simple job Test_Job (no build scripts) in the Linux_Machine_2. And build, even I am getting same type of error.

I tried by execute permission to all .jenkins folder

 chmod +x  .jenkings/

Even same out error output.

I run which bash and it gave output /bin/bash.

Upvotes: 5

Views: 15744

Answers (1)

user829755
user829755

Reputation: 1598

say ls -l /usr/local/bin/bash on machine 1 to see if there's a symbolic link from /usr/local/bin/bash to /bin/bash. if yes, then create the same link on machine 2:

cd /usr/local/bin
ln -s /bin/bash .

Upvotes: 3

Related Questions