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.

Summary

Bamboo Remote or Elastic Agent startup fails with permission denied failure reported on the Bamboo Server logs

Diagnosis

When starting a Remote or Elastic Agent, the start-up 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 agent fails to startup with the following error: 

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 have the following errors: 

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 who started the Bamboo Agent process does not have permission to write to the temporary directory and generate the necessary libraries to send to the remote agent for successful installation/start-up.

Resolution

Linux:

  1. Fix the Bamboo Agent files using the correct account. Make sure that the user running the Bamboo Agent process has permission to write recursively to the /tmp and <bamboo-agent-home> directories on Linux
  2. # Get the user running the Bamboo java process
    $ ps aux | grep java | grep bamboo | awk '{ print $1 }'
     
    # Correct ownership on Bamboo installation directory
    $ chown -R bamboo-user /path/to/bamboo-agent-home
  3. Restart the Bamboo Agent

Windows:

  1. When on Windows, you will need to make the appropriate modifications to the Windows ACL (Right Click Folder > Properties > Security)
  2. Make sure that the user running the Bamboo Agent process has permission to write recursively to the <bamboo-user-home>\Appdata\Local\Temp and <bamboo-agent-home> folders on Windows
  3. Restart the Bamboo Agent


Depending on how your Java environment on your Bamboo Agent is configured, it uses different values for the java.io.tmpdir property. You need to provide write access to that location to your Bamboo Agent.

Last modified on Apr 4, 2022

Was this helpful?

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