Jenkins: /usr/bin/bash: No such file or directory
Jenkins: /usr/bin/bash: No such file or directory
DodaTech
2 min read
The Jenkins error "/usr/bin/bash: No such file or directory" appears in build logs when a shell step tries to use /usr/bin/bash but the file does not exist on the Jenkins agent.
What It Means
Jenkins executes shell build steps using the path configured in the system — by default /usr/bin/bash. When the agent does not have bash installed at that exact path, the shell step fails immediately.
Why It Happens
- The Jenkins agent is a minimal container image (e.g., Alpine Linux) that uses
/bin/shinstead of/usr/bin/bash. - Bash is not installed on the agent machine.
- The shell path is hardcoded as
/usr/bin/bashin the Jenkins node configuration or pipeline. - The agent is running on a non-Debian distribution where bash lives at
/bin/bash.
How to Fix It
1. Install bash on the agent
Debian / Ubuntu:
sudo apt update && sudo apt install bash -yAlpine (Docker agents):
apk add bashCentOS / RHEL / Fedora:
sudo yum install bash -y2. Configure the correct shell path in Jenkins
Manage Jenkins → Nodes → Select agent → Configure → Set “Shell executable” to:
/bin/bash3. Check the current shell path
which bashExpected output: /bin/bash or /usr/bin/bash.
4. Create a symlink if needed
sudo ln -s /bin/bash /usr/bin/bashFAQ
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro