Windows x86-64 One-Click Install (9.1.2-1, 9.0.6-1) hangs on "initialising the database cluster" (with work-around) - Mailing list pgsql-bugs

From Eric Borts
Subject Windows x86-64 One-Click Install (9.1.2-1, 9.0.6-1) hangs on "initialising the database cluster" (with work-around)
Date
Msg-id 4F209FF1.3080209@bltek.com
Whole thread Raw
Responses Re: Windows x86-64 One-Click Install (9.1.2-1, 9.0.6-1) hangs on "initialising the database cluster" (with work-around)  (Dave Page <dpage@pgadmin.org>)
List pgsql-bugs
Windows 7 Home Premium 64-bit, SP 1
Intel Core i7-2630QM @ 2.00 GHz
Local machine authentication (no network-based login)

Installation of the 9.1.2-1 and 9.0.6-1 hangs on "initialising the database cluster". Process has 0 CPU. In all scenarios left process run for at least 5 minutes up to an hour.

Tried various configurations, and I'll attempt to list them here
Config 1
    Locale = Default
    Install to = C:\Program Files\PostgreSQL\9.1
    Data Dir = D:\postgres\9.1\data   
    Created new postgres user as part of the installer
    Hung at "initialising the database cluster"

Config 2
    Locale = Default
    Install to = C:\PostgreSQL\9.1
    Data Dir = D:\postgres\9.1\data
    postgres user already created in Config 1 step
    Hung at "initialising the database cluster"

Config 3
    Added "FULL" permissions to D:\postgres; C:\PostgreSQL; (recursive) for postgres user
    Hung at "initialising the database cluster"

Config 4
    Locale = English, United States
    Hung at "initialising the database cluster"



After some experimentation (sorry, can't help this as a software developer!), I was able to reproduce the problem with this set of scripts. The original file where the execution hangs is:

    initicluster.vbs line 117
    Function DoCMd(strCmd)
        ...
        DoCmd = objShell.Run(objTempFolder.Path & "\" & strBatchFile, 0, True)
        ...
    End Function

[sayhi.bat]
echo Hello World > _hello.txt

[test.vbs]
Dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")

' original script as window style (param 2) set to 0 to hide the command prompt
' setting window style to "1" here shows that the cmd prompt is not executing the batch file
objShell.Run "sayhi.bat", 1, True

---------------------
Run the above command in an Administrator command prompt with:
    cscript test.vbs

Program will hangs, does not generate the _hello.txt file

I was not able to discover any permissions that prevented a batch file from being run directly by wscript, but I did find two changes that made this work:
---------------------
[test.vbs]
' Reference: http://technet.microsoft.com/en-us/library/ee692837.aspx

' SOLUTION 1: Launch cmd.exe instead of launching the batch file directly
objShell.Run "%COMSPEC% /c sayhi.bat", 1, True

' SOLUTION 2: Use Shell.Exec instead of Shell.Run
objShell.Exec "sayhi.bat > _exec.txt"
---------------------

After discovering these changes:
1. opened initcluster.vbs in Komodo Edit 6.1
2. modified line ~113 to:

    DoCmd = objShell.Run("%COMSPEC% /c " & objTempFolder.Path & "\" & strBatchFile, 0, True)

3. canceled the hung postgres install
    -- this deleted the initcluster.vbs
4. save initcluster.vbs and marked as read-only
5. re-run the install
6. watch for initcluster.vbs date to change during installation unpacking
7. save initcluster.vbs when date on file changes

At this point the data directory is created properly and the installation progresses beyond  "initialising the database cluster" but is now hung on "Configuring database server startup"

8. searched for ".Run" in all .vbs files
9. found matching line in startupcfg.vbs and loadmodules.vbs
10. modified startupcfg.vbs line 42

    DoCmd = objShell.Run("%COMSPEC% /c " & objTempFolder.Path & "\" & strBatchFile, 0, True)

11. modified loadmodules.vbs line 47

    DoCmd = objShell.Run("%COMSPEC% /c " & objTempFolder.Path & "\" & strBatchFile, 0, True)

12. delete old data directory
13. repeat steps 1-7, then jump to 14
14. save startupcfg.vbs and loadmodules.vbs (immediately after initcluster.vbs has been re-saved)

Install runs through completely and successfully.

Attached is a zip of the 3 .vbs files modified (renamed to ._vbs to avoid firewall problems).

Hope this helps!
Thanks,
Eric
Attachment

pgsql-bugs by date:

Previous
From: Josh Berkus
Date:
Subject: wCTE cannot be used to update parent inheritance table
Next
From: harukat@sraoss.co.jp
Date:
Subject: BUG #6410: Windows say a unpleasant warning when stop a pgsql service