I'm running a Bamboo plan with a Bitbucket repository, but it failed imminently with code 128
Asked by Ivy Zhou:

Could anybody kindly help?

Version: Bamboo 6.9

Repository: Bitbucket Server

Error log:

java.lang.RuntimeException: com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException  
at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:141)  
at com.atlassian.bamboo.executor.RetryingTaskExecutor.runTask(RetryingTaskExecutor.java:99)  
at com.atlassian.bamboo.executor.RetryingTaskExecutor.retry(RetryingTaskExecutor.java:207)  
at com.atlassian.bamboo.executor.RetryingTaskExecutor.retry(RetryingTaskExecutor.java:188)  
at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask.execute(VcsCheckoutTask.java:123)  
at com.atlassian.bamboo.task.TaskExecutorImpl.lambda$executeTasks$3(TaskExecutorImpl.java:319)  
at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:252)  
at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:319)  
at com.atlassian.bamboo.task.TaskExecutorImpl.executePreparationTasks(TaskExecutorImpl.java:91)  
at com.atlassian.bamboo.build.pipeline.tasks.PrepareBuildTask.call(PrepareBuildTask.java:81)  
at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.executeBuildPhase(DefaultBuildAgent.java:204)  
at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:176)  
at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.lambda$waitAndPerformBuild$0(BuildAgentControllerImpl.java:131)  
at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:185)  
at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:125)  
at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:127)  
at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)  
at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)  
at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)  
at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)  
at java.lang.Thread.run(Thread.java:748)  
Caused by: com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException  
at com.atlassian.bamboo.plugins.stash.v2.BitbucketServerWorkingCopyManager.retrieveSourceCode(BitbucketServerWorkingCopyManager.java:100)  
at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask.fillWorkingDirFromVcs(VcsCheckoutTask.java:206)  
at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask.access$000(VcsCheckoutTask.java:54)  
at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask$1.call(VcsCheckoutTask.java:126)  
at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask$1.call(VcsCheckoutTask.java:123)  
at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:112)  
... 20 more  
Caused by: com.atlassian.bamboo.repository.RepositoryException: Cannot fetch branch '(unresolved) HashAndSource{refName=\[null\], branch=\[master\], hash=\[641a1d07e3105ba53cd80d26a701e7a826ad064e\]}' from 'ssh://git@dc2ftxbtblv01.ipa.lmeft.co.uk:7999/mtcts/mtc-test-repository.git' to source directory '/root/bamboo-agent-home/xml-data/build-dir/_git-repositories-cache/ba39c814cb80d2284ac46e5849ec7a7fab76fe7f'. com.atlassian.bamboo.plugins.git.GitCommandException: command \[/bin/git ls-remote ssh://a8c0935e-4c9a-4900-9b01-c074eeaeece8@127.0.0.1:43922/mtcts/mtc-test-repository.git\] failed with code 128. Working directory was \[/tmp\]., stderr:  
fatal: cannot exec '/tmp/bamboo-ssh.9900a68e.sh': Permission denied  
fatal: unable to fork  
at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.fetch(NativeGitOperationHelper.java:538)  
at com.atlassian.bamboo.plugins.git.v2.GitWorkingCopyManager.lambda$checkout$1(GitWorkingCopyManager.java:253)  
at io.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:293)  
at com.atlassian.bamboo.plugins.git.v2.GitWorkingCopyManager.checkout(GitWorkingCopyManager.java:244)  
at com.atlassian.bamboo.plugins.git.v2.GitWorkingCopyManager.retrieveSourceCode(GitWorkingCopyManager.java:102)  
at com.atlassian.bamboo.plugins.stash.v2.BitbucketServerWorkingCopyManager.retrieveSourceCode(BitbucketServerWorkingCopyManager.java:90)  
... 25 more  
Caused by: com.google.common.util.concurrent.UncheckedExecutionException: com.atlassian.bamboo.plugins.git.GitCommandException: command \[/bin/git ls-remote ssh://a8c0935e-4c9a-4900-9b01-c074eeaeece8@127.0.0.1:43922/mtcts/mtc-test-repository.git\] failed with code 128. Working directory was \[/tmp\]., stderr:  
fatal: cannot exec '/tmp/bamboo-ssh.9900a68e.sh': Permission denied  
fatal: unable to fork  
at com.atlassian.bamboo.utils.collections.AlwaysInvalidatingCacheDecorator.getUnchecked(AlwaysInvalidatingCacheDecorator.java:128)  
at com.atlassian.bamboo.util.CallableResultCache.call(CallableResultCache.java:142)  
at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.getRemoteRefs(NativeGitOperationHelper.java:613)  
at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.resolveBranch(NativeGitOperationHelper.java:565)  
at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.getRefsToFetch(NativeGitOperationHelper.java:555)  
at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.fetch(NativeGitOperationHelper.java:516)  
... 30 more  
Caused by: com.atlassian.bamboo.plugins.git.GitCommandException: command \[/bin/git ls-remote ssh://a8c0935e-4c9a-4900-9b01-c074eeaeece8@127.0.0.1:43922/mtcts/mtc-test-repository.git\] failed with code 128. Working directory was \[/tmp\]., 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:723)  
at com.atlassian.bamboo.plugins.git.GitCommandProcessor.getRemoteRefs(GitCommandProcessor.java:499)  
at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.lambda$getRemoteRefs$1(NativeGitOperationHelper.java:605)  
at com.atlassian.bamboo.util.CallableResultCache$1.load(CallableResultCache.java:39)  
at com.atlassian.bamboo.util.CallableResultCache$1.load(CallableResultCache.java:35)  
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)  
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)  
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)  
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)  
at com.google.common.cache.LocalCache.get(LocalCache.java:3937)  
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)  
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)  
at com.atlassian.bamboo.utils.collections.AlwaysInvalidatingCacheDecorator.get(AlwaysInvalidatingCacheDecorator.java:65)  
at com.atlassian.bamboo.utils.collections.AlwaysInvalidatingCacheDecorator.getUnchecked(AlwaysInvalidatingCacheDecorator.java:126)  
... 35 more

<br />

Close This Window  
\| Report bug Report Bug


Answers:
author: Petr Van??ek
body: Did you configure in any job step custom (/tmp) working directory?  

If yes, then try to set only tmp instead of /tmp or give permission to this folder to bamboo user.

comments: author: Ivy Zhou
body: Thanks Petr for your kindly help.

Actually I'm not sure about it. The env is built by the other guy and I just have the limit rights. Do you have any ideas to check the working directory? Is the bamboo user you mentioned who I log on the Bamboo?

Thanks again


author: Petr Van??ek
body: Did you configure plan and jobs inside? You can see problem in this part of your log.  

ssh://a8c0935e-4c9a-4900-9b01-c074eeaeece8@127.0.0.1:43922/mtcts/mtc-test-repository.git\] failed with code 128. Working directory was \[/tmp\]., stderr:  
fatal: cannot exec '/tmp/bamboo-ssh.9900a68e.sh': Permission denied

With user I mean system user. Look in documentation for Bamboo's operationg system.  
<https://confluence.atlassian.com/bamboo/running-bamboo-as-a-service-628720223.html>


author: Ivy Zhou
body: Thanks very much Petr.

Yes, it works after i asked someone to change the working directory.


author: Ankit Gupta
body: how did you changed the working directory ?


Tags: bitbucket-server