Thread: PostgreSQL for NT
Hi,
Do I have to run Postgres from the Bash-shell?
If I try to run Postgres.exe direct from the NT-prompt I get the
following errors
C:\Program Files\pgsql\bin>ipc-daemon &
C:\Program Files\pgsql\bin>set PGDATA=../data
C:\Program Files\pgsql\bin>postgres -i &
DEBUG: Data Base System is starting up at Tue Nov 7 21:31:41 2000
DEBUG: Data Base System was interrupted being in production at Mon Nov 6 23:45
:12 2000
DEBUG: Data Base System is in production state at Tue Nov 7 21:31:42 2000
FindExec: could not find a postgres to execute...
FATAL 1: postgres: could not locate executable, bailing out...
FATAL 1: postgres: could not locate executable, bailing out...
DEBUG: Data Base System is starting up at Tue Nov 7 21:31:41 2000
DEBUG: Data Base System was interrupted being in production at Mon Nov 6 23:45
:12 2000
DEBUG: Data Base System is in production state at Tue Nov 7 21:31:42 2000
FindExec: could not find a postgres to execute...
FATAL 1: postgres: could not locate executable, bailing out...
FATAL 1: postgres: could not locate executable, bailing out...
If I run postgres.exe from the bash shell then I have no problems.
I like to run postgres as a service within NT.
gr,
Willem
Willem, On Sat, Nov 18, 2000 at 11:31:12AM +0100, W. van den Akker wrote: > Do I have to run Postgres from the Bash-shell? Since in the standard distribution postmaster is a symlink to postgres, I guess that the answer is "yes." There are other games that you could play, but... > I like to run postgres as a service within NT. Since you want to run PostgreSQL as a NT service, the simplest solution is to delete the symlink from postmaster to postgres.exe and copy postgres.exe to postmaster.exe. After performing these operations, PostgreSQL will be able to run from cmd, as an NT service (if wrapped by something like srvany or invoker), and from bash. The only downside is a little wasted disk space, but disk space is cheap and getting cheaper... I was actually thinking that may be the standard NT distribution should not contain symlinks for this exact reason. What do others think? Thanks, Jason -- Jason Tishler Director, Software Engineering Phone: +1 (732) 264-8770 x235 Dot Hill Systems Corporation Fax: +1 (732) 264-8798 82 Bethany Road, Suite 7 Email: Jason.Tishler@dothill.com Hazlet, NJ 07730 USA WWW: http://www.dothill.com
Jason, I've tried to copy the postgres.exe to postmaster.exe. After running postmaster.exe I get the following message: FindExec: could not find a postmaster to execute... postmaster: could not find postmaster to execute... Any ideas? gr, Willem ----- Original Message ----- From: "Jason Tishler" <Jason.Tishler@dothill.com> To: "W. van den Akker" <wvdakker@wilsoft.nl> Cc: <pgsql-ports@postgresql.org> Sent: Saturday, November 18, 2000 9:04 PM Subject: Re: [PORTS] PostgreSQL for NT > Willem, > > On Sat, Nov 18, 2000 at 11:31:12AM +0100, W. van den Akker wrote: > > Do I have to run Postgres from the Bash-shell? > > Since in the standard distribution postmaster is a symlink to postgres, > I guess that the answer is "yes." There are other games that you could > play, but... > > > I like to run postgres as a service within NT. > > Since you want to run PostgreSQL as a NT service, the simplest solution > is to delete the symlink from postmaster to postgres.exe and copy > postgres.exe to postmaster.exe. After performing these operations, > PostgreSQL will be able to run from cmd, as an NT service (if wrapped > by something like srvany or invoker), and from bash. The only downside > is a little wasted disk space, but disk space is cheap and getting > cheaper... > > I was actually thinking that may be the standard NT distribution should not > contain symlinks for this exact reason. What do others think? > > Thanks, > Jason > > -- > Jason Tishler > Director, Software Engineering Phone: +1 (732) 264-8770 x235 > Dot Hill Systems Corporation Fax: +1 (732) 264-8798 > 82 Bethany Road, Suite 7 Email: Jason.Tishler@dothill.com > Hazlet, NJ 07730 USA WWW: http://www.dothill.com > >
W. van den Akker writes: > FindExec: could not find a postgres to execute... > FATAL 1: postgres: could not locate executable, bailing out... > FATAL 1: postgres: could not locate executable, bailing out... > > If I run postgres.exe from the bash shell then I have no problems. The reason for this is that the program does a shell-like path walk to find itself. If you are not running a Unix-like shell then you don't have a PATH variable in the environment (or at least you have one with semicolons as separators). Using absolute file names might work. -- Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
Peter, On Sun, Nov 19, 2000 at 01:14:10AM +0100, Peter Eisentraut wrote: > W. van den Akker writes: > > > FindExec: could not find a postgres to execute... > > FATAL 1: postgres: could not locate executable, bailing out... > > FATAL 1: postgres: could not locate executable, bailing out... > > > > If I run postgres.exe from the bash shell then I have no problems. > > The reason for this is that the program does a shell-like path walk to > find itself. If you are not running a Unix-like shell then you don't have > a PATH variable in the environment (or at least you have one with > semicolons as separators). Using absolute file names might work. If postmaster.exe is a copy of postgres.exe (instead of a symlink) and I have the following defined in my environment: Path=C:\WINNT\system32;C:\Cygwin\1.1.4\bin;C:\Cygwin\1.1.4\usr\local\pgsql\bin PGDATA=/usr/local/pgsql/data then postmaster -i startups directly from cmd without any problems. Cygwin automatically converts certain environment variables between Win32 and POSIX -- PATH is one of them. So, if postgres.exe is using PATH (which seems to be implied above) when it tries to "find itself," then the "shell-like path walk" should work as expected. Jason -- Jason Tishler Director, Software Engineering Phone: +1 (732) 264-8770 x235 Dot Hill Systems Corporation Fax: +1 (732) 264-8798 82 Bethany Road, Suite 7 Email: Jason.Tishler@dothill.com Hazlet, NJ 07730 USA WWW: http://www.dothill.com
Hi,
Sorry for the delay. I have to work too.
Ok, thanks the first problem is solved, the second one came up.
I now can run the postmaster:
C:\>ipc-daemon &
C:\>postmaster -i &
DEBUG: Data Base System is starting up at Thu Nov 23 22:19:40 2000
DEBUG: Data Base System was interrupted being in production at Tue Nov 21 21:55:37 2000
DEBUG: Data Base System is in production state at Thu Nov 23 22:19:40 2000
DEBUG: Data Base System is starting up at Thu Nov 23 22:19:40 2000
DEBUG: Data Base System was interrupted being in production at Tue Nov 21 21:55:37 2000
DEBUG: Data Base System is in production state at Thu Nov 23 22:19:40 2000
But when I start the psql client on the same machine, I get:
C:\Postgres>psql -h localhost -d template1
psql: Missing or erroneous pg_hba.conf file, see postmaster log for details
psql: Missing or erroneous pg_hba.conf file, see postmaster log for details
The postmaster windows looks like:
C:\>postmaster -i &
DEBUG: Data Base System is starting up at Thu Nov 23 22:19:40 2000
DEBUG: Data Base System was interrupted being in production at Tue Nov 21 21:55:37 2000
DEBUG: Data Base System is in production state at Thu Nov 23 22:19:40 2000
process_hba_record: invalid syntax in pg_hba.conf file
Missing or erroneous pg_hba.conf file, see postmaster log for details
DEBUG: Data Base System is starting up at Thu Nov 23 22:19:40 2000
DEBUG: Data Base System was interrupted being in production at Tue Nov 21 21:55:37 2000
DEBUG: Data Base System is in production state at Thu Nov 23 22:19:40 2000
process_hba_record: invalid syntax in pg_hba.conf file
Missing or erroneous pg_hba.conf file, see postmaster log for details
I thought (perhaps a mistake) the DOS-UNIX conversion is bugging me. So I migrated pg_hba.conf to
a UNIX style text file.
The result was:
C:\Postgres>psql -h localhost -d template1
NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_log: No such file or directory
NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_variable: No such file or directory
NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_log: No such file or directory
psql: FATAL 1: cannot open relation pg_log
NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_log: No such file or directory
NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_variable: No such file or directory
NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_log: No such file or directory
psql: FATAL 1: cannot open relation pg_log
All line in pg_hba.conf are commented except this one (which looks fine to me):
host all 127.0.0.1 255.255.255.255 trust
Any help on this one?
TIA
Willem
----- Original Message -----
From: "Jason Tishler" <Jason.Tishler@dothill.com>
To: "Peter Eisentraut" <peter_e@gmx.net>
Cc: "W. van den Akker" <wvdakker@wilsoft.nl>; <pgsql-ports@postgresql.org>
Sent: Sunday, November 19, 2000 3:53 AM
Subject: Re: [PORTS] PostgreSQL for NT
>
> On Sun, Nov 19, 2000 at 01:14:10AM +0100, Peter Eisentraut wrote:
> > W. van den Akker writes:
> >
> > > FindExec: could not find a postgres to execute...
> > > FATAL 1: postgres: could not locate executable, bailing out...
> > > FATAL 1: postgres: could not locate executable, bailing out...
> > >
> > > If I run postgres.exe from the bash shell then I have no problems.
> >
> > The reason for this is that the program does a shell-like path walk to
> > find itself. If you are not running a Unix-like shell then you don't have
> > a PATH variable in the environment (or at least you have one with
> > semicolons as separators). Using absolute file names might work.
>
> If postmaster.exe is a copy of postgres.exe (instead of a symlink) and I
> have the following defined in my environment:
>
> Path=C:\WINNT\system32;C:\Cygwin\1.1.4\bin;C:\Cygwin\1.1.4\usr\local\pgsql\bin
> PGDATA=/usr/local/pgsql/data
>
> then postmaster -i startups directly from cmd without any problems.
>
> Cygwin automatically converts certain environment variables between
> Win32 and POSIX -- PATH is one of them. So, if postgres.exe is using
> PATH (which seems to be implied above) when it tries to "find itself,"
> then the "shell-like path walk" should work as expected.
>
> Jason
>
> --
> Jason Tishler
> Director, Software Engineering Phone: +1 (732) 264-8770 x235
> Dot Hill Systems Corporation Fax: +1 (732) 264-8798
> 82 Bethany Road, Suite 7 Email: Jason.Tishler@dothill.com
> Hazlet, NJ 07730 USA WWW: http://www.dothill.com
>
>
Willem, On Thu, Nov 23, 2000 at 10:33:49PM +0100, W. van den Akker wrote: > C:\Postgres>psql -h localhost -d template1 > psql: Missing or erroneous pg_hba.conf file, see postmaster log for > details The above is caused by your pg_hba.conf file being a text mode (i.e., has CRNL instead of NL line endings) file. Convert it to a binary mode file and the above error with be eliminated. My guess is that your editor accidentally converted pg_hba.conf to text mode when your were editing it. Otherwise, you installed Cygwin with text mode mounts as your default. You can determine this by using mount, as in: $ mount Device Directory Type Flags C:\Cygwin\bin /usr/bin system binmode C:\Cygwin\lib /usr/lib system binmode C:\Cygwin / system binmode ... If the Flags indicate "textmode" instead of "binmode", then execute something like the following: $ mount -f -b -s C:/Cygwin / $ mount -f -b -s C:/Cygwin/bin /usr/bin $ mount -f -b -s C:/Cygwin/lib /usr/lib Otherwise, rerun Cygwin's setup.exe and choose "Unix" for the "Default Text File Type". BTW, you may want to reinstall PostgreSQL, since other files may have been converted to text mode. Jason -- Jason Tishler Director, Software Engineering Phone: +1 (732) 264-8770 x235 Dot Hill Systems Corporation Fax: +1 (732) 264-8798 82 Bethany Road, Suite 7 Email: Jason.Tishler@dothill.com Hazlet, NJ 07730 USA WWW: http://www.dothill.com
Jason,
All mounts are in binary mode. So that sounds ok. Next I have compiled and installed postgres 7.03
like discribed in Tishlers docu. All went ok.
If I start postmaster I get:
$ DEBUG: Data Base System is starting up at Fri Dec 1 22:57:01 2000
DEBUG: Data Base System was interrupted being in production at Fri Dec 1 18:48:58 2000
DEBUG: Data Base System is in production state at Fri Dec 1 22:57:01 2000
Then I try to start psql -h localhost template1 and get:
$ psql -h localhost template1
NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_log: No such file or directory
NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_log: No such file or directory
NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_variable: No such file or directory
NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_log: No such file or directory
FATAL 1: cannot open relation pg_log
NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_variable: No such file or directory
NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_log: No such file or directory
psql: FATAL 1: cannot open relation pg_log
NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_log: No such file or directory
NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_log: No such file or directory
NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_variable: No such file or directory
NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_log: No such file or directory
FATAL 1: cannot open relation pg_log
NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_variable: No such file or directory
NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_log: No such file or directory
psql: FATAL 1: cannot open relation pg_log
The /usr/local/pgsql/data directory looks like:
$ ls -al
total 47
drwxr-xr-x 4 wvdakker None 4096 Dec 1 22:57 .
drwxr-xr-x 6 wvdakker None 0 Dec 1 16:14 ..
-rw-r--r-- 1 wvdakker None 4 Dec 1 18:30 PG_VERSION
drwxr-xr-x 3 wvdakker None 0 Dec 1 18:30 base
-rw-r--r-- 1 wvdakker None 8192 Dec 1 22:57 pg_control
-rw-r--r-- 1 wvdakker None 8192 Dec 1 18:30 pg_database
-r--r--r-- 1 wvdakker None 3407 Dec 1 18:30 pg_geqo.sample
-rw-r--r-- 1 wvdakker None 0 Dec 1 18:30 pg_group
-rw-r--r-- 1 wvdakker None 16384 Dec 1 18:30 pg_group_name_index
-rw-r--r-- 1 wvdakker None 16384 Dec 1 18:30 pg_group_sysid_index
-r--r--r-- 1 wvdakker None 5729 Dec 1 18:30 pg_hba.conf
-rw-r--r-- 1 wvdakker None 8192 Dec 1 18:30 pg_log
-rw-r--r-- 1 wvdakker None 8192 Dec 1 18:30 pg_shadow
-rw-r--r-- 1 wvdakker None 8192 Dec 1 18:30 pg_variable
drwxr-xr-x 2 wvdakker None 0 Dec 1 18:30 pg_xlog
-rw-r--r-- 1 wvdakker None 122 Dec 1 22:57 postmaster.opts
-r--r--r-- 1 wvdakker None 1 Dec 1 18:30 postmaster.opts.default
-rw-r--r-- 1 wvdakker None 4 Dec 1 22:57 postmaster.pid
total 47
drwxr-xr-x 4 wvdakker None 4096 Dec 1 22:57 .
drwxr-xr-x 6 wvdakker None 0 Dec 1 16:14 ..
-rw-r--r-- 1 wvdakker None 4 Dec 1 18:30 PG_VERSION
drwxr-xr-x 3 wvdakker None 0 Dec 1 18:30 base
-rw-r--r-- 1 wvdakker None 8192 Dec 1 22:57 pg_control
-rw-r--r-- 1 wvdakker None 8192 Dec 1 18:30 pg_database
-r--r--r-- 1 wvdakker None 3407 Dec 1 18:30 pg_geqo.sample
-rw-r--r-- 1 wvdakker None 0 Dec 1 18:30 pg_group
-rw-r--r-- 1 wvdakker None 16384 Dec 1 18:30 pg_group_name_index
-rw-r--r-- 1 wvdakker None 16384 Dec 1 18:30 pg_group_sysid_index
-r--r--r-- 1 wvdakker None 5729 Dec 1 18:30 pg_hba.conf
-rw-r--r-- 1 wvdakker None 8192 Dec 1 18:30 pg_log
-rw-r--r-- 1 wvdakker None 8192 Dec 1 18:30 pg_shadow
-rw-r--r-- 1 wvdakker None 8192 Dec 1 18:30 pg_variable
drwxr-xr-x 2 wvdakker None 0 Dec 1 18:30 pg_xlog
-rw-r--r-- 1 wvdakker None 122 Dec 1 22:57 postmaster.opts
-r--r--r-- 1 wvdakker None 1 Dec 1 18:30 postmaster.opts.default
-rw-r--r-- 1 wvdakker None 4 Dec 1 22:57 postmaster.pid
I also exported all environment variables, PGDATA PGLIB and PATH.
I'am running this on NT4 SP6.
Any ideas?
gr,
Willem
----- Original Message -----
From: "Jason Tishler" <Jason.Tishler@dothill.com>
To: "W. van den Akker" <wvdakker@wilsoft.nl>
Cc: "Peter Eisentraut" <peter_e@gmx.net>; <pgsql-ports@postgresql.org>
Sent: Monday, November 27, 2000 7:09 PM
Subject: Re: [PORTS] PostgreSQL for NT
>
> On Thu, Nov 23, 2000 at 10:33:49PM +0100, W. van den Akker wrote:
> > C:\Postgres>psql -h localhost -d template1
> > psql: Missing or erroneous pg_hba.conf file, see postmaster log for
> > details
>
> The above is caused by your pg_hba.conf file being a text mode (i.e.,
> has CRNL instead of NL line endings) file. Convert it to a binary mode
> file and the above error with be eliminated.
>
> My guess is that your editor accidentally converted pg_hba.conf to text
> mode when your were editing it. Otherwise, you installed Cygwin with
> text mode mounts as your default. You can determine this by using mount,
> as in:
>
> $ mount
> Device Directory Type Flags
> C:\Cygwin\bin /usr/bin system binmode
> C:\Cygwin\lib /usr/lib system binmode
> C:\Cygwin / system binmode
> ...
>
> If the Flags indicate "textmode" instead of "binmode", then execute
> something like the following:
>
> $ mount -f -b -s C:/Cygwin /
> $ mount -f -b -s C:/Cygwin/bin /usr/bin
> $ mount -f -b -s C:/Cygwin/lib /usr/lib
>
> Otherwise, rerun Cygwin's setup.exe and choose "Unix" for the "Default
> Text File Type".
>
> BTW, you may want to reinstall PostgreSQL, since other files may have
> been converted to text mode.
>
> Jason
>
> --
> Jason Tishler
> Director, Software Engineering Phone: +1 (732) 264-8770 x235
> Dot Hill Systems Corporation Fax: +1 (732) 264-8798
> 82 Bethany Road, Suite 7 Email: Jason.Tishler@dothill.com
> Hazlet, NJ 07730 USA WWW: http://www.dothill.com
>
>
Willem, On Fri, Dec 01, 2000 at 11:24:00PM +0100, W. van den Akker wrote: > > $ psql -h localhost template1 > NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_log: > No such file or directory > NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_log: > No such file or directory > NOTICE: mdopen: couldn't open > c:/cygwin/usr/local/pgsql/data/pg_variable: No such file or directory > NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_log: > No such file or directory > FATAL 1: cannot open relation pg_log > > [snip] > > Any ideas? I use a POSIX style path when I set PGDATA as in the following: PGDATA=/usr/local/pgsql/data I was able to reproduce your problem by setting my PGDATA variable to the my Win32 equivalent of the above POSIX style path: PGDATA=c:/cygwin/1.1.4/usr/local/pgsql/data Hence, you should be able to solve your problem by using the POSIX equivalent of your Win32 style PGDATA: PGDATA=/usr/local/pgsql/data Have you been following Kevin Lo's instructions? Please see the following: http://people.freebsd.org/~kevlo/postgres/portNT.html I have found it very helpful -- I think that you will too. Jason -- Jason Tishler Director, Software Engineering Phone: +1 (732) 264-8770 x235 Dot Hill Systems Corporation Fax: +1 (732) 264-8798 82 Bethany Road, Suite 7 Email: Jason.Tishler@dothill.com Hazlet, NJ 07730 USA WWW: http://www.dothill.com
Alrighty then, it works! Stripping c:\cygwin from the PGDATA did the trick. It indeed was mentioned in Kevin Lo's instructions. Just because I had to run it from the cmd-prompt I had to place the c:\cygwin in front of the path. Only PGDATA didn't like that. Jason, thanks very much. gr, Willem ----- Original Message ----- From: "Jason Tishler" <Jason.Tishler@dothill.com> To: "W. van den Akker" <wvdakker@wilsoft.nl> Cc: <pgsql-ports@postgresql.org> Sent: Monday, December 04, 2000 4:57 AM Subject: Re: [PORTS] PostgreSQL for NT > Willem, > > On Fri, Dec 01, 2000 at 11:24:00PM +0100, W. van den Akker wrote: > > > > $ psql -h localhost template1 > > NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_log: > > No such file or directory > > NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_log: > > No such file or directory > > NOTICE: mdopen: couldn't open > > c:/cygwin/usr/local/pgsql/data/pg_variable: No such file or directory > > NOTICE: mdopen: couldn't open c:/cygwin/usr/local/pgsql/data/pg_log: > > No such file or directory > > FATAL 1: cannot open relation pg_log > > > > [snip] > > > > Any ideas? > > I use a POSIX style path when I set PGDATA as in the following: > > PGDATA=/usr/local/pgsql/data > > I was able to reproduce your problem by setting my PGDATA variable to the > my Win32 equivalent of the above POSIX style path: > > PGDATA=c:/cygwin/1.1.4/usr/local/pgsql/data > > Hence, you should be able to solve your problem by using the POSIX > equivalent of your Win32 style PGDATA: > > PGDATA=/usr/local/pgsql/data > > Have you been following Kevin Lo's instructions? Please see the following: > > http://people.freebsd.org/~kevlo/postgres/portNT.html > > I have found it very helpful -- I think that you will too. > > Jason > > -- > Jason Tishler > Director, Software Engineering Phone: +1 (732) 264-8770 x235 > Dot Hill Systems Corporation Fax: +1 (732) 264-8798 > 82 Bethany Road, Suite 7 Email: Jason.Tishler@dothill.com > Hazlet, NJ 07730 USA WWW: http://www.dothill.com > >