ceekaye
ceekaye

Reputation: 11

Cannot Install Postgresql 14 on my windows server 2019 - post install errors

I have PgAmin 4.6 running with PostgreSQL 12 on my windows 2019 server. I want to install postgreSQL 14. I have tried installing it using the latest EDB .exe file a few times: Each attempt I wind up with a post installation error. I've tried logged in as an administrator. I've adjusted the postgresql folder security privileges to allow 'all application packages', 'all restricted application packages', users in the administrator group and my own user account with full control... and I have even tried adding postgres as a local administrator account and installing from an elevated cmd-prompt. Any way I have sliced it - I continue to get the post-installation error. The installer finishes, but no postgresql 14 service installed, and the only folder in the postgreSQL 14 directory is Data.

What am I missing? What gives? Can I use pgAdmin to create a new postgresql 14 server? How do I initialize a postgreSQL 14 database? Wywould it matter if I already have pdAdmin 4.6 and postgreSQL 12 installed?I'd appreciate a little help. Many thanks! post-installation error

     Log started 01/21/2022 at 18:20:18
Preferred installation mode : qt
Trying to init installer in mode qt
Mode qt successfully initialized
Setting variable whoami from C:\WINDOWS\System32\whoami 
Script exit code: 0

Script output:
 dn\USER

Script stderr:
 

Executing C:\WINDOWS\System32\icacls "C:\Users\USER\AppData\Local\Temp/postgresql_installer_631f935164" /inheritance:r
Script exit code: 0

Script output:
 processed file: C:\Users\USER\AppData\Local\Temp/postgresql_installer_631f935164
Successfully processed 1 files; Failed processing 0 files

Script stderr:
 

Executing C:\WINDOWS\System32\icacls "C:\Users\USER\AppData\Local\Temp/postgresql_installer_631f935164" /T /Q /grant "dn\USER:(OI)(CI)F"
Script exit code: 0

Script output:
 Successfully processed 1 files; Failed processing 0 files

Script stderr:
 

Executing C:\WINDOWS\System32\cscript //NoLogo "C:\Users\USER\AppData\Local\Temp\postgresql_installer_631f935164\prerun_checks.vbs"
Script exit code: 0

Script output:
 The scripting host appears to be functional.

Script stderr:
 

[18:20:30] Using branding: PostgreSQL 14
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 SB_Version. Setting variable sb_version to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 pgAdmin_Version. Setting variable pgadmin_version to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 Data Directory. Setting variable server_data_dir to empty value
Executing C:\Users\USER\AppData\Local\Temp/postgresql_installer_631f935164/temp_check_comspec.bat 
Script exit code: 0

Script output:
 Active code page: 1252
Active code page: 1252
"test ok"

Script stderr:
 

Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 Data Directory. Setting variable iDataDirectory to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 Service ID. Setting variable iServiceName to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 Service Account. Setting variable iServiceAccount to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 Super User. Setting variable iSuperuser to empty value
Could not find registry key HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-14 DisableStackBuilder. Setting variable iDisableStackBuilder to empty value
[18:20:31] Existing base directory: C:\Program Files\PostgreSQL\14
[18:20:31] Existing data directory: 
[18:20:31] Using branding: PostgreSQL 14
[18:20:31] Using Super User: postgres and Service Account: NT AUTHORITY\NetworkService
[18:20:31] Using Service Name: postgresql-x64-14
Executing C:\Users\USER\AppData\Local\Temp\postgresql_installer_631f935164\getlocales.exe 
Script exit code: 0

Script output:
EnglishxxCOMMAxxxxSPxxAustralia=English, Australia
EnglishxxCOMMAxxxxSPxxBelize=English, Belize
EnglishxxCOMMAxxxxSPxxCanada=English, Canada
EnglishxxCOMMAxxxxSPxxCaribbean=English, Caribbean
EnglishxxCOMMAxxxxSPxxHongxxSPxxKongxxSPxxSAR=English, Hong Kong SAR
EnglishxxCOMMAxxxxSPxxIndia=English, India
EnglishxxCOMMAxxxxSPxxIndonesia=English, Indonesia
EnglishxxCOMMAxxxxSPxxIreland=English, Ireland
**_TRUNCATED_**

