When installing a remote agent, the agent home value is not properly set and a different path is used
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
When a user runs the official command to install a new remote agent, also specifying a home directory, a different home directory is used instead.
Environment
Any supported version of Bamboo.
Any supported environment to install remote agents.
Diagnosis
To describe this example, we will install a remote agent in Linux. The example command is as follows:
java -Dbamboo.home=/var/agent-home -jar atlassian-bamboo-agent-installer-x.x.x.jar <Bamboo Base URL>/agentServer/
The agent is installed and in the logs we then see:
INFO | jvm 1 | 2022/03/30 11:42:53 | 2022-03-30 11:42:53,904 INFO [WrapperSimpleAppMain] [RemoteAgentHomeLocatorForBootstrap] Using agent home located at [/var/differentDirectory]
Cause
As far as we have observed, there are 2 known causes for this problem:
Cause 1
There is a formatting error in the command, and the java argument is not properly loaded.
Cause 2
The installation process creates the file conf/wrapper.conf, which contains a lot of information, including the absolute path to the home directory. If the file already exists prior to the command execution, then there will be mismatches in the installation.
This is a common scenario when the installation process is automated and there is a pre-existing home directory (for example, in a Docker image).
Solution
Make sure you are installing the agent in a clean empty directory.