Skip to content
Latchkey

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

  1. Add coreutils (which provides nohup) to the agent image.
  2. Ensure /usr/bin (or wherever nohup lives) is on the agent PATH.
  3. Re-run; the sh wrapper can then launch commands.
Dockerfile (agent image)
# Debian/Ubuntu agent image
RUN apt-get update && apt-get install -y coreutils procps

How to prevent it

  • Include coreutils and procps in custom agent images.
  • Test a trivial sh 'true' step when building a new agent image.
  • Keep nohup on the agent PATH for the build shell.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →