Bamboo failing to checkout git repository, "Permission denied, fatal: unable to fork"

I'm trying out Bamboo (4.2.1 build 3213) and attempting to get my first build running. We use an internally hosted git repo, authentication is done via private key SSH. When trying to run the build I get a "Permission denied, fatal: unable to fork" error. I've tried running the shell script that it mentions in the stacktrace manually, using the bamboo user, and it runs fine. Any ideas?

Error:

java.lang.RuntimeException: com.atlassian.bamboo.plugins.git.GitCommandException: command [/usr/bin/git, ls-remote, ssh://1438ab9c-01a7-4199-9dc1-0324f584912d@127.0.0.1:53982/services/projectName] failed with code 128. Working directory was [.]., stderr:
[fatal: cannot exec '/tmp/bamboo-ssh.9900a68e.sh': Permission denied, fatal: unable to fork]
    at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:119)
    at com.atlassian.bamboo.executor.RetryingTaskExecutor.runTask(RetryingTaskExecutor.java:79)
    at com.atlassian.bamboo.executor.RetryingTaskExecutor.retry(RetryingTaskExecutor.java:174)
    at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectionChangesWithRetry(DefaultChangeDetectionManager.java:389)
    at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceLastBuild(DefaultChangeDetectionManager.java:260)
    at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:218)
    at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:136)
    at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceLastBuildIfTriggered(DefaultChangeDetectionManager.java:113)
    at com.atlassian.bamboo.v2.trigger.ChangeDetectionListenerAction.process(ChangeDetectionListenerAction.java:100)
    at com.atlassian.bamboo.chains.ChainExecutionManagerImpl$1$1.createBuildDetectionResult(ChainExecutionManagerImpl.java:176)
    at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.createNewChainState(ChainExecutionManagerImpl.java:379)
    at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.access$000(ChainExecutionManagerImpl.java:93)
    at com.atlassian.bamboo.chains.ChainExecutionManagerImpl$1.getChainState(ChainExecutionManagerImpl.java:172)
    at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.tryStartChainState(ChainExecutionManagerImpl.java:252)
    at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.start(ChainExecutionManagerImpl.java:167)
    at sun.reflect.GeneratedMethodAccessor768.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy78.start(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor768.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
    at $Proxy79.start(Unknown Source)
    at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$2.call(PlanExecutionManagerImpl.java:288)
    at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$2.call(PlanExecutionManagerImpl.java:282)
    at com.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:324)
    at com.atlassian.bamboo.plan.PlanExecutionLockServiceImpl.lock(PlanExecutionLockServiceImpl.java:77)
    at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.doWithProcessLock(PlanExecutionManagerImpl.java:429)
    at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.start(PlanExecutionManagerImpl.java:281)
    at com.atlassian.bamboo.plan.NonBlockingPlanExecutionServiceImpl$1.call(NonBlockingPlanExecutionServiceImpl.java:70)
    at com.atlassian.bamboo.plan.NonBlockingPlanExecutionServiceImpl$1.call(NonBlockingPlanExecutionServiceImpl.java:61)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at com.atlassian.bamboo.build.pipeline.concurrent.NamedThreadFactory$2.run(NamedThreadFactory.java:52)
    at java.lang.Thread.run(Thread.java:662)
Caused by: com.atlassian.bamboo.plugins.git.GitCommandException: command [/usr/bin/git, ls-remote, ssh://1438ab9c-01a7-4199-9dc1-0324f584912d@127.0.0.1:53982/services/projectName] failed with code 128. Working directory was [.]., stderr:
[fatal: cannot exec '/tmp/bamboo-ssh.9900a68e.sh': Permission denied, fatal: unable to fork]
    at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:356)
    at com.atlassian.bamboo.plugins.git.GitCommandProcessor.getRemoteRefs(GitCommandProcessor.java:282)
    at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.resolveBranch(NativeGitOperationHelper.java:438)
    at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.obtainLatestRevision(NativeGitOperationHelper.java:514)
    at com.atlassian.bamboo.plugins.git.GitRepository.collectChangesSinceLastBuild(GitRepository.java:209)
    at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager$1.call(DefaultChangeDetectionManager.java:393)
    at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager$1.call(DefaultChangeDetectionManager.java:390)
    at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:100)
    ... 44 more
Caused by: com.atlassian.utils.process.ProcessException: Non-zero exit code: 128
    at com.atlassian.utils.process.PluggableProcessHandler.complete(PluggableProcessHandler.java:83)
    at com.atlassian.utils.process.ExternalProcess.finish(ExternalProcess.java:376)
    at com.atlassian.utils.process.ExternalProcess.execute(ExternalProcess.java:419)
    at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:351)
    ... 51 more

4 answers

1 accepted

After help from Atlassian, this was fixed by not using the system /usr/bin/git and instead switching to the built-in JGit implementation.

How can we configure that ?

 

Hi Adam,

Might it be that your /tmp directory has no execution permissions? Like it is some kind of mount point set with "noexec" flag for security reasons?

I understand that you are currently using jGit implementation and this was old question, but I thought I'll anyway leave here a note in case somebody else hit the same problem in future...

regards,

Yes, I second that -- we had the same issue and /tmp was a mount point that had 'noexec' set, as such:

[root@server tmp]# mount | grep tmp
/dev/mapper/VolGroup00-LogVol01 on /tmp type ext3 (rw,noexec,nosuid,nodev)

Note the 'noexec' in bold.

Bamboo proxies ssh requests through a script within the /tmp directory, so if the /tmp mount doesn't allow scripts to be run, then this error occurs.

If this the case with your setup, then to fix it, ensure that your /etc/fstab defines the /tmp mount similar to:

/dev/VolGroup00/LogVol01/tmp ext3 nodev 1

Then just reboot your box, run the plan, and you should be good. At least, that worked for me.

I major in java barcode program,I have met a similiar problem when configuring Bamboo CI server but i have solved it successfully.You can try the following method to see if it work out.

You can login into your elastic instance, switch your user to the user that bamboo is running with (bamboo), then try to make the dir that you specified. Probably it is a restricted path.

Basically: find SSH key and ip of bamboo instance, login, then:

su bamboo

mkdir /home/bamboo/myapp/portalogue/target/portalogue1/WEB-INF/classes/com/xti/portalogue/application/db/hibernate

Or before that you can just login into the bamboo/elastic instance and execute the maven target on your own with the -eX switch and check what kind of detailed error message it gives you.

 

Suggest an answer

Log in or Join to answer
Community showcase
Renan Battaglin
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,096 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot