Bamboo Data Center builds fail with "fatal: unable to fork"
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Bamboo Data Center builds fail with the following error shown in the Error log section on the Plan Summary page:
System Error Details
[...] (java.lang.RuntimeException : com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: Could not connect to Bitbucket) [...] fatal: cannot exec '/tmp/bamboo-ssh.2958cbb8.sh': Permission denied fatal: unable to fork
The error can also be seen in the <bamboo-home>/logs/atlassian-bamboo.log
file.
Environment
The solution has been validated in Bamboo Data Center 9.6 but may be applicable to other versions.
Diagnosis
Upon reviewing the full <bamboo-home>/logs/atlassian-bamboo.log
file, the following error is present:
1
2
3
4
5
java.lang.RuntimeException: com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: Could not connect to Bitbucket
[...]
Caused by: com.atlassian.bamboo.repository.RepositoryException: Cannot fetch branch '\(unresolved\) HashAndSource{refName=\[null], branch=\[master], hash=\[0db340e352cf8050b9194cee1317c5766156b8fa]}' from 'ssh://git@bitbucket.org:7999/PROJ/REPOSITORY.git' to source directory '/opt/bamboo/bamboo-agent-home/xml-data/build-dir/\_git-repositories-cache/11f6f360acd6210f14d20e70a597f32549fc4622'. com.atlassian.bamboo.plugins.git.GitCommandException: command \[/opt/bamboo/git/git-2.11.1/bin/git ls-remote ssh://3f32c847-7604-4d17-8b71-8de0f0ef6118@127.0.0.1:45705/PROJ/REPOSITORY.git] failed with code 128. Working directory was \[/tmp]., stderr:
fatal: cannot exec '/tmp/bamboo-ssh.2958cbb8.sh': Permission denied
fatal: unable to fork
Cause
There are two possible causes:
The user account running Bamboo (or the remote agent) does not have permissions over the temporary directory being used to run commands.
The temporary directory is mounted with NOEXEC, meaning commands cannot be executed there.
Solution
Verify and adjust permissions
First, make sure that the user which is running your Bamboo/agent service has full ownership and permissions to write to the temporary directory. You can identify the temporary directory by looking at the error message. For example:
fatal: cannot exec '/tmp/bamboo-ssh.2958cbb8.sh': Permission denied
fatal: unable to fork
Verify if the folder being used as a temporary directory was not mounted as NOEXEC, which disallows the execution of binary files on the particular file system:
Adjust permissions as needed so the Bamboo user can use the directory and execute files in it.
Workaround: change the temporary directory
If adjusting the directory permissions/mount is not possible, you can also change the folder that is used as temporary directory to a different location where permissions can be set as required.
Was this helpful?