SonarQube - Temp directory is not writable

Chris Harris picture Chris Harris · Mar 12, 2015 · Viewed 9.2k times · Source

I'm installing SonarQube v5.0.1.

I'm running Windows Server 2012 64-bit, Java 1.8 64-bit, and the SonarQube windows-x86-64 wrapper.

SonarQube keeps throwing the following error:

WrapperSimpleApp: Encountered an error running main: java.lang.IllegalStateException: Temp directory is not writable: C:\Windows\system32\config\systemprofile\AppData\Local\Temp\
java.lang.IllegalStateException: Temp directory is not writable: C:\Windows\system32\config\systemprofile\AppData\Local\Temp\
    at org.sonar.process.MinimumViableSystem.checkWritableDir(MinimumViableSystem.java:60)
    at org.sonar.process.MinimumViableSystem.checkWritableTempDir(MinimumViableSystem.java:52)
    at org.sonar.process.MinimumViableSystem.check(MinimumViableSystem.java:45)
    at org.sonar.application.App.main(App.java:113)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: The system cannot find the path specified
    at java.io.WinNTFileSystem.createFileExclusively(Native Method)
    at java.io.File.createTempFile(Unknown Source)
    at org.sonar.process.MinimumViableSystem.checkWritableDir(MinimumViableSystem.java:57)
    ... 9 more
<-- Wrapper Stopped

Why does SonarQube keep trying to write to C:\Windows\System32\config\systemprofile\AppData\Local instead of C:\Windows\SysWOW64\config\systemprofile\AppData\Local?

To get rid of this error in previous installations, I've had to create a Temp folder in C:\Windows\System32\config\systemprofile\AppData\Local and fiddle with the read/write settings and or permissions to get SonarQube to stop complaining.

UPDATE: This is a huge problem, because I can't start SonarQube as a Windows Service. What's weird is that I already had SonarQube installed and running as a Windows Service. Today, I stopped the service, and now I can't start the service anymore. I've set the Temp folder's permissions to be not Read-Only and so that Everyone has Full Control (not ideal, I know...)

Still, the Temp error prevents SonarQube from starting.

Answer

Tom Howard picture Tom Howard · May 11, 2015

This can also be fixed by setting the java.io.tmpdir java property to a writable directory. e.g., in conf/wrapper.conf change

wrapper.java.additional.1=-Djava.awt.headless=true

to

wrapper.java.additional.1=-Djava.awt.headless=true -Djava.io.tmpdir=E:/sonarqube-5.1/temp