Script stderr:
[18:21:45] Data Directory exists and is empty. Removing it
Preparing to Install
Preparing to Install
Directory already exists: C:\Program Files\PostgreSQL\14\installer
Unpacking files
Unpacking C:\Program Files\PostgreSQL\14\installer\prerun_checks.vbs
Unpacking C:\Program Files\PostgreSQL\14\installer\vcredist_x86.exe
Directory already exists: C:\Program Files\PostgreSQL\14\installer
Unpacking files
Unpacking C:\Program Files\PostgreSQL\14\installer\vcredist_x64.exe
Directory already exists: C:\Program Files\PostgreSQL\14
Directory already exists: C:\Program Files\PostgreSQL\14\..._***TRUNCATED**
Unpacking files
Unpacking C:\Program Files\PostgreSQL\14\bin\pg_regress_ecpg.exe
Unpacking C:\Program Files\PostgreSQL\14\bin\..._***TRUNCATED UNPACK A BOATLOAD OF FILES FOR INSTALLATION***_
Directory already exists: C:\Program Files\PostgreSQL\14
Directory already exists: C:\Program Files\PostgreSQL\14\bin
Directory already exists: C:\Program Files\PostgreSQL\14\lib
Directory already exists: C:\Program Files\PostgreSQL\14\installer
Directory already exists: C:\Program Files\PostgreSQL\14\installer\server
Directory already exists: C:\Program Files\PostgreSQL\14\scripts
Directory already exists: C:\Program Files\PostgreSQL\14\scripts\images
Unpacking files
Unpacking C:\Program Files\PostgreSQL\14\lib\libecpg_compat.dll
...**TRUNCATED***
Unpacking C:\Program Files\PostgreSQL\14\installer\vcredist_x64.exe
Setting variable whoami from C:\WINDOWS\System32\whoami 
Script exit code: 0

Script output:
 dn\USER

Script stderr:

Executing C:\WINDOWS\System32\icacls "C:\Users\USER\AppData\Local\Temp/postgresql_installer_3f464cf94c" /inheritance:r
Script exit code: 0

Script output:
 processed file: C:\Users\USER\AppData\Local\Temp/postgresql_installer_3f464cf94c
Successfully processed 1 files; Failed processing 0 files

Script stderr:
 

Executing C:\WINDOWS\System32\icacls "C:\Users\USER\AppData\Local\Temp/postgresql_installer_3f464cf94c" /T /Q /grant "dn\USER:(OI)(CI)F"
Script exit code: 0

Script output:
 Successfully processed 1 files; Failed processing 0 files

Script stderr:
 

[18:24:34] Removing the existing ldconfig setting - set during the previous installation.
[18:24:34] Running the post-installation/upgrade actions:
[18:24:34] Write the base directory to the ini file...
[18:24:34] Write the version number to the ini file...
Initialising the database cluster (this may take a few minutes)...
Executing C:\WINDOWS\System32\cscript //NoLogo "C:\Program Files\PostgreSQL\14/installer/server/initcluster.vbs" "NT AUTHORITY\NetworkService" "postgres" "****" "C:\Users\USER\AppData\Local\Temp/postgresql_installer_3f464cf94c" "C:\Program Files\PostgreSQL\14" "D:\pgData14" 5433 "DEFAULT" 0
Script exit code: 1

Script output:
 WScript.Shell Initialized...
Scripting.FileSystemObject initialized...

Called CreateDirectory(D:\pgData14)...
Called CreateDirectory(D:\)...
Called ClearAcl (D:\pgData14)...
    Executing batch file 'radEA2DE.bat'...
    D:\pgData14 DN\USER:(I)(OI)(CI)(F)
            BUILTIN\Administrators:(I)(F)
            CREATOR OWNER:(I)(OI)(CI)(IO)(F)
            NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F)
            BUILTIN\Administrators:(I)(OI)(CI)(IO)(F)
            BUILTIN\Users:(I)(CI)(S,WD)
            BUILTIN\Users:(I)(CI)(S,AD)
            BUILTIN\Users:(I)(OI)(CI)(RX)

Successfully processed 1 files; Failed processing 0 files

Removing inherited ACLs on (D:\pgData14)
    Executing batch file 'radEA2DE.bat'...
    processed file: D:\pgData14
Successfully processed 1 files; Failed processing 0 files

WScript.Network initialized...
strParentOfDataDirD:\
logged in userDN\USER
Called AclCheck(D:\pgData14)
Called IsVistaOrNewer()...
    'winmgmts' object initialized...
    Version:10.
    MajorVersion:10
