Resolve ElasticSearch Startup Error in Bitbucket Data Center
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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
Elasticsearch service fails to start with the 'Error opening log file 'logs/gc.log': Permission denied' error.
Environment
Bitbucket Server 7.6.0 with Bundled ES. It can happen in any version of Bitbucket.
Diagnosis
Exception in thread "main" java.lang.RuntimeException: starting java failed with [1]
Nov 13 17:19:25 sso-services-ppr start-bitbucket.sh[16873]: output:
Nov 13 17:19:25 sso-services-ppr start-bitbucket.sh[16873]: [0.002s][error][logging] Error opening log file 'logs/gc.log': Permission denied
Nov 13 17:19:25 sso-services-ppr start-bitbucket.sh[16873]: [0.002s][error][logging] Initialization of output 'file=logs/gc.log' using options 'filecount=5,filesize=20M' failed.
Cause
The Bitbucket installation folder - /$BITBUCKET_INSTALL/elasticsearch/logs -
doesn't have the write permissions for the Bitbucket user.
Solution
Confirm Bitbucket user owns the directory by running
chown -R atlbitbucket:atlbitbucket *
Change the permission of the folder above to have write permissions for the Bitbucket user by running
chmod 755
Was this helpful?