We have installed SonarQube 9,4 on a Windows 2019 server.
It starts perfectly when we run the StartSonar.bat from a command prompt window that is run as Administrator.
However having then created the service using the command in the SQ documentation and running the service under a service account.
At this point it starts and then stops immediately with the following error:
--> Wrapper Started as Service
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
2022.06.06 10:08:56 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory I:\Apps\Sonar\SonarQube\temp
2022.06.06 10:08:56 DEBUG app[][o.s.a.NodeLifecycle] WrapperSimpleAppMain tryToMoveTo from INIT to STARTING => true
2022.06.06 10:08:56 DEBUG app[][o.s.a.p.ManagedProcessLifecycle] WrapperSimpleAppMain tryToMoveTo ElasticSearch from INIT to STARTING => true
2022.06.06 10:08:56 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:64767]
2022.06.06 10:08:56 ERROR app[][o.s.a.p.ManagedProcessHandler] Failed to launch process **[ElasticSearch]**
**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:197)
at org.sonar.application.process.ManagedProcessHandler.start(ManagedProcessHandler.java:76)
at org.sonar.application.SchedulerImpl.tryToStartProcess(SchedulerImpl.java:195)
at org.sonar.application.SchedulerImpl.tryToStartEs(SchedulerImpl.java:147)
at org.sonar.application.SchedulerImpl.tryToStartAll(SchedulerImpl.java:139)
at org.sonar.application.SchedulerImpl.schedule(SchedulerImpl.java:113)
at org.sonar.application.App.start(App.java:59)
at org.sonar.application.App.main(App.java:81)
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:834)
Caused by: java.nio.file.AccessDeniedException: I:\Apps\Sonar\SonarQube\temp\conf\es
at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
at java.base/sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:274)
at java.base/sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:110)
at java.base/java.nio.file.Files.deleteIfExists(Files.java:1180)
at org.sonar.application.ProcessLauncherImpl.pruneElasticsearchConfDirectory(ProcessLauncherImpl.java:166)
... 16 common frames omitted
2022.06.06 10:08:56 DEBUG app[][o.s.a.p.ManagedProcessLifecycle] WrapperSimpleAppMain tryToMoveTo ElasticSearch from STARTING to STOPPING => true
2022.06.06 10:08:56 DEBUG app[][o.s.a.p.ManagedProcessLifecycle] WrapperSimpleAppMain tryToMoveTo ElasticSearch from STOPPING to FINALIZE_STOPPING => true
2022.06.06 10:08:56 INFO app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2022.06.06 10:08:56 DEBUG app[][o.s.a.p.ManagedProcessLifecycle] WrapperSimpleAppMain tryToMoveTo ElasticSearch from FINALIZE_STOPPING to STOPPED => true
2022.06.06 10:08:56 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2022.06.06 10:08:56 DEBUG app[][o.s.a.NodeLifecycle] HardStopper-0 tryToMoveTo from STARTING to HARD_STOPPING => true
2022.06.06 10:08:56 DEBUG app[][o.s.a.p.ManagedProcessLifecycle] HardStopper-0 tryToMoveTo Compute Engine from INIT to HARD_STOPPING => false
2022.06.06 10:08:56 DEBUG app[][o.s.a.p.ManagedProcessLifecycle] HardStopper-0 tryToMoveTo Web Server from INIT to HARD_STOPPING => false
2022.06.06 10:08:56 DEBUG app[][o.s.a.p.ManagedProcessLifecycle] HardStopper-0 tryToMoveTo ElasticSearch from STOPPED to HARD_STOPPING => false
2022.06.06 10:08:56 DEBUG app[][o.s.a.NodeLifecycle] HardStopper-0 tryToMoveTo from HARD_STOPPING to FINALIZE_STOPPING => true
2022.06.06 10:08:56 DEBUG app[][o.s.a.NodeLifecycle] HardStopper-0 tryToMoveTo from FINALIZE_STOPPING to STOPPED => true
2022.06.06 10:08:56 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
2022.06.06 10:08:56 DEBUG app[][o.s.a.NodeLifecycle] Shutdown Hook tryToMoveTo from STOPPED to STOPPING => false
<-- Wrapper Stopped
The issue seems to be permissions on the elastic search conf folder, however on a previous installation (7.9) we have not set any specific permissions for the service account or folders.
I have searched the Community forum and the only solution I can see is to re-install Windows 2019 which seems a bit drastic!!
Any help would really be appreciated
Thanks