Update to sonarqube-9.6.0.59041 missing files

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

because I have no option to change default user.

Hi,

Welcome to the community!

With 9.6, dropped the service wrapper we’d been using for years. The Upgrade Notes should help.

 
Ann

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

Hi,

How are you running SonarQube? What OS? And from the zip or Docker?

 
Ann

I run sonarqube:
/opt/sonarqube-9.6.0.59041/bin/linux-x86-64/sonar.sh start

OS: ubuntu server 22.04
Linux ServerName 5.15.0-41-generic #44-Ubuntu SMP Wed Jun 22 14:20:53 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

I download the zip file then unzip

Hi, any good news about it?

I have the same problem,

Thanks

What’s the right way to upgrade? I see multiple issues:

  1. 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
  2. The version mentioned in Operating the Server | SonarQube Docs is 8.5 instead of 9.6
  3. The command mentioned in Operating the Server | SonarQube Docs is way different than the command in sonar.sh (HAZELCAST_ADDITIONAL is missing for example)
  4. There’s no way to choose a RUN_AS_USER user

So please provide a working solution for linux.

Hi,

Any update for the files in the last version?

Hi,

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.

Thanks,
Prince

Hi all,

SonarQube 9.6.1 addresses this & should appear on the Downloads page today.

@Prince, welcome to the community! As a Data Center user, you have access to professional support. You’d probably be better off with them.

 
HTH,
Ann

thanks ganncamp for replying, can you pls share the mentioned Downloads pages link where i can see the updates.

Hi,

The downloads page hasn’t been updated yet. I expect that to happen later today: Download | SonarQube

 
Ann

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

Hi Ann,

We have tested but still can’t find RUN_AS_USER option on 9.6.1 version, can you pls reverify.

Hi all,

I guess you’re all using initd to run your service? Have you considered systemd?

Alternatively, you could update /etc/init.d/sonar to

su $RUN_AS_USER -c "/usr/bin/sonar $*"

 
Ann

Hi Ann,

We have tested this workaround but the sonar service is not starting on server reboot.

Thanks
Prince

Hi Prince,

Any indication why?

Also, I’ve flagged this for more expert attention.

 
Ann

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.

Thanks

Here is what to do:

create a file in /etc/systemd/system/sonarqube.service

# nano -w /etc/systemd/system/sonarqube.service
[Unit]
Description=SonarQube service
After=syslog.target network.target

[Service]
Type=simple
User=sonar
Group=sonar
PermissionsStartOnly=true
ExecStart=/opt/java11-latest/bin/java -Xms32m -Xmx4000m -Djava.net.preferIPv4Stack=true -jar /opt/sonar/lib/sonar-application-9.6.1.59531.jar
StandardOutput=syslog
LimitNOFILE=131072
LimitNPROC=8192
TimeoutStartSec=5
Restart=always
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

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

# systemctl daemon-reload
# systemctl start sonarqube.service
# systemctl enable sonarqube.service
2 Likes

@Ahmad_Abu_Hashem Is it working for you as for me with the similar configuration throwing below errors on logs after server reboot:

sonarqube.service: main process exited, code=exited, status=216/GROUP

Thanks,