Remote or Elastic Agents fail to start due to missing files

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

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 Server throws a "java.io.IOException: Permission denied" failure when Remote or Elastic Agents are starting. Agents will also report missing files.

Diagnosis

Before proceeding with the troubleshooting steps outlined in this article, please know that the investigation involves both Bamboo Server and the Agent. Examining the evidence from both sides is crucial to diagnose the permission issue accurately. The article aims to address the problem by providing comprehensive instructions to fix permissions on both the Server and the Agent.

When starting a Remote or Elastic Agent, the startup fails with the below error:

INFO | jvm 2 | 2017/11/23 13:49:03 | 2017-11-23 13:49:03,576 ERROR [WrapperSimpleAppMain] [ClasspathBuilder] An error has occurred when retrieving classpath data: HTTP/1.1 500 Internal Server Error
INFO | jvm 2 | 2017/11/23 13:49:03 | Exiting due to fatal exception.
INFO | jvm 2 | 2017/11/23 13:49:03 | com.atlassian.bamboo.agent.bootstrap.RemoteAgentHttpException: Response: [HTTP/1.1 500 Internal Server Error] received after manifest retrieval request.
INFO | jvm 2 | 2017/11/23 13:49:03 | 	at com.atlassian.bamboo.agent.bootstrap.ClasspathBuilder.terminateWithError(ClasspathBuilder.java:211)
INFO | jvm 2 | 2017/11/23 13:49:03 | 	at com.atlassian.bamboo.agent.bootstrap.ClasspathBuilder.getJarList(ClasspathBuilder.java:200)
INFO | jvm 2 | 2017/11/23 13:49:03 | 	at com.atlassian.bamboo.agent.bootstrap.ClasspathBuilder.sync(ClasspathBuilder.java:85)
INFO | jvm 2 | 2017/11/23 13:49:03 | 	at com.atlassian.bamboo.agent.bootstrap.ClasspathBuilder.getClassLoader(ClasspathBuilder.java:58)
INFO | jvm 2 | 2017/11/23 13:49:03 | 	at com.atlassian.bamboo.agent.bootstrap.AgentContext.newClassLoader(AgentContext.java:329)
INFO | jvm 2 | 2017/11/23 13:49:03 | 	at com.atlassian.bamboo.agent.bootstrap.AgentContext.run(AgentContext.java:93)
INFO | jvm 2 | 2017/11/23 13:49:03 | 	at com.atlassian.bamboo.agent.bootstrap.AgentBootstrap.run(AgentBootstrap.java:111)
INFO | jvm 2 | 2017/11/23 13:49:03 | 	at com.atlassian.bamboo.agent.bootstrap.AgentBootstrap.main(AgentBootstrap.java:50)
INFO | jvm 2 | 2017/11/23 13:49:03 | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO | jvm 2 | 2017/11/23 13:49:03 | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
INFO | jvm 2 | 2017/11/23 13:49:03 | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
INFO | jvm 2 | 2017/11/23 13:49:03 | 	at java.lang.reflect.Method.invoke(Method.java:498)
INFO | jvm 2 | 2017/11/23 13:49:03 | 	at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
INFO | jvm 2 | 2017/11/23 13:49:03 | 	at java.lang.Thread.run(Thread.java:745)

Elastic Agents may also report the following message: 

2015-08-17 13:18:49,265 INFO [tunnelserver:26224-1-thread-5] [LocalAcceptor] Accepted a local connection on port 46593, tunnel age: 32s
Exiting due to fatal exception.
com.atlassian.bamboo.agent.bootstrap.RemoteAgentHttpException: HTTP status code 404 received in response to Could not retrieve 'classpath.zip'.
at com.atlassian.bamboo.agent.bootstrap.ClasspathBuilder.getRemoteResources(ClasspathBuilder.java:128)
at com.atlassian.bamboo.agent.bootstrap.ClasspathBuilder.build(ClasspathBuilder.java:66)
at com.atlassian.bamboo.agent.bootstrap.AgentContext.getClassLoader(AgentContext.java:350)
at com.atlassian.bamboo.agent.bootstrap.AgentContext.initServerSession(AgentContext.java:105)
at com.atlassian.bamboo.agent.bootstrap.AgentContext.run(AgentContext.java:94)
at com.atlassian.bamboo.agent.bootstrap.AgentBootstrap.run(AgentBootstrap.java:95)
at com.atlassian.bamboo.agent.elastic.client.ElasticAgentBootstrap.run(ElasticAgentBootstrap.java:72)

Bamboo Server log atlassian-bamboo.log Will throw the following errors when initialising agents:

2017-11-23 13:49:13,302 INFO [http-nio-8085-exec-16] [RemoteAgentManagerImpl] A remote agent is loading on localhost (127.0.0.1).
2017-11-23 13:49:13,337 ERROR [http-nio-8085-exec-20] [FiveOhOh] 500 Exception was thrown.
io.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.RuntimeException: Unexpected exception
	at io.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:156)
	at io.atlassian.util.concurrent.LazyReference.get(LazyReference.java:116)
	at io.atlassian.util.concurrent.ResettableLazyReference.get(ResettableLazyReference.java:95)
	at com.atlassian.bamboo.agent.classserver.AgentClassServerImpl.getJarsOnSystemClasspath(AgentClassServerImpl.java:132)
	at com.atlassian.bamboo.agent.classserver.cacheable.CacheableClasspathServlet.getCollectionDefinition(CacheableClasspathServlet.java:228)
	at com.atlassian.bamboo.agent.classserver.cacheable.CacheableClasspathServlet.doGet(CacheableClasspathServlet.java:116)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Unexpected exception
	at com.atlassian.bamboo.util.BambooObjectUtils.asRuntimeException(BambooObjectUtils.java:119)
	... 164 more
Caused by: java.io.IOException: Could not create file: /opt/atlassian/atlassian-bamboo-6.2.2/temp/jarFromResource2315370522715717862.jar
	at com.atlassian.bamboo.util.SecureTemporaryFiles.createSecureTempFile(SecureTemporaryFiles.java:247)
	at com.atlassian.bamboo.util.SecureTemporaryFiles.create(SecureTemporaryFiles.java:197)
	at com.atlassian.bamboo.agent.classserver.ClasspathDiscovererImpl.createJarFromResource(ClasspathDiscovererImpl.java:153)
	... 170 more
Caused by: java.io.IOException: Permission denied
	at java.io.UnixFileSystem.createFileExclusively(Native Method)
	at java.io.File.createNewFile(File.java:1012)
	at com.atlassian.bamboo.util.SecureTemporaryFiles.createSecureTempFile(SecureTemporaryFiles.java:245)
	... 172 more

Cause

The user account that started the Bamboo Server process does not have permission to write to its declared temporary directory and generate the necessary files to send to the Agent.

Resolution

Fix the permissions of Bamboo's temporary location to allow the Bamboo service account to write to it. That location defaults to <bamboo-install>/temp and should be owned and have read/write/exec permissions set to the Bamboo user account.

It is advisable to review the complete permissions of both <bamboo-home> and <bamboo-install> folders to guarantee that the Bamboo service account owns such locations and can safely write to them.


Depending on how your Java environment on your Bamboo Server is set, different values for the java.io.tmpdir property may be configured. You may have to provide write access to a custom location on your Bamboo Server. Check the following KB article to validate if you are using a customised java.io.tmpdir:

Last modified on Jun 6, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.