Re: initdb problem

From: Joe Barwell <jbar(at)es(dot)co(dot)nz>
To: <pgsql-admin(at)postgresql(dot)org>
Subject: Re: initdb problem
Date: 2007-06-25 00:53:56
Message-ID: 467f1224.36e.6f0c.593953963@ihug.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

John DeSoi <desoi(at)pgedit(dot)com> wrote:

>This has got to be the longest thread ever to get
PostgreSQL running
on the Mac -- but I'm glad you have not given up :).

Hi John,

Partly it's because I don't have much time to spend
investigating this, partly it's a very positive reflection
of the great willingness of so many people on this
forum--such as yourself--to help novices like me. Many
thanks, all.

> acorn$ sudo su postgres -c 'pg_ctl start -l logfile -D
> /Library/PostgreSQL8/data'
> Password:
> sh: line 1: logfile: Permission denied
> server starting

>Since you did not specify the full path for the log file, I
assume it
is created in the current directory. Check your permissions
there.

I tried this:

sudo su postgres -c 'pg_ctl start -l
/Library/PostgreSQL8/logfile -D /Library/PostgreSQL8/data'

and terminal said server starting, & no complaints. I then
viewed the logfile (which was created where specified), and
it showed:

postgres cannot access the server configuration file
"/Library/PostgreSQL8/data/postgresql.conf": No such file or
directory

So I think it's confirming the problem lies with initdb.

>Change to the data directory and see what is there. If you
don't see
lots of folders along with pg_hba.conf and postgresql.conf,
then
initdb did not work.

/data is empty.

>At the risk of sending you down another path when you are
close, you
might want to look at this distribution and instructions:
>http://www.entropy.ch/software/macosx/postgresql/

That url says:

Versions 8.1.3 and up have been tested and will work on Mac
OS X version 10.4/Tiger only. The software is built as
Universal Binary and will run natively on PPC and Intel
Macs.

NOTE: On Mac OS X 10.3 (and possibly later), it seems you
have to adjust some system configuration parameters first.

The advice there (about putting values in an /etc/rc file)
seems to contradict, or possibly be superceded by, the info
in the pg docs:
<PostgreSQL8/doc/postgresql/html/kernel-resources.html#SYSVIPC>
, which states:

----

MacOS X

In OS X 10.2 and earlier, edit the file
/System/Library/StartupItems/SystemTuning/SystemTuning and
change the values in the following commands:

sysctl -w kern.sysv.shmmax
sysctl -w kern.sysv.shmmin
sysctl -w kern.sysv.shmmni
sysctl -w kern.sysv.shmseg
sysctl -w kern.sysv.shmall

In OS X 10.3 and later, these commands have been moved
to /etc/rc and must be edited there. Note that /etc/rc is
usually overwritten by OS X updates (such as 10.3.6 to
10.3.7) so you should expect to have to redo your editing
after each update.

In OS X 10.3.9 and later, instead of editing /etc/rc you
may create a file named /etc/sysctl.conf, containing
variable assignments such as

kern.sysv.shmmax=4194304
kern.sysv.shmmin=1
kern.sysv.shmmni=32
kern.sysv.shmseg=8
kern.sysv.shmall=1024

This method is better than editing /etc/rc because your
changes will be preserved across system updates. Note that
all five shared-memory parameters must be set in
/etc/sysctl.conf, else the values will be ignored.

Beware that recent releases of OS X ignore attempts to
set SHMMAX to a value that isn't an exact multiple of 4096.

SHMALL is measured in 4 kB pages on this platform.

In all OS X versions, you'll need to reboot to make
changes in the shared memory parameters take effect.

----

I'm running 10.3.9, so last week I created the
/etc/sysctl.conf file in vi, using the values shown above,
rebooted, but still got/get the same problems with initdb.

I've just rebooted, & ran the following (a list member
advised me off-list to try creating the cluster in a "fresh"
dir.):

acorn$ sudo mkdir /data
Password:
acorn$ cd /
acorn$ sudo chown postgres:postgres /data
acorn$ sudo su postgres -c 'initdb -D /data'
The files belonging to this database system will be owned by
user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale C.

fixing permissions on existing directory /data ... ok
creating subdirectories ... ok
selecting default max_connections ... 10
selecting default shared_buffers/max_fsm_pages ...
400kB/20000
creating configuration files ... ok
creating template1 database in /data/base/1 ... FATAL:
could not create shared memory segment: Cannot allocate
memory
DETAIL: Failed system call was shmget(key=2, size=1646592,
03600).
HINT: This error usually means that PostgreSQL's request
for a shared memory segment exceeded available memory or
swap space. To reduce the request size (currently 1646592
bytes), reduce PostgreSQL's shared_buffers parameter
(currently 50) and/or its max_connections parameter
(currently 10).
The PostgreSQL documentation contains more
information about shared memory configuration.
child process exited with exit code 1
initdb: removing contents of data directory "/data"

Should I uninstall pg 8.2.4 & try with an earlier version,
even though the docs. seem to imply 8.2.4 should work with
10.3.9?

Cheers!

Joe

Browse pgsql-admin by date

  From Date Subject
Next Message Joe Barwell 2007-06-25 00:54:51 Re: initdb problem
Previous Message Tommy Gildseth 2007-06-24 20:06:58 Re: Load DB - Conversion from 8.1.4 to 8.2.4