While initiating upgrade on the Windows Server FMS having embedded PostgreSQL repository, installer fails with the error "initdb exited with error code 1".
Upgrade installer log will show an error message like:
yyyy-mm-dd hh:mm:ss.xxx VERBOSE [ProcessReader-1] initdb/STDERR - initdb: error: could not open file "C:\Windows\Temp\I1756977406\~postgres~pw~3964767007483036435.txt" for reading: Permission denied
The issue arises even when the user account running the installer, is the same one used for installing Foglight initially with embedded PostgreSQL repository, with the same original permissions.
This user also has full permissions on the entire volume and can create, delete and modify files on the Temp folder.
The issue happens when the Foglight upgrade installer is triggered via PsExec utility in command prompt.
In normal circumstances, the install log shows the java.class.path and ZGUtil.CLASS_PATH values set to, and all temp operations during the upgrade usually happen in paths like:
C:\Users\<user>\AppData\Local\Temp\2\I1752654618
Including the PostgreSQL pwfile. For example:
VERBOSE [Thread-34] com.quest.nitro.db.PostgreSQLEmbeddedDatabaseHandler - Executing: [C:\Quest\Foglight\postgresql_dist\bin\initdb.exe, -D, C:\Quest\Foglight\state\postgresql-data_new, --auth=password, --encoding=UTF8, --locale=C, -U, root, --pwfile, C:\Users\Administrator\AppData\Local\Temp\2\I1752654618\~postgres~pw~8256109803334424050.txt]
However, when the upgrade installer is executed via PsExec, all the paths under java.class.path and ZGUtil.CLASS_PATH were set to, including temp operations happening under the location:
C:\Windows\Temp
This causes the upgrade installer to fail, returning the aforementioned error.
Instead of using PsExec to execute the upgrade installer, move the executable file to the FMS machine.
Right click on the installer file and run as administrator to initiate the upgrade wizard.