Thread: ERROR: CREATE DATABASE: could not initialize database directory
Hi there, Seems I am not the only one in this case... I am running PostgreSQL 7.2.1 (freshly build on a Win2K SP2 machine) and all its dependants. - I have follow Jason's FAQ (ok, without the patches ... ) - I have managed to initialize the template1 database. - I can get the samples to run against the server - I can create tables, insert/select data... (I've done that in another database, not template1) If I run postmaster as a daemon from a cygwin telnet session, createdb works fine. If I run postmaster as a service (via the cygrunsrv), createdb return the error: "could not initialize database directory". Even more confusing, if I run postmaster as a daemon, create a Db, then kill postmaster daemon, then start posmaster service, I can use the freshly created database. I do not belive this is a security issue because postmaster as a daemon works fine, files are owned by postmater, the /etc/passwd file is correct,... - this is not because cp and mv are not in the default path ( if I logon to the PC with postgres user and open a raw Win32 cmd window, I can use cp and mv). - I do not have any quota or disk space Pb either... Any hints ? Jean-Marc
Re: ERROR: CREATE DATABASE: could not initialize database directory
[...] >If I run postmaster as a daemon from a cygwin telnet session, createdb works >fine. >If I run postmaster as a service (via the cygrunsrv), createdb return the >error: "could not initialize database directory". [...] This means the user you login to the telnet session is different from the user that executes postmaster as a service (usuallySYSTEM or LocalSystem, which, usually again :), is not provided with the rights to login), and/or the options usedto start the postmaster as a daemon are different from those used to start it as a service. [...] >Any hints ? > [...] You must check the user context for the two cases, and make sure that you use the same command line options for postmasterwhen started as a service, also the environment variables. SLao __________________________________________________________________ Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape!http://shopnow.netscape.com/ Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/
----- Original Message -----From: Henshall, Stuart - WCPSent: Monday, June 24, 2002 10:17 AMSubject: RE: [CYGWIN] ERROR: CREATE DATABASE: could not initialize database directoryAre you running the service as the same user as when you run from a shell?
- Stuart> -----Original Message-----
> From: Jean-Marc Paulin [mailto:jmp@micromuse.com]
>
> Hi there,
>
> Seems I am not the only one in this case...
>
> I am running PostgreSQL 7.2.1 (freshly build on a Win2K SP2
> machine) and all
> its dependants.
> - I have follow Jason's FAQ (ok, without the patches ... )
> - I have managed to initialize the template1 database.
> - I can get the samples to run against the server
> - I can create tables, insert/select data... (I've done that
> in another
> database, not template1)
>
> If I run postmaster as a daemon from a cygwin telnet session,
> createdb works
> fine.
> If I run postmaster as a service (via the cygrunsrv),
> createdb return the
> error: "could not initialize database directory".
>
> Even more confusing, if I run postmaster as a daemon, create
> a Db, then kill
> postmaster daemon, then start posmaster service, I can use the freshly
> created database.
>
> I do not belive this is a security issue because postmaster
> as a daemon
> works fine, files are owned by postmater, the /etc/passwd file is
> correct,...
> - this is not because cp and mv are not in the default path (
> if I logon to
> the PC with postgres user and open a raw Win32 cmd window, I
> can use cp and
> mv).
> - I do not have any quota or disk space Pb either...
>
> Any hints ?
>
> Jean-Marc
Yo, The postmaster service is configure to be logged-on as .\postgres user (same username / password / privileges as the telnet user). The *really* weird thing is that the service can select/insert/delete rows/table in existing databases. The only failure is for the CREATE DATABASE. This is what is the most confusing for me. It might well be an environment issue, but same user would get the same environment. So what could be next ? Thanks JM ----- Original Message ----- From: "S. L." <s0lao@netscape.net> To: ""Jean-Marc Paulin"" <jmp@micromuse.com>; <pgsql-cygwin@postgresql.org> Sent: Monday, June 24, 2002 6:37 AM Subject: RE: [CYGWIN] ERROR: CREATE DATABASE: could not initialize database directory > [...] > >If I run postmaster as a daemon from a cygwin telnet session, createdb works > >fine. > >If I run postmaster as a service (via the cygrunsrv), createdb return the > >error: "could not initialize database directory". > [...] > > This means the user you login to the telnet session is different from the user that executes postmaster as a service (usually SYSTEM or LocalSystem, which, usually again :), is not provided with the rights to login), and/or the options used to start the postmaster as a daemon are different from those used to start it as a service. > > [...] > >Any hints ? > > > [...] > > You must check the user context for the two cases, and make sure that you use the same command line options for postmaster when started as a service, also the environment variables. > > SLao > > > __________________________________________________________________ > Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/ > > Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/ >
Re: ERROR: CREATE DATABASE: could not initialize database directory
[...] >rows/table in existing databases. The only failure is >for the CREATE DATABASE. This is what is the most confusing for me. [...] The CREATE DATABASE needs to have the rights to do a "mkdir" in the place where $PGDATA environment variable points to, andto "cp"/configure several files after that. Actually, all I can guess is that executing postmaster as a service, there are some _cygwin_ variables in your telnet session,that the cygrunsrv command doesn't pass to the started backend. The same user would get the same environment, butnot all the time. Try a simple "bash.exe" command and a "bash.exe --login" in a cmd window, each followed by a "set" command,to see what I mean. SLao __________________________________________________________________ Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape!http://shopnow.netscape.com/ Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/