Opened 12 years ago

Closed 6 years ago

#32817 closed defect (fixed)

postgresql91-server @9.1.2_0 initialization fails

Reported by: gthb (Gunnlaugur Thor Briem) Owned by: jyrkiwahlstedt
Priority: Normal Milestone:
Component: ports Version: 2.0.3
Keywords: lion Cc: seh@…
Port: postgresql91-server

Description

Following install of postgresql91-server, I get these instructions:

To create a database instance, after install do
 sudo mkdir -p /opt/local/var/db/postgresql91/defaultdb
 sudo chown postgres:postgres /opt/local/var/db/postgresql91/defaultdb
 sudo su postgres -c '/opt/local/lib/postgresql91/bin/initdb -D /opt/local/var/db/postgresql91/defaultdb'

The first two lines go OK, but the initdb line fails:

$ sudo su postgres -c '/opt/local/lib/postgresql91/bin/initdb -D /opt/local/var/db/postgresql91/defaultdb'
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
could not identify current directory: Permission denied
could not identify current directory: Permission denied
could not identify current directory: Permission denied
The program "postgres" is needed by initdb but was not found in the
same directory as "initdb".
Check your installation.

The permissions look OK to me:

$ ls -ld /opt/local/var/db/postgresql91/defaultdb
drwxr-xr-x  2 postgres  postgres  68  9 jan 11:51 /opt/local/var/db/postgresql91/defaultdb

$ ls -ld /opt/local/var/db/postgresql91
drwxr-xr-x  3 root  admin  102  9 jan 11:51 /opt/local/var/db/postgresql91

$ ls -ld /opt/local/lib/postgresql91/bin/{initdb,postgres}
-rwxr-xr-x  1 root  admin    71336  9 jan 11:49 /opt/local/lib/postgresql91/bin/initdb
-rwxr-xr-x  1 root  admin  5329336  9 jan 11:49 /opt/local/lib/postgresql91/bin/postgres

$ ls -ld /opt/local/lib/postgresql91/bin
drwxr-xr-x  25 root  admin  850  9 jan 11:49 /opt/local/lib/postgresql91/bin

so I don't know what this is about.

The same happens with postgresql90-server. I have postgresql84-server installed and have been using it without problems for a long time.

I'm on Lion, in case this is specific to that:

$ port platform
Platform: darwin 11 i386

Change History (6)

comment:1 Changed 12 years ago by seh@…

Cc: seh@… added

Cc Me!

comment:2 Changed 12 years ago by seh@…

I see the same problem in conjunction with the pg_ctl program. If I first change directories into the PostgreSQL bin directory and run the same command, it works as expected.

comment:3 Changed 12 years ago by gthb (Gunnlaugur Thor Briem)

Yep, that worked for me too.

comment:4 Changed 7 years ago by mf2k (Frank Schima)

Cc: mww@… jyrkiwahlstedt removed
Owner: changed from macports-tickets@… to jyrkiwahlstedt
Status: newassigned

comment:5 in reply to:  2 Changed 7 years ago by paxperscientiam (Chris)

Replying to seh@…:

I see the same problem in conjunction with the pg_ctl program. If I first change directories into the PostgreSQL bin directory and run the same command, it works as expected.

Five years later, this is still the case.

comment:6 Changed 6 years ago by jmroot (Joshua Root)

Resolution: fixed
Status: assignedclosed

In a2ce1b3d3f2dbd9b776c7c72fd8c14c709252c77/macports-ports (master):

postgresql9{1,2,3,4}-server: fix db creation notes

Running the previously suggested command from a directory not readable
by the postgres user would fail.

Maintainer timeout.
Fixes: #32817
Fixes: #39341
Fixes: #49095

Note: See TracTickets for help on using tickets.