BUG #18827: PostgreSQL 17.4-1 Installation – Database Cluster Initialization Failed Due to Execution Policy - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #18827: PostgreSQL 17.4-1 Installation – Database Cluster Initialization Failed Due to Execution Policy
Date
Msg-id 18827-321d50a337732028@postgresql.org
Whole thread Raw
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      18827
Logged by:          Abhishek Zararia
Email address:      abhishekzararia@gmail.com
PostgreSQL version: 17.4
Operating system:   Microsoft Windows 10
Description:

Dear Support Team,

While installing PostgreSQL 17.4-1, I encountered the following error during
database cluster initialization:
***************************************
Error running C:\windows\System32\cmd.exe /c
"C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy
Bypass -File "C:\Program
Files\PostgreSQL\17/installer/server/initcluster.ps1" "NT
AUTHORITY\NetworkService" "postgres" "****"
"C:\Users\<User>\AppData\Local\Temp/postgresql_installer_f3480bc391"
"C:\Program Files\PostgreSQL\17" "C:\Program Files\PostgreSQL\17\data" 5432
"DEFAULT" 0: File C:\Program
Files\PostgreSQL\17\installer\server\initcluster.ps1 cannot be loaded. The
file C:\Program 
Files\PostgreSQL\17\installer\server\initcluster.ps1 is not digitally
signed. You cannot run this script on the 
current system. For more information about running scripts and setting
execution policy, see about_Execution_Policies 
at https:/go.microsoft.com/fwlink/?LinkID=135170.
    + CategoryInfo          : SecurityError: (:) [],
ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnauthorizedAccess
Problem running post-install step. Installation may not complete correctly
 The database cluster initialisation failed.
***************************************

Upon investigation, I found that my System Execution Policy
(Get-ExecutionPolicy -List) had "MachinePolicy" set to "AllSigned", which
caused the installation to fail due to script signature enforcement.

When I changed "MachinePolicy" to "Undefined", the installation proceeded
successfully, and the PostgreSQL service started without issues.

Could you confirm if this is the expected behavior in PostgreSQL 17.4-1? I
did not encounter this issue in previous PostgreSQL versions. Was this
change intentional, or is it an overlooked error?

Awaiting your response.

Best regards,
Abhishek Zararia


pgsql-bugs by date:

Previous
From: Matthias Apitz
Date:
Subject: Re: BUG #18822: mailing lists reject mails due to DKIM-signature
Next
From: Richard Guo
Date:
Subject: Re: Query result differences between PostgreSQL 17 vs 16