【问题标题】:Jenkins - java.io.IOException: Cannot run program "/usr/local/bin/bash"Jenkins - java.io.IOException:无法运行程序“/usr/local/bin/bash”
【发布时间】:2013-06-15 13:53:30
【问题描述】:

我在 Linux_Machine_1 中使用 Jenkings。它有大约 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

【问题讨论】:

  • 您的问题包含答案。很难想象您还没有阅读您上面所说的内容。
  • 对不起,请告诉我答案。请给我一些更清楚的说明。
  • 我的 Linux_Machine_1 也只使用 /bin/bash。
  • 但是/usr/local/bin/bash 确实存在于您的机器 1 上,对吧?
  • 如果我改变这些东西,我的老板会开枪打死我。请帮助我如何让它在 Linux_Machine_2 中引用/bin/bash

标签: shell unix jenkins hudson


【解决方案1】:

在机器 1 上说 ls -l /usr/local/bin/bash 以查看是否存在从 /usr/local/bin/bash/bin/bash 的符号链接。如果是,则在机器 2 上创建相同的链接:

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

【讨论】:

  • 谢谢亲爱的朋友,你说的对,有链接,我在2号机上运行上面两个命令,就可以了。
猜你喜欢
  • 2021-07-19
  • 2022-08-13
  • 2019-04-11
  • 1970-01-01
  • 1970-01-01
  • 2021-09-28
  • 2014-09-21
  • 1970-01-01
  • 2013-04-22
相关资源
最近更新 更多