Must-share information (formatted with Markdown):
I am trying to upgrade from sonarqube community edition 9.5 to 9.6
There is no wrapper.conf file
There is no RUN_AS_USER option in bin/linux-x86-64/sonar.sh
when I start sonar.sh console I get
uncaught exception in thread [main]
java.lang.RuntimeException: can not run elasticsearch as root
Thank Ann for responding. How about to change the user that run the service.
I used to comment out the line which has RUN_AS_USER=“sonar”
installation_folder/bin/linux-x86-64/sonar.sh
but this is not available in 9.6
What’s the right way to upgrade? I see multiple issues:
The upgrade notes mentioned by G Ann Campbell show something about windows, not linux. So based on the upgrade notes, linux should not be involved. But it is
The command mentioned in Operating the Server | SonarQube Docs is way different than the command in sonar.sh (HAZELCAST_ADDITIONAL is missing for example)
We are also facing same issue, as we have upgraded our SonarQube DataCenter Edition from v9.4 to v9.6 and now we are facing same issue.
Earlier we were used to run the sonarqube service as a init service and in the sonar.sh file we have mentioned RUN_AS_USER= so that on every server restart the corresponding sonarqube services get autostarted.
same problem here: still no RUN_AS_USER in
sonarqube-9.6.1.59531/bin/linux-x86-64/sonar.sh
root@Ubuntu-server:/opt# uname -a
Linux jenkinsretailer 5.15.0-46-generic #49-Ubuntu SMP Thu Aug 4 18:03:25 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
root@Ubuntu-Server:/opt# nano -w sonarqube-9.6.1.59531/bin/linux-x86-64/sonar.sh
root@Server:/opt# chown -R sonar:sonar sonarqube-9.6.1.59531/
root@Ubuntu-Server:/opt# sonarqube-9.6.1.59531/bin/linux-x86-64/sonar.sh console
/usr/bin/java
Running SonarQube...
2022.08.30 20:43:47 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube-9.6.1.59531/temp
2022.08.30 20:43:47 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:33913]
2022.08.30 20:43:47 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [/opt/sonarqube-9.6.1.59531/elasticsearch]: /opt/sonarqube-9.6.1.59531/elasticsearch/bin/elasticsearch
2022.08.30 20:43:47 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2022.08.30 20:43:49 ERROR es[][o.e.b.ElasticsearchUncaughtExceptionHandler] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170) ~[elasticsearch-7.17.4.jar:7.17.4]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:157) ~[elasticsearch-7.17.4.jar:7.17.4]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77) ~[elasticsearch-7.17.4.jar:7.17.4]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112) ~[elasticsearch-cli-7.17.4.jar:7.17.4]
at org.elasticsearch.cli.Command.main(Command.java:77) ~[elasticsearch-cli-7.17.4.jar:7.17.4]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:122) ~[elasticsearch-7.17.4.jar:7.17.4]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) ~[elasticsearch-7.17.4.jar:7.17.4]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:107) ~[elasticsearch-7.17.4.jar:7.17.4]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:183) ~[elasticsearch-7.17.4.jar:7.17.4]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434) ~[elasticsearch-7.17.4.jar:7.17.4]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:166) ~[elasticsearch-7.17.4.jar:7.17.4]
... 6 more
uncaught exception in thread [main]
java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:107)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:183)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:166)
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:157)
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:122)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)
For complete error details, refer to the log at /opt/sonarqube-9.6.1.59531/logs/sonarqube.log
2022.08.30 20:43:49 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 1
2022.08.30 20:43:49 INFO app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2022.08.30 20:43:49 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
On server reboot, application is not attempting for sonar service start, i have verified the logs as well there is only entry for service stopping not for attempting for start.
just pay attention to /opt/sonar/lib/sonar-application-9.6.1.59531.jar to be the correct path according to where you install sonarqube.
and to this /opt/java11-latest/bin/java according where you have your java
I suppose you have sonar user. pay attention that you have user as sonar or sonarqube
same as your database user