Upgrading Sonarqube from 9.1 to 9.9LTS but getting error

Make sure to tell us:

  • What version are you upgrading from?- 9.1 to 9.9 LTS

  • System information (Operating system, Java version, Database provider/version)
    – OS: NAME=“Amazon Linux”
    VERSION="2
    ID=“amzn”
    ID_LIKE=“centos rhel fedora”
    VERSION_ID=“2”
    PRETTY_NAME=“Amazon Linux 2”
    ANSI_COLOR=“0;33”
    CPE_NAME=“cpe:2.3:o:amazon:amazon_linux:2”
    Java17
    DB: Postgres 10

  • What’s the issue you’re facing?

Post starting sonar its gets automatically killed. Elastichsearch exited with 1 as per logs.
Logs:
tail -f es.log
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112) ~[elasticsearch-cli-7.17.8.jar:7.17.8]
at org.elasticsearch.cli.Command.main(Command.java:77) ~[elasticsearch-cli-7.17.8.jar:7.17.8]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:125) ~[elasticsearch-7.17.8.jar:7.17.8]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) ~[elasticsearch-7.17.8.jar:7.17.8]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:107) ~[elasticsearch-7.17.8.jar:7.17.8]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:183) ~[elasticsearch-7.17.8.jar:7.17.8]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434) ~[elasticsearch-7.17.8.jar:7.17.8]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:169) ~[elasticsearch-7.17.8.jar:7.17.8]
… 6 more

tail -f sonar.log
2023.10.17 13:10:22 WARN app[o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 1
2023.10.17 13:10:22 INFO app[o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2023.10.17 13:10:22 INFO app[o.s.a.SchedulerImpl] SonarQube is stopped
2023.10.17 13:24:37 INFO app[o.s.a.AppFileSystem] Cleaning or creating temp directory /apps/sonarqube/temp
2023.10.17 13:24:37 INFO app[o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:46417]
2023.10.17 13:24:38 INFO app[o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [/apps/sonarqube/elasticsearch]: /apps/sonarqube/elasticsearch/bin/elasticsearch
2023.10.17 13:24:38 INFO app[o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2023.10.17 13:24:41 WARN app[o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 1
2023.10.17 13:24:41 INFO app[o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2023.10.17 13:24:41 INFO app[o.s.a.SchedulerImpl] SonarQube is stopped

tail -f nohup.log
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:160)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)
at org.elasticsearch.cli.Command.main(Command.java:77)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:125)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)
For complete error details, refer to the log at /apps/sonarqube/logs/sonarqube.log
2023.10.17 13:24:41 WARN app[o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 1
2023.10.17 13:24:41 INFO app[o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2023.10.17 13:24:41 INFO app[o.s.a.SchedulerImpl] SonarQube is stopped

Welcome :slight_smile:

see Operating the server

You cannot run SonarQube as root in Unix systems. Ideally, you will have created a new account dedicated to the purpose of running SonarQube.

Gilbert

hi Gilbert, We have already running sonarqube of old version. One dedicated user already aaded with sonar & we have given chown -R sonar:sonar to it.

drwxr-xr-x 11 sonar sonar 4096 Oct 17 07:31 sonarqube

what changes have to do for this…?

see Search results for 'can not run elasticsearch as root' - Sonar Community
for details and solutions

I have read I tried all solutions as mentioned in Search results for ‘can not run elasticsearch as root’ - Sonar Community

Not able to resolve issue, Multiple guys having same issue as me.
Can i get some specific solution?

The error message

“Caused by: java.lang.RuntimeException: can not run elasticsearch as root”

is quite explicit.

Can’t help further because I don’t know any other solutions than the ones already mentioned in the search.