Jenkins - java.io.IOException: 无法运行程序 "/usr/local/bin/bash"

5
我正在Linux_Machine_1上使用Jenkins。它有大约20个任务(成功运行的任务)。
我将.jenkins文件夹复制到Linux_Machine_2上。我在Linux_Machine_2上启动了Jenkins。
我尝试运行其中一个任务,但是我得到以下错误:
 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

在Linux_Machine_2上创建了一个名为Test_Job的简单工作(没有构建脚本),并进行构建,但是我仍然遇到了相同类型的错误。

我尝试将所有.jenkins文件夹设置为可执行权限。

 chmod +x  .jenkings/

即使是相同的错误输出。

我运行which bash,它给出了输出/bin/bash


2
你的问题已经包含了答案。很难想象你没有阅读你上面所陈述的内容。 - devnull
抱歉,我可以知道答案吗?请给我更多的明确性。 - Sun
我的 Linux_Machine_1 也只使用 /bin/bash。 - Sun
但是在你的机器1上,/usr/local/bin/bash 确实存在,对吗? - devnull
如果我更改那些内容,我的老板会开除我。请帮我想办法如何在Linux_Machine_2中将其引用为“/bin/bash”。 - Sun
1个回答

3

在机器 1 上输入 ls -l /usr/local/bin/bash 命令,查看是否有一个从 /usr/local/bin/bash/bin/bash 的符号链接。如果是,则在机器 2 上创建相同的链接:

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

谢谢你,亲爱的朋友,你说得对,确实有链接。我在第二台机器上运行了上述两个命令,它正常工作。 - Sun

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接