Bitbucket Server home path cannot be created
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
Symptoms
On first accessing Bitbucket Server during installation, an error like the following is shown:
A fatal error has occurred
The following problem occurred which prevents Atlassian Bitbucket from starting correctly:
- Bitbucket Home [<BITBUCKET_HOME>] cannot be created or Bitbucket does not have permission to access it
Other similar error messages may be:
- Bitbucket Server Home [<BITBUCKET_HOME>] is not a directory
- Bitbucket Server Home [<BITBUCKET_HOME>] exists but is not readable by Bitbucket Server
- Bitbucket Server Home [<BITBUCKET_HOME>] exists but is not writable by Bitbucket Server
- Bitbucket Server Home [<BITBUCKET_HOME>] exists but is not accessible by Bitbucket Server (no execute permission)
- Bitbucket Server Home [<BITBUCKET_HOME>] cannot be created or Bitbucket Server does not have permission to access it
The Bitbucket Server home directory is where your Bitbucket Server data is stored.
Diagnosis
All these errors relate to permissions on the directory you have configured for <BITBUCKET_HOME>.
Data Center
Mount options
Make sure you have the correct mount options relative to your other nodes that start correctly.
mount
UID
Bitbucket must have the same UID on all cluster nodes and the shared file system server. It could be that one node has a different UID than the other nodes so it does not have permission to read the files in the shared directory. Check if your installation script accounts for the UID.
To find the UID, look in the /etc/passwd file for that user id. It should be the same on all nodes. You can run this command on all nodes to check this as well:
id -u atlbitbucket
Permissions
In the [<BITBUCKET_HOME>]/shared directory for each node, run the following command:
ls -la
Cause
- Bitbucket Server Home [<BITBUCKET_HOME>] is not a directory
The configured BITBUCKET_HOME already exists but is not a directory.
- Bitbucket Server Home [<BITBUCKET_HOME>] exists but is not readable by Bitbucket Server
The operating system user running Bitbucket Server does not have permission to read the configured BITBUCKET_HOME.
- Bitbucket Server Home [<BITBUCKET_HOME>] exists but is not writable by Bitbucket Server
The operating system user running Bitbucket Server does not have permission to read the configured BITBUCKET_HOME.
- Bitbucket Server Home [<BITBUCKET_HOME>] exists but is not accessible by Bitbucket Server (no execute permission)
The operating system user running Bitbucket Server does not have permission to access the configured BITBUCKET_HOME - on a UNIX style system (including MacOS), this means the user does not have the execute permission.
- Bitbucket Server Home [<BITBUCKET_HOME>] cannot be created or Bitbucket Server does not have permission to access it
On Windows it may be one of the following:- The operating system user running Bitbucket Server does not have permission to create the configured BITBUCKET_HOME.
- The $BITBUCKET_HOME exists, but is within a directory or drive to which the user running Bitbucket Server does not have access.
- The $BITBUCKET_HOME may contain illegal file name characters. (See MSDN: Naming Files, Paths and Namespaces)
- The operating system user running Bitbucket Server does not have permission to create the configured BITBUCKET_HOME.
- The $BITBUCKET_HOME exists, but is within a directory to which the user running Bitbucket Server does not have access.
Bitbucket installation path ($BITBUCKET_INST) may have the wrong permissions or different owner.
- The $BITBUCKET_INST is owned by root user, but must be owned by altbitbucket.
Resolution
Do one of the following:
- Correct the permissions on the directory configured for <BITBUCKET_HOME> so that the operating system user running Bitbucket Server has access, and can read and write. See Bitbucket home directory for instructions on setting <BITBUCKET_HOME>.
- Use a different BITBUCKET_HOME to which the operating system user running Bitbucket Server has access, and can read and write.
- In the case the wrong user is set as owner, run a chown -R to atlbitbucket under the $BITBUCKET_HOME or $BITBUCKET_INST path. In the example, the correct user is altbitbucket, if you are running as a different user, just change it on the chown command.