cancel
Showing results for 
Search instead for 
Did you mean: 

PostgreSQL install failing on Windows Server 2016

SOLVED
Level 2 Adventurer

PostgreSQL install failing on Windows Server 2016

I am trying to install postgresql-9.6.10-1-windows-x64.exe (run as Administrator) on Windows Server 2016. It worked fine in QA env., but in staging env. (PROD like) its consistently failing while calling initcluster.vbs

 

postgres error.png

Initialising the database cluster (this may take a few minutes)...
Executing cscript //NoLogo "E:\Postgres/installer/server/initcluster.vbs" "NT AUTHORITY\NetworkService" "postgres" "****" "E:\Postgres" "E:\Postgres\data" 5432 "DEFAULT" 0
Script exit code: 127

Script output:

Script stderr:
Program ended with an error exit code

Error running cscript //NoLogo "E:\Postgres/installer/server/initcluster.vbs" "NT AUTHORITY\NetworkService" "postgres" "****" "E:\Postgres" "E:\Postgres\data" 5432 "DEFAULT" 0: Program ended with an error exit code
Problem running post-install step. Installation may not complete correctly
The script was called with an invalid command line
Creating Uninstaller
Creating uninstaller 25%
Creating uninstaller 50%
Creating uninstaller 75%
Creating uninstaller 100%
Installation completed
Log finished 11/28/2018 at 14:18:57

 

When I purposely added writeline within the initcluster.vbs file (by replacing initcluster.vbs during the installation & before above command is called with my local copy of initcluster.vbs), i found arguments are reaching without double quotes and hence breaking up on space i.e., 1st arg become NT and 2nd arg become AUTHORITY\NetworkService, and hence total arguments count become more than 8.

 

Surprisingly, when I called above command via cmd.exe, it works just fine. I tried installing on various different locations like C:, %TEMP%, etc., but its giving same error everywhere. I also tried newer postgresql 10 and 11 installers as well, but same error is thrown by them too.

 

Not sure if has anything to do with "windows script hosting" registry, firewall settings or other windows settings.

 

Please advise.

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Level 2 Adventurer

Re: PostgreSQL install failing on Windows Server 2016

Hi Ninid,

 

Changing data directory didn't solve the problem.

 

Finally able to root caused it. "BeyondTrust PowerBroker for Windows Service" is somehow interfering with postgresql installation. It was causing double quotes to be removed from cscript command and hence failing installation.

We stopped "BeyondTrust PowerBroker for Windows Service" and postgresql installation completed without error.

 

Regards,

Satish

6 REPLIES
EDB Team Member

Re: PostgreSQL install failing on Windows Server 2016

Hi Skumar,

The above issue which you are facing might be the one of following issue with COMSPEC environment variable. To resolve this could you please check the below instructions.

 

 

Check the %COMSPEC% environment variable

 

Some Windows installations seem to land up with an incorrect %COMSPEC% environment variable that prevents the execution of initdb.

In a command prompt, run:

echo %COMSPEC%

You should get something like:

   C:\Windows\system32\cmd.exe

(Where C:\Windows is your Windows install location).

If you see something else, check the System control panel, and in the Environment section check for COMSPEC. If its value there is wrong:

  • Make a system restore point; and
  • Back up your computer; then
  • Change it in the system environment settings, so it points to the correct location of cmd.exe

You can test to make sure it's right by:

  • Opening a new cmd.exe prompt (not re-using one that was already open); and
  • Running "%COMSPEC%" /C "echo test ok"

It should print "test ok".

 

 

Level 2 Adventurer

Re: PostgreSQL install failing on Windows Server 2016

Thanks for your response Kapil.

 

I tried above command previously and now again, %ComSpec% is properly defined, but still causing initcluster.vbs to fail with error code 127. :-(

 

Regards,

Satish

EDB Team Member

Re: PostgreSQL install failing on Windows Server 2016

Hi @skumar2018

 

Thank you for your response. We will look into your request and get back to you.

 

Thanks,

Ninad

EDB Team Member

Re: PostgreSQL install failing on Windows Server 2016

Hi @skumar2018

 

Can you try to execute below commands by replacing text "C:\Program Files\PostgreSQL\9.6\data1" by required empty directory path for resident of data.

 

"C:\Program Files\PostgreSQL\9.6/installer/server/initcluster.vbs" "NT AUTHORITY\NetworkService" "postgres" "postgres" "C:\Program Files\PostgreSQL\9.6" "C:\Program Files\PostgreSQL\9.6\data1" 5432 "DEFAULT" 0

 

Request you to share result with us.

 

Thanks,

Ninad

Level 2 Adventurer

Re: PostgreSQL install failing on Windows Server 2016

Hi Ninid,

 

Changing data directory didn't solve the problem.

 

Finally able to root caused it. "BeyondTrust PowerBroker for Windows Service" is somehow interfering with postgresql installation. It was causing double quotes to be removed from cscript command and hence failing installation.

We stopped "BeyondTrust PowerBroker for Windows Service" and postgresql installation completed without error.

 

Regards,

Satish

EDB Team Member

Re: PostgreSQL install failing on Windows Server 2016

Hi @skumar2018

 

Thank you for your response. It's really a good news that your issue is resolved. Would you please mark "Accept as solution".

 

Thanks,

Ninad