Jenkins sh "Cannot run program nohup" (durable task) in CI
The sh step is backed by the Durable Task plugin, which wraps each command with nohup so it survives agent disconnects. On a minimal agent image that lacks nohup (part of coreutils), the wrapper itself cannot launch and the step fails before your command runs.
What this error means
Every sh step fails immediately with Cannot run program "nohup" (in directory "..."): error=2, No such file or directory, even for a trivial command.
Jenkins console
java.io.IOException: Cannot run program "nohup" (in directory
"/home/jenkins/workspace/app"): error=2, No such file or directory
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1143)Common causes
coreutils / nohup not installed on the agent
A stripped-down container image omits coreutils, so nohup is absent and the Durable Task launcher cannot start the command.
nohup not on the agent PATH
Even if present, nohup outside the non-login shell PATH cannot be found by the wrapper.
How to fix it
Install coreutils on the agent
- Add coreutils (which provides
nohup) to the agent image. - Ensure
/usr/bin(or wherevernohuplives) is on the agent PATH. - Re-run; the
shwrapper can then launch commands.
Dockerfile (agent image)
# Debian/Ubuntu agent image
RUN apt-get update && apt-get install -y coreutils procpsHow to prevent it
- Include coreutils and procps in custom agent images.
- Test a trivial
sh 'true'step when building a new agent image. - Keep
nohupon the agent PATH for the build shell.
Related guides
Jenkins sh "Bad substitution" (dash vs bash) in CIFix Jenkins shell step "/bin/sh: 1: Bad substitution" - the `sh` step runs under POSIX `/bin/sh` (dash), whic…
Jenkins "Cannot run program ... No such file or directory" in CIFix Jenkins "java.io.IOException: error=2, No such file or directory" / "Cannot run program" - the agent trie…
Jenkins "Cannot connect to the Docker daemon" in a pipeline in CIFix Jenkins pipeline "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemo…