This error is accompanied by a suggestion to change SEMMNI or SEMMNS. In this case, that suggestion is not appropriate.
Read below for
the scenario.
Suggestion: Can we modify the error message to include checking for a
running postmaster?
Reasoning:
During my dbinit, I found the following error message.
# su -l pgsql -c initdb
The files belonging to this database system will be owned by user
"pgsql".
This user must also own the server process.
The database cluster will be initialized with locale C.
creating directory /usr/local/pgsql/data... ok
creating directory /usr/local/pgsql/data/base... ok
creating directory /usr/local/pgsql/data/global... ok
creating directory /usr/local/pgsql/data/pg_xlog... ok
creating directory /usr/local/pgsql/data/pg_clog... ok
creating template1 database in /usr/local/pgsql/data/base/1...
IpcSemaphoreCreate: semget(key=1, num=17, 03600) failed: No space
left on device
This error does *not* mean that you have run out of disk space.
It occurs when either the system limit for the maximum number of
semaphore sets (SEMMNI), or the system wide maximum number of
semaphores (SEMMNS), would be exceeded. You need to raise the
respective kernel parameter. Alternatively, reduce PostgreSQL's
consumption of semaphores by reducing its max_connections parameter
(currently 1).
The PostgreSQL Administrator's Guide contains more information about
configuring your system for PostgreSQL.
initdb failed.
Removing /usr/local/pgsql/data.
###
Here's what happened:
I removed the old installs of pg (pkg_delete postgresql-7.2.3 &&
pkg_delete postgresql-devel-7.3.rc1 ; this is a FreeBSD box), then
installed 7.3. But I did not first stop the postmaster. Then I ran
initdb, and the first message was:
###
initdb: The directory /usr/local/pgsql/data exists but is not empty.
If you want to create a new database system, either remove or empty
the directory /usr/local/pgsql/data or run initdb with
an argument other than /usr/local/pgsql/data.
###
So I moved it out of the way:
# mv /usr/local/pgsql/data /usr/local/pgsql/data.old
That's when I encountered the message mentioned in the subject.
The solution involved:
# mv /usr/local/pgsql/data.old /usr/local/pgsql/data
# /usr/local/etc/rc.d/010.pgsql.sh stop
# mv /usr/local/pgsql/data /usr/local/pgsql/data.old
# su -l pgsql -c initdb
Then the initdb ran successfully.
--
Dan Langille : http://www.langille.org/