Cannot start sonarqube (8.9) - es not starting

hey!
im upgrading to sonarqube 8.9 - and keep getting this:

→ Wrapper Started as Daemon
Launching a JVM…
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.

2021.09.09 10:40:29 INFO app[o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube-8.9.2.46101/temp
2021.09.09 10:40:29 INFO app[o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:46712]
2021.09.09 10:40:29 ERROR app[o.s.a.p.ManagedProcessHandler] Fail to launch process [es]
java.lang.IllegalStateException: Could not delete Elasticsearch temporary conf directory
at org.sonar.application.ProcessLauncherImpl.pruneElasticsearchConfDirectory(ProcessLauncherImpl.java:168)
at org.sonar.application.ProcessLauncherImpl.writeConfFiles(ProcessLauncherImpl.java:155)
at org.sonar.application.ProcessLauncherImpl.launch(ProcessLauncherImpl.java:92)
at org.sonar.application.SchedulerImpl.lambda$tryToStartProcess$2(SchedulerImpl.java:196)
at org.sonar.application.process.ManagedProcessHandler.start(ManagedProcessHandler.java:73)
at org.sonar.application.SchedulerImpl.tryToStartProcess(SchedulerImpl.java:194)
at org.sonar.application.SchedulerImpl.tryToStartEs(SchedulerImpl.java:146)
at org.sonar.application.SchedulerImpl.tryToStartAll(SchedulerImpl.java:138)
at org.sonar.application.SchedulerImpl.schedule(SchedulerImpl.java:112)
at org.sonar.application.App.start(App.java:68)
at org.sonar.application.App.main(App.java:97)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.nio.file.AccessDeniedException: /opt/sonarqube-8.9.2.46101/temp/conf/es
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
at java.base/sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:249)
at java.base/sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:110)
at java.base/java.nio.file.Files.deleteIfExists(Files.java:1181)
at org.sonar.application.ProcessLauncherImpl.pruneElasticsearchConfDirectory(ProcessLauncherImpl.java:166)
… 16 common frames omitted
2021.09.09 10:40:29 INFO app[o.s.a.SchedulerImpl] Process[es] is stopped
2021.09.09 10:40:29 INFO app[o.s.a.SchedulerImpl] SonarQube is stopped
2021.09.09 10:40:29 INFO app[o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
← Wrapper Stopped
→ Wrapper Started as Daemon
Launching a JVM…
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.

2021.09.09 10:43:05 INFO app[o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube-8.9.2.46101/temp
2021.09.09 10:43:05 INFO app[o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:36003]
2021.09.09 10:43:05 ERROR app[o.s.a.p.ManagedProcessHandler] Fail to launch process [es]
java.lang.IllegalStateException: Could not delete Elasticsearch temporary conf directory
at org.sonar.application.ProcessLauncherImpl.pruneElasticsearchConfDirectory(ProcessLauncherImpl.java:168)
at org.sonar.application.ProcessLauncherImpl.writeConfFiles(ProcessLauncherImpl.java:155)
at org.sonar.application.ProcessLauncherImpl.launch(ProcessLauncherImpl.java:92)
at org.sonar.application.SchedulerImpl.lambda$tryToStartProcess$2(SchedulerImpl.java:196)
at org.sonar.application.process.ManagedProcessHandler.start(ManagedProcessHandler.java:73)
at org.sonar.application.SchedulerImpl.tryToStartProcess(SchedulerImpl.java:194)
at org.sonar.application.SchedulerImpl.tryToStartEs(SchedulerImpl.java:146)
at org.sonar.application.SchedulerImpl.tryToStartAll(SchedulerImpl.java:138)
at org.sonar.application.SchedulerImpl.schedule(SchedulerImpl.java:112)
at org.sonar.application.App.start(App.java:68)
at org.sonar.application.App.main(App.java:97)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.nio.file.AccessDeniedException: /opt/sonarqube-8.9.2.46101/temp/conf/es
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
at java.base/sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:249)
at java.base/sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:110)
at java.base/java.nio.file.Files.deleteIfExists(Files.java:1181)
at org.sonar.application.ProcessLauncherImpl.pruneElasticsearchConfDirectory(ProcessLauncherImpl.java:166)
… 16 common frames omitted
2021.09.09 10:43:05 INFO app[o.s.a.SchedulerImpl] Process[es] is stopped
2021.09.09 10:43:05 INFO app[o.s.a.SchedulerImpl] SonarQube is stopped
2021.09.09 10:43:05 INFO app[o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
← Wrapper Stopped
this is critical! can anyone help?

Hello Guy Franco,

since you can’t start SonarQube I would consider it critical. In the previous, now deleted, thread you mentioned that you changed the permissions with chmod/chown, right? This would explain why you get the error “Could not delete Elasticsearch temporary conf directory”. In that case I would simply recommend to redownload SonarQube.

actually i managed to go forward by deleting the conf folder under elasticsearch , but now im having this issue:
ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
bootstrap check failure [1] of [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
ERROR: Elasticsearch did not exit normally - check the logs at /opt/sonarqube-8.9.2.46101/logs/sonarqube.log
2021.09.09 10:51:52 WARN app[o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 78

Deleting the configuration folder of Elasticsearch is certainly not recommended. Like I said before, I would recommend to simply redownload SonarQube.

In case that the problem persists afterwards, vm.max_map_count can be set with sysctl. You can set it in /etc/sysctl.conf or with the sysctl binary.

i managed to get it up - BUT, it was using mysql - i needed to install postgres for this to work, made the scheme, user, gave permissions - and added in sonarproperties- is there a way to migrate from the old data base to the new?
i was under the impression this is done in the setup window when the UI comes up

Hi @guy2 ,

I think you already had a similar discussion before right?

sonarqube with mysql is not supported since 7.9 (announcement). If you want to move your data from mysql to postresql you will need to do it on 7.8. there is a guide how to do it in the announcement of this change.

yes- but, unfortunately the Sonar service at hand is 5.2 , not supported by the script, any other way?

SonarQube 5.2 was released in 2015 and is waaayyyy EOL. you will need to upgrade and version jump to 7.8 if you want to keep your data.
as this version of sonarqube is over 5 years old i can not find any upgrade guide that would fit 5.2, but here is the oldest one i could find: Release 5.6 Upgrade Notes - SonarQube-6.7

good luck

yes it a very old instance - another question, upgraded now to 7.8, same mysql (just updated the version a little) - old sonar connects to the DB fine, new 7.8 does not - ive copied the sonar properties relevant lines into the new sonar properties. web logs says cannot connect to db - old one can… any idea what can be done?

probably due to database configuration. on mysql you give permissions on a username@ip basis. check out this guide here.

you should btw to a backup before trying to do a upgrade on this database. i think you need to version hop.

this is not working, is there any way to chat with someone? (we are paying for license)

Hello Guy,

If your License includes access to commercial support, you may file a support ticket from our ServiceDesk portal

Please note SonarSource provides support from 9:00am - 6:00pm CEST (Central European Summer Time) Monday - Friday, and we provide Support exclusively through the ServiceDesk web interface linked above

i upgraded the mysql service - but still old sonar qube connects fine new one does not- and a followed the manual- is there more help that can be provided?

Hi! I know that it’s and old reported issue but in case that someone is struggling with something like this here is what I found.

Once you run sonarqube as root user it cannot delete some temporary dirs (ie. elasticsearch). From ElasticSearch docs we know that:

By default, Elasticsearch will create its temporary directory within /tmp . However, some hardened Linux installations mount /tmp with the noexec option by default. This prevents JNA and libffi from working correctly. For instance, at startup JNA may fail to load with a java.

So…under /tmp directory (it’s a system directory not the one that is under sonarqube installation directory) you will find some directories created at the same time that the sonarqube execution started. Something named like hsperfdata**_root**… then you can remove it (sudo rm -r hsperfdata_root) and next time you start sonarqube it should work as usual.

Regards,