Sonarqube doesn't start on Centos 8

  • versions used (SonarQube: 8.4)
  • error observed sonar.log:
    ‘’‘sudo tail -f /opt/sonarqube/logs/sonar.log 2020.09.14 10:41:55 INFO app[o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
    2020.09.14 10:41:55 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘es’, ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
    2020.09.14 10:41:55 INFO app[o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
    Java HotSpot™ 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
    2020.09.14 10:41:55 INFO app[o.e.p.PluginsService] no modules loaded
    2020.09.14 10:41:55 INFO app[o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
    2020.09.14 10:41:57 WARN app[o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 1
    2020.09.14 10:41:57 INFO app[o.s.a.SchedulerImpl] Process[es] is stopped
    2020.09.14 10:41:57 INFO app[o.s.a.SchedulerImpl] SonarQube is stopped’’’

‘’‘sudo tail -f /opt/sonarqube/logs/es.log
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.8.0.jar:6.8.0]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.8.0.jar:6.8.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) ~[elasticsearch-6.8.0.jar:6.8.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.8.0.jar:6.8.0]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:103) ~[elasticsearch-6.8.0.jar:6.8.0]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170) ~[elasticsearch-6.8.0.jar:6.8.0]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.8.0.jar:6.8.0]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-6.8.0.jar:6.8.0]’’’

Java version
‘’‘java version “11.0.8” 2020-07-14 LTS
Java™ SE Runtime Environment 18.9 (build 11.0.8+10-LTS)
Java HotSpot™ 64-Bit Server VM 18.9 (build 11.0.8+10-LTS, mixed mode)’’’

Postgresql version: 10

There is no ce.log or web.log file present, I haven’t been able to start the sonarqube, can anyone help me with this?

1 Like

Helloi @shivamprakhar and welcome to the community :wave:

i think you already posted the answer to your question :slight_smile:

Hi Tobias,
(facepalm) I didn’t see it until I mentioned it here. Thanks for this. Now I am searching for how to fix that issue, would you have any reference by chance?

happens to the best of us :slight_smile:
sure. you have to create a new user and run sonarqube as this user. i would suggest to do this via systemd, where you can find more information about here

Although I have created a user account for sonarqube which has all the file permissions for the sonarqube direcotry, not sure if you are referring to add a new user named elasticsearch for this.

how do you try to start sonarqube? the file permissions are one thing but you will need to actually execute the start script as this user

I switch to user account sonarqube and then run the script:
$su - sonarqube
/opt/sonarqube/bin/linux-x86-64/sonar.sh start
Starting SonarQube…
Started SonarQube.
and when I check the es.log I get the same error, I tried this way too, sorry that I didn’t make it clear in the first thread.

can you post the permissions of this user you created? also did you try to use the systemd service as documented?

[Unit]
Description=SonarQube service
After=syslog.target network.target

[Service]
Type=simple
User=sonarqube
Group=sonarqube
PermissionsStartOnly=true
ExecStart=/bin/nohup /usr/bin/java -Xms32m -Xmx32m -Djava.net.preferIPv4Stack=true -jar /opt/sonarqube/lib/sonar-application-8.4.jar
StandardOutput=syslog
LimitNOFILE=65536
LimitNPROC=8192
TimeoutStartSec=5
Restart=always
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

Thanks a ton Tobias, I ran it as a systemd service and it started running. Not sure where I messed up the permission that it didn’t run when I tried to run it as the sonarqube user.

glad that this is working for you now :+1:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.