Thread: BUG #5253: installer fails to populate data directory

BUG #5253: installer fails to populate data directory

From
"Daniel Convissor"
Date:
The following bug has been logged online:

Bug reference:      5253
Logged by:          Daniel Convissor
Email address:      danielc@analysisandsolutions.com
PostgreSQL version: 8.4.2-1
Operating system:   Windows XP Pro SP3
Description:        installer fails to populate data directory
Details:

It seems Bug #4785 hasn't been resolved.  I downloaded the one click
installer tonight and have hit a snag.  Running
postgresql-8.4.2-1-windows.exe produces the following error:

vvvv
Problem running post-install step.  Installation may not complete correctly.
 Error reading the C:/Program Files/PostgreSQL/8.4/data/postgresql.conf
^^^^

Turns out the data directory is completely empty.  During the install, I did
_not_ un-check the box asking if I wanted to "Install pl/pgsql in template1
database", so it should have been in there as well.

This is a standalone computer, not on a domain.  I ran the installer while
logged into the Administrator account.  Both I and the pre-existing
"postgres" user[1] have permissions to the directory.

cacls "C:\Program Files\PostgreSQL\8.4\data"

C:\Program Files\PostgreSQL\8.4\data DANT41\postgres:(OI)(CI)C
                                     BUILTIN\Users:R
                                     BUILTIN\Users:(OI)(CI)(IO)(special
access:)
                                                               GENERIC_READ

GENERIC_EXECUTE
                                     BUILTIN\Power Users:C
                                     BUILTIN\Power Users:(OI)(CI)(IO)C
                                     BUILTIN\Administrators:F
                                     BUILTIN\Administrators:(OI)(CI)(IO)F
                                     NT AUTHORITY\SYSTEM:F
                                     NT AUTHORITY\SYSTEM:(OI)(CI)(IO)F
                                     DANT41\theadmin:F
                                     CREATOR OWNER:(OI)(CI)(IO)F

NB: "theadmin" is the administrator user on this machine.

[1]  I had Postgres 8.1 installed a while ago.  Haven't used it in a while.
I uninstalled it before attempting to install 8.4.

Re: BUG #5253: installer fails to populate data directory

From
Sachin Srivastava
Date:
Can you post the error part of the logs (%TEMP%\install-postgresql.log)?
Mask out any passwords (if there are any).

On 12/23/2009 01:08 PM, Daniel Convissor wrote:
> The following bug has been logged online:
>
> Bug reference:      5253
> Logged by:          Daniel Convissor
> Email address:      danielc@analysisandsolutions.com
> PostgreSQL version: 8.4.2-1
> Operating system:   Windows XP Pro SP3
> Description:        installer fails to populate data directory
> Details:
>
> It seems Bug #4785 hasn't been resolved.  I downloaded the one click
> installer tonight and have hit a snag.  Running
> postgresql-8.4.2-1-windows.exe produces the following error:
>
> vvvv
> Problem running post-install step.  Installation may not complete correctly.
>   Error reading the C:/Program Files/PostgreSQL/8.4/data/postgresql.conf
> ^^^^
>
> Turns out the data directory is completely empty.  During the install, I did
> _not_ un-check the box asking if I wanted to "Install pl/pgsql in template1
> database", so it should have been in there as well.
>
> This is a standalone computer, not on a domain.  I ran the installer while
> logged into the Administrator account.  Both I and the pre-existing
> "postgres" user[1] have permissions to the directory.
>
> cacls "C:\Program Files\PostgreSQL\8.4\data"
>
> C:\Program Files\PostgreSQL\8.4\data DANT41\postgres:(OI)(CI)C
>                                       BUILTIN\Users:R
>                                       BUILTIN\Users:(OI)(CI)(IO)(special
> access:)
>                                                                 GENERIC_READ
>
> GENERIC_EXECUTE
>                                       BUILTIN\Power Users:C
>                                       BUILTIN\Power Users:(OI)(CI)(IO)C
>                                       BUILTIN\Administrators:F
>                                       BUILTIN\Administrators:(OI)(CI)(IO)F
>                                       NT AUTHORITY\SYSTEM:F
>                                       NT AUTHORITY\SYSTEM:(OI)(CI)(IO)F
>                                       DANT41\theadmin:F
>                                       CREATOR OWNER:(OI)(CI)(IO)F
>
> NB: "theadmin" is the administrator user on this machine.
>
> [1]  I had Postgres 8.1 installed a while ago.  Haven't used it in a while.
> I uninstalled it before attempting to install 8.4.
>
>


--
Regards,
Sachin Srivastava
EnterpriseDB <http://www.enterprisedb.com>, the Enterprise Postgres
<http://www.enterprisedb.com> company.

Re: BUG #5253: installer fails to populate data directory

From
Daniel Convissor
Date:
Hi Sachin:

On Wed, Dec 23, 2009 at 02:19:41PM +0530, Sachin Srivastava wrote:
> Can you post the error part of the logs (%TEMP%\install-postgresql.log)?
> Mask out any passwords (if there are any).

I have attached it.  Examining the log reveals some clues that I used to
manually populate the data directory...

cacls "C:\Program Files\PostgreSQL\8.4\data" /E /T /P postgres:F

cscript //NoLogo \
  "C:\Program Files\PostgreSQL\8.4/installer/server/initcluster.vbs" \
  "postgres" "postgres" "fakepassword" \
  "C:\Program Files\PostgreSQL\8.4" \
  "C:\Program Files\PostgreSQL\8.4\data" 5432 "DEFAULT"


I was then able to start the PostgreSQL service manually via the
services.msc interface.  The service is being run as the "postgres" user.
Then I created a user and a database in PostgreSQL without incident.

Please note, that while running the cscript test, it complained a bit.
Here is the relevant portion of the output:

vvvvvv
Ensuring we can write to the data directory (using cacls):
The data is invalid.

The files belonging to this database system will be owned by user
"theadmin".
This user must also own the server process.
^^^^^^


So, there seems to be a couple bugs in initcluster.vbs:

1) What does it mean it can't write to the directory?  Is the script
having the "postgres" user attempt to set the permissions on "data" via
cacls?  Of course it can't.  The script should have the admin user create
"data" and run the cacls granting permission to the postgres user.  Then
to test if "postgres" has the proper permissions, touch a file inside
"data".  If that works, excellent.  If not, fall back to the admin having
ownership.

2) Ownership should be given to "postgres".  Perhaps that's because of
the prior issue.

Thanks,

--Dan

--
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409

Attachment