Thread: Failed to run initdb - not resolved bug 5130

Failed to run initdb - not resolved bug 5130

From
Tomas Studva
Date:
Hi all gurus,

I've encountered on my computer this bug. I will try to describe all what I
have discovered till now.

1, this bug happened a few times before and wasn't resolved:
    bug 5130 -
http://www.mail-archive.com/pgsql-bugs@postgresql.org/msg24810.html
    bug 5222 -
http://archives.postgresql.org/pgsql-bugs/2009-12/msg00004.php
    bug 4691 -
http://archives.postgresql.org/pgsql-bugs/2009-03/msg00028.php
    ? - http://forums.enterprisedb.com/posts/list/1845.page
I think the problem was always the same.

My case is WIN XP SP 2 and also when applied SP3. My system has only one
speciality as I know, that is I have windows installed on F partition.

Problem description:

I tried install with one click installer, it ends with error
postgresql.conf not found. In log it is failing on initdb, which clears
data dir after failure. Uninstaller is not working, do nothing when
runned. When run installation again, then upgrade mode is run, because
installation is found. This can be tricked by deleting installation from
registry and deleting win service, then new install is possible.

I was installing on path F:\Program Files\PostgreSQL\8.4 and also tried
C:\Program Files\PostgreSQL\8.4, problem is probably not with install
path.

OK, what more I have tried. MS Visuall C++ redistr. I uninstalled, so
the one with postgres comming were installed surely. I tried to enable
debug output, but it gives no new information. I was reading initdb sources
and problem is probably in this part, because I see message
"selecting default max_connections " then one error message. It
looks for me as snprintf is not executed or reached or etc.

-----------------------------------------------------------------------------
    printf(_("selecting default max_connections ... "));
    fflush(stdout);

    for (i = 0; i < connslen; i++)
    {
        test_conns = trial_conns[i];
        test_buffs = MIN_BUFS_FOR_CONNS(test_conns);

        snprintf(cmd, sizeof(cmd),
                 SYSTEMQUOTE "\"%s\" --boot -x0 %s "
                 "-c max_connections=%d "
                 "-c shared_buffers=%d "
                 "< \"%s\" > \"%s\" 2>&1" SYSTEMQUOTE,
                 backend_exec, boot_options,
                 test_conns, test_buffs,
                 DEVNULL, DEVNULL);
        status = system(cmd);
        if (status == 0)
        {
            ok_buffers = test_buffs;
            break;
        }
    }
    if (i >= connslen)
        i = connslen - 1;
    n_connections = trial_conns[i];

    printf("%d\n", n_connections);
-----------------------------------------------------------------------------

Now I am out of ideas, I can try to install some older version of
postgres, but i had some problems also with that (but it is not
important for this). I want to install this new version. Can u help me
please?

Sincerely Tomas Studva.

-----------------------------------------------------------------------------
LOG FILE:
-----------------------------------------------------------------------------


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

The database cluster will be initialized with locale Slovak_Slovakia.1250.
The default database encoding has accordingly been set to WIN1250.
initdb: could not find suitable text search configuration for locale Slovak_Slov
akia.1250
The default text search configuration will be set to "simple".

fixing permissions on existing directory f:/Program Files/PostgreSQL/8.4/data ..
. ok
creating subdirectories ... ok
selecting default max_connections ... The system cannot find the file specified.

The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
10
selecting default shared_buffers ... The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
400kB
creating configuration files ... ok
creating template1 database in f:/Program Files/PostgreSQL/8.4/data/base/1 ... o
k
initializing pg_authid ... The system cannot find the file specified.
child process exited with exit code 1
initdb: removing contents of data directory "f:/Program Files/PostgreSQL/8.4/dat
a"

Re: Failed to run initdb - not resolved bug 5130

From
Thomas Specker
Date:
Hi all
after a long time of trying to install PostgreSQL with ...

Computer:

 - Windows2000 (Jurassic Parc, I know ...)

  -   PostGreSQL 8.3.9 and msi-file
  or PostGreSQL 8.4.2 and one click installer

- Data in
     /8.4/data                     (default path)
  or D:\PostgresDaten              (with 1 level)
  or D:\Postgres\PostgreSQLDaten   (parent dir createt by me)

Testing race:
The result of all rounds is always the same:

- Installation:
runns through, but is not complete with error, when trying to initate
the db: no postgresql.conf-file.
The programdirectorys under c:\Programme\PostgreSQL\8.4 (or 8.3) are
created and seem to be complete.
But there are no datadirectorys or datafiles createt.

- Running directly initdb.exe:
stops with error "access denied" when trying to create something (for
the template database) in \PostgreSQLDaten\base\1\.
(\bin\initdb.exe -U postgres -D D:\Postgres\PostgreSQLDaten -W -n
The parameter -n prevents from deleting of the createt files/dirs in
case of errors.)

Some datadirectorys, a postgresql.conf-file, a PG_VERSION-file, others
*.conf-files are createt but the
\base and \base\1\ are empty.

