Sonar.sh Elastic search fatal exception while booting Elasticsearch

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube Server / Community Build
  • how is SonarQube deployed: zip version 25.5.0.107428
  • java --version OpenJDK Runtime Environment (build 17.0.15+6-Ubuntu-0ubuntu120.04)
    OpenJDK 64-Bit Server VM (build 17.0.15+6-Ubuntu-0ubuntu120.04, mixed mode, sharing)

./sonar.sh console

Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:33757]
2025.06.03 06:14:09 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [/opt/sonarqube-10.5.1.90531/elasticsearch]: /usr/lib/jvm/java-17-openjdk-amd64/bin/java -Xms4m -Xmx64m -XX:+UseSerialGC -Dcli.name=server -Dcli.script=./bin/elasticsearch -Dcli.libs=lib/tools/server-cli -Des.path.home=/opt/sonarqube-10.5.1.90531/elasticsearch -Des.path.conf=/opt/sonarqube-10.5.1.90531/temp/conf/es -Des.distribution.type=tar -cp /opt/sonarqube-10.5.1.90531/elasticsearch/lib/*:/opt/sonarqube-10.5.1.90531/elasticsearch/lib/cli-launcher/* org.elasticsearch.launcher.CliToolLauncher
2025.06.03 06:14:09 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2025.06.03 06:14:13 ERROR es[][o.e.b.Elasticsearch] fatal exception while booting Elasticsearch
java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Elasticsearch.initializeNatives(Elasticsearch.java:282) ~[elasticsearch-8.11.0.jar:?]
        at org.elasticsearch.bootstrap.Elasticsearch.initPhase2(Elasticsearch.java:167) ~[elasticsearch-8.11.0.jar:?]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:72) ~[elasticsearch-8.11.0.jar:?]
ERROR: Elasticsearch did not exit normally - check the logs at /opt/sonarqube/logs/sonarqube.log

ERROR: Elasticsearch exited unexpectedly, with exit code 1
2025.06.03 06:14:13 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 1
2025.06.03 06:14:13 INFO  app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2025.06.03 06:14:13 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped

Please help me to fix this issue

es.log (6.8 KB)
nohup.log (1.6 KB)
sonar.log (12.9 KB)

Hi,

The error excerpted in your first post is pretty clear:

You’ll need to set up a different user to run SonarQube as so that its child Elasticsearch process will run as that non-root user.

 
HTH,
Ann

es.log (2.3 KB)
sonar.log (4.4 KB)
I’m also trying run with user sonar. Sonarqube also didn’t started

Hi,

This looks like exactly the same error:

2025.06.20 10:26:25 ERROR es[][o.e.b.Elasticsearch] fatal exception while booting Elasticsearch
java.lang.RuntimeException: can not run elasticsearch as root

 
Ann