BUG #17940: PostgreSQL Installer For Windows Cannot Initialize Cluster When BeyondTrust Installed - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #17940: PostgreSQL Installer For Windows Cannot Initialize Cluster When BeyondTrust Installed
Date
Msg-id 17940-88dc2ede046a50f6@postgresql.org
Whole thread Raw
Responses Re: BUG #17940: PostgreSQL Installer For Windows Cannot Initialize Cluster When BeyondTrust Installed  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      17940
Logged by:          Joel Rabinovitch
Email address:      joel.rabinovitch@tecsys.com
PostgreSQL version: 13.4
Operating system:   Microsoft Windows 10
Description:

Our developers do their work using a local PostgreSQL database server and
local schemas.

This is typically done by installing the Windows version of the PostgreSQL
installer from EnterpriseDB. Currently, version 13.4 (64-bit) of the
installer is being used.

Recently, our organization has installed BeyondTrust Privilege Management
software on our developer’s PCs. The software forces the developer to
authenticate when doing administrative tasks such as installing software and
adjusting environment variables.

When a developer attempts to install the PostgreSQL 13.4 database server,
the developer is authenticated and the software runs as an administrator.

The issue occurs when the installer initializes the database cluster. When
it attempts to do this, these are the following messages we see in the
installation logs:

[09:51:29] Running the post-installation/upgrade actions:
[09:51:29] Write the base directory to the ini file...
[09:51:29] 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\13/installer/server/initcluster.vbs" "NT
AUTHORITY\NetworkService" "postgres" "****"
"C:\Users\joelr\AppData\Local\Temp/postgresql_installer_7e15a7cf72"
"C:\Program Files\PostgreSQL\13" "C:\Data\PostgreSQL" 5432 "DEFAULT" 0
Script exit code: 1

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

Called CreateDirectory(C:\Data\PostgreSQL)...
Called CreateDirectory(C:\Data)...
Called ClearAcl (C:\Data\PostgreSQL)...
    Executing batch file 'rad58C94.bat'...
    C:\Data\PostgreSQL BUILTIN\Administrators:(I)(OI)(CI)(F)
                   NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F)
                   BUILTIN\Users:(I)(OI)(CI)(RX)
                   NT AUTHORITY\Authenticated Users:(I)(M)
                   NT AUTHORITY\Authenticated Users:(I)(OI)(CI)(IO)(M)

Successfully processed 1 files; Failed processing 0 files

Removing inherited ACLs on (C:\Data\PostgreSQL)
    Executing batch file 'rad58C94.bat'...
    processed file: C:\Data\PostgreSQL
Successfully processed 1 files; Failed processing 0 files

WScript.Network initialized...
strParentOfDataDirC:\Data
logged in userTECSYS\joelr
Called AclCheck(C:\Data\PostgreSQL)
Called IsVistaOrNewer()...
    'winmgmts' object initialized...
    Version:10.
    MajorVersion:10
Executing icacls to ensure the TECSYS\joelr account can read the path
C:\Data\PostgreSQL
    Executing batch file 'rad58C94.bat'...
    processed file: C:\Data\PostgreSQL
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
TECSYS\joelr:
    Executing batch file 'rad58C94.bat'...
    processed file: C:\Data\PostgreSQL
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
(C:\Data\PostgreSQL)
    Executing batch file 'rad58C94.bat'...
    processed file: C:\Data\PostgreSQL
Successfully processed 1 files; Failed processing 0 files

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

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

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

    Executing batch file 'rad58C94.bat'...
    The files belonging to this database system will be owned by user
"joelr".
This user must also own the server process.

The database cluster will be initialized with locale
"English_Canada.1252".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory C:/Data/PostgreSQL ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... windows
selecting default max_connections ... 20
selecting default shared_buffers ... 400kB
selecting default time zone ... US/Eastern
creating configuration files ... ok
running bootstrap script ... Execution of PostgreSQL by a user with
administrative permissions is not
permitted.
The server must be started under an unprivileged user ID to prevent
possible system security compromises.  See the documentation for
more information on how to properly start the server.
child process exited with exit code 1
initdb: removing contents of data directory "C:/Data/PostgreSQL"

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\13/installer/server/initcluster.vbs" "NT
AUTHORITY\NetworkService" "postgres" "****"
"C:\Users\joelr\AppData\Local\Temp/postgresql_installer_7e15a7cf72"
"C:\Program Files\PostgreSQL\13" "C:\Data\PostgreSQL" 5432 "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

From what we can see, the initialization fails because the installer
executes as an administrator. However, the initialization of a database
cluster requires you to be a non-administrator.

We have a manual procedure to follow when this occurs, which involves the
following:

- Manually initializing the database cluster as a non-administrator using
the command in the logs.
- Installing the Windows service as an administrator using the command in
the logs.
- Reinstalling some of the PostgreSQL components.

The process works, but it is quite cumbersome.

Is there a way to work around this.  I checked to see if there is a
command-line option to bypass the initialization of the database cluster
and/or the service when running the Windows installer, but I did not see an
option to this,

Has anyone had a similar issue when using the PostgreSQL installer for
Windows when the BeyondTrust Privilege Management (or similar software) is
installed on their PC. If so, what have you done to resolve this.

We have been in contact with the company that develops the BeyondTrust
software, but they have not been able to help us correct the problem as of
yet.


pgsql-bugs by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: AW: AW: BUG #17923: Excessive warnings of collation version mismatch in logs
Next
From: "David G. Johnston"
Date:
Subject: Re: BUG #17940: PostgreSQL Installer For Windows Cannot Initialize Cluster When BeyondTrust Installed