When using the root user, Search server cannot be started due to "don't run <search server> as root"
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
Problem
Search server cannot be started, therefore Bitbucket Server cannot connect to it.
The following appears in the console output when running the start-search.sh
or the start-bitbucket.sh
script or the :
root@myserver:# cd /opt/atlassian/bitbucket/bin/
root@myserver:/opt/atlassian/bitbucket/bin# sh start-search.sh
Starting Elasticsearch bundled with Atlassian Bitbucket
BITBUCKET_HOME set to /var/atlassian/application-data/bitbucket
-e Starting Elasticsearch bundled with Atlassian Bitbucket as current user
-e
Elasticsearch bundled with Atlassian Bitbucket started successfully
root@myserver:/opt/atlassian/bitbucket/bin# Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root.
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:93)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:144)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:270)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.
Diagnosis
Environment
- Operating system: Unix based
Cause
Search server cannot be run as root.
Resolution
- Login as the
atlbitbucket
user, or for some installations, bitbucket user - Run the start script