Executing icacls to ensure the DN\USER account can read the path D:\pgData14
    Executing batch file 'radEA2DE.bat'...
    processed file: D:\pgData14
Successfully processed 1 files; Failed processing 0 files

Called IsVistaOrNewer()...
    'winmgmts' object initialized...
    Version:10.
    MajorVersion:10
Ensuring we can write to the data directory (using icacls) to  DN\USER:
    Executing batch file 'radEA2DE.bat'...
    processed file: D:\pgData14
Successfully processed 1 files; Failed processing 0 files

Called IsVistaOrNewer()...
    'winmgmts' object initialized...
    Version:10.
    MajorVersion:10
Granting full access to (NT AUTHORITY\NetworkService) on (D:\pgData14)
    Executing batch file 'radEA2DE.bat'...
    processed file: D:\pgData14
Successfully processed 1 files; Failed processing 0 files

Called IsVistaOrNewer()...
    'winmgmts' object initialized...
    Version:10.
    MajorVersion:10
Granting full access to CREATOR OWNER on (D:\pgData14)
    Executing batch file 'radEA2DE.bat'...
    processed file: D:\pgData14
Successfully processed 1 files; Failed processing 0 files

Called IsVistaOrNewer()...
    'winmgmts' object initialized...
    Version:10.
    MajorVersion:10
Granting full access to SYSTEM on (D:\pgData14)
    Executing batch file 'radEA2DE.bat'...
    processed file: D:\pgData14
Successfully processed 1 files; Failed processing 0 files

Called IsVistaOrNewer()...
    'winmgmts' object initialized...
    Version:10.
    MajorVersion:10
Granting full access to Administrators on (D:\pgData14)
    Executing batch file 'radEA2DE.bat'...
    processed file: D:\pgData14
Successfully processed 1 files; Failed processing 0 files

    Executing batch file 'radEA2DE.bat'...
    initdb: error: The program "postgres" was found by "C:/Program Files/PostgreSQL/14/bin/initdb.exe"
but was not the same version as initdb.
Check your installation.

Called Die(Failed to initialise the database cluster with initdb)...
Failed to initialise the database cluster with initdb

Script stderr:
 Program ended with an error exit code

Error running C:\WINDOWS\System32\cscript //NoLogo "C:\Program Files\PostgreSQL\14/installer/server/initcluster.vbs" "NT AUTHORITY\NetworkService" "postgres" "****" "C:\Users\USER\AppData\Local\Temp/postgresql_installer_3f464cf94c" "C:\Program Files\PostgreSQL\14" "D:\pgData14" 5433 "DEFAULT" 0: Program ended with an error exit code
Problem running post-install step. Installation may not complete correctly
 The database cluster initialisation failed.
Setting variable whoami from C:\WINDOWS\System32\whoami 
Script exit code: 0

Script output:
 dn\USER

Script stderr:

Executing C:\WINDOWS\System32\icacls "C:\Users\USER\AppData\Local\Temp/postgresql_installer_4701618998" /inheritance:r
Script exit code: 0

Script output:
 processed file: C:\Users\USER\AppData\Local\Temp/postgresql_installer_4701618998
Successfully processed 1 files; Failed processing 0 files

Script stderr:
 
Executing C:\WINDOWS\System32\icacls "C:\Users\USER\AppData\Local\Temp/postgresql_installer_4701618998" /T /Q /grant "dn\USER:(OI)(CI)F"
Uninstalling C:\Program Files\PostgreSQL\14\...**__TRUNCATED UNINSTALLED THE BOATLOAD THAT WAS INSTALLED__**
Uninstalling C:/Program Files/PostgreSQL/14/bin...
Skipping C:/Program Files/PostgreSQL/14
Uninstallation completed
Exiting with code 1

Upvotes: 0

Views: 1527

Answers (1)

Guy Daniel
Guy Daniel

Reputation: 21

There seems to be some conflict between running as an underprivileged user and administrator. You have to run as an underprivileged user to create the database cluster and then an administrator to register the service. To get around this, first run initdb in some other directory, rather than the postgres data directory eg:

\apps\server\postgres\bin\initdb.exe -A md5 -Upostgres -Eutf8 -W -D"data" --no-locale

then you copy the data directory created to the postgres data dir specified in the failed install, and then register the service manually like:

pg_ctl -N postgres -D your_postgres_data_dir 

Then you will be able to start/manage the postgres service in windows services as normal.

Upvotes: 0

Related Questions