- running pg_ctl.exe to start the server:
complains about missing file pg_control and stopps.
(\bin\pg_ctl.exe start -w -t 10 -D D:\Postgres\PostgreSQLDaten -l
D:\Postgres\PostgreSQLKonfigInfos\logfile02.txt.
Error in logfile is: D:/Postgres/PostgreSQLDaten/global/pg_control ...
No such file or directory.
This pg_ctl.exe wants the path- and filenames written exactly, with
upper and lower cases. Only pg_ctl.exe ?)

Somme more results:

- In windows, the createt datadirectorys belong to the windows-user
"thomas", with permissions for "administrator" and "postgres",
but not allways (I missed to register this in every round of the race ...).
- When running the initdb.exe without parameter -n, it allways could
remove all artefacts.
- on http://forums.enterprisedb.com/posts/list/1802.page can be seen,
that running initdb.exe sometimes works.
- The Windows-user postgres can create files and dirs in [\data]\base\1\.

Diagnosis:

The initdb is not allowed write to [\data]\base\1\ ("access denied"),
but could create it.
It is most likely, that the bug is inside initdb.exe.
You can guess, that there is a conflict between windows-permissions and
db-permissions.
Windows-version, PostgreSQL-version, paths, locals, ... all seem not to
matter.

... I now must hope.

Thomas Specker

If somebody has an installation with a SMALL, empty, and working
data-section including the template-db, this could be tested (if just
copying is possible).

Re: Failed to run initdb - not resolved bug 5130

From
Robert Haas
Date:
On Tue, Jan 12, 2010 at 8:04 AM, Thomas Specker
<gradgis.specker@bluewin.ch> wrote:
> Hi all
> after a long time of trying to install PostgreSQL with ...
>
> Computer:
>
> - Windows2000 (Jurassic Parc, I know ...)
>
> =A0- =A0 PostGreSQL 8.3.9 and msi-file
> =A0or PostGreSQL 8.4.2 and one click installer
>
> - Data in
> =A0 =A0/8.4/data =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (default path)
> =A0or D:\PostgresDaten =A0 =A0 =A0 =A0 =A0 =A0 =A0(with 1 level)
> =A0or D:\Postgres\PostgreSQLDaten =A0 (parent dir createt by me)
>
> Testing race:
> The result of all rounds is always the same:
>
> - Installation:
> runns through, but is not complete with error, when trying to initate the
> db: no postgresql.conf-file.
> The programdirectorys under c:\Programme\PostgreSQL\8.4 (or 8.3) are crea=
ted
> and seem to be complete.
> But there are no datadirectorys or datafiles createt.
>
> - Running directly initdb.exe:
> stops with error "access denied" when trying to create something (for the
> template database) in \PostgreSQLDaten\base\1\.
> (\bin\initdb.exe -U postgres -D D:\Postgres\PostgreSQLDaten -W -n
> The parameter -n prevents from deleting of the createt files/dirs in case=
 of
> errors.)
>
> Some datadirectorys, a postgresql.conf-file, a PG_VERSION-file, others
> *.conf-files are createt but the
> \base and \base\1\ are empty.
>
> - running pg_ctl.exe to start the server:
> complains about missing file pg_control and stopps.
> (\bin\pg_ctl.exe start -w -t 10 -D D:\Postgres\PostgreSQLDaten -l
> D:\Postgres\PostgreSQLKonfigInfos\logfile02.txt.
> Error in logfile is: D:/Postgres/PostgreSQLDaten/global/pg_control ... No
> such file or directory.
> This pg_ctl.exe wants the path- and filenames written exactly, with upper
> and lower cases. Only pg_ctl.exe ?)
>
> Somme more results:
>
> - In windows, the createt datadirectorys belong to the windows-user
> "thomas", with permissions for "administrator" and "postgres",
> but not allways (I missed to register this in every round of the race ...=
).
> - When running the initdb.exe without parameter -n, it allways could remo=
ve
> all artefacts.
> - on http://forums.enterprisedb.com/posts/list/1802.page can be seen, that
> running initdb.exe sometimes works.
> - The Windows-user postgres can create files and dirs in [\data]\base\1\.
>
> Diagnosis:
>
> The initdb is not allowed write to [\data]\base\1\ ("access denied"), but
> could create it.
> It is most likely, that the bug is inside initdb.exe.
> You can guess, that there is a conflict between windows-permissions and
> db-permissions.
> Windows-version, PostgreSQL-version, paths, locals, ... all seem not to
> matter.
>
> ... I now must hope.
>
> Thomas Specker
>
> If somebody has an installation with a SMALL, empty, and working
> data-section including the template-db, this could be tested (if just
> copying is possible).

This email is interesting in that it has a Reply-To header pointing to
"robertmhaas@gmail.com".  I haven't had any replies, but I wonder why
the poster thought that they should come to me.

On the actual content of the email, there's not really enough here for
anyone to begin speculating what the problem might be.  Including the
actual error logs instead of summaries of what they contain would
probably be a good idea.  The contention that "Windows-version,
PostgreSQL-version, path, locals, ... all seem not to matter" does not
seem likely to be true, because this does work for other people.  But
without knowing specifically what was tried, it's hard for anyone to
help.

...Robert