Thread: 7.3b2 initdb fails with semaphore error
Hello, I just tried installing 7.3b2 on FreeBSD 4.6.2 and received the following error: #### oot@asana> 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: Nospace 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 32). The PostgreSQL Administrator's Guide contains more information about configuring your system for PostgreSQL. initdb failed. ############### I think the bug here is that this message advertises that I can change the "max_connections" parameter to address this, but there does not appear to be a way to do this. The max_connections option is located on my system at /usr/local/share/postgresql/postgresql.conf.sample (prior to initdb) However, initdb appears to only copy the file and not actually use its parameters. If it /is/ possible to adjust max_connections prior or during the "initdb" stage, I think there is a documentation bug-- the location of that documentation should be spit out along with the above error message, along with being accessible through "initdb --help" and perhaps elsewhere. I look forward to another great release. Thanks! -mark http://mark.stosberg.com/
Mark Stosberg <mark@summersault.com> writes: > I think the bug here is that this message advertises that I can change > the "max_connections" parameter to address this, but there does not > appear to be a way to do this. The max_connections option is located > on my system at /usr/local/share/postgresql/postgresql.conf.sample > (prior to initdb) Hmm ... actually, I don't think the max_connections parameter is used during standalone operation. It looks like the code uses a hardwired value of "16". We could reduce that (there's probably no good reason why it's not "1"), but I suspect your SEMMAX parameter is so small it will fail anyway :-( Would you try changing "16" to "1" in InitCommunication() in src/backend/utils/init/postinit.c, and see if that helps on your setup? regards, tom lane
On Tue, 1 Oct 2002, Tom Lane wrote: > Mark Stosberg <mark@summersault.com> writes: > > I think the bug here is that this message advertises that I can change > > the "max_connections" parameter to address this, but there does not > > appear to be a way to do this. The max_connections option is located > > on my system at /usr/local/share/postgresql/postgresql.conf.sample > > (prior to initdb) > > Hmm ... actually, I don't think the max_connections parameter is used > during standalone operation. It looks like the code uses a hardwired > value of "16". We could reduce that (there's probably no good reason > why it's not "1"), but I suspect your SEMMAX parameter is so small > it will fail anyway :-( > > Would you try changing "16" to "1" in InitCommunication() in > src/backend/utils/init/postinit.c, and see if that helps on your > setup? Tom, I tried this change, and was able to successfully "initdb" after that, and then run "psql" after that. I'm running this installation on a home machine for light use, so I may not need 16 backends anyway. If you're correct that there is no need to have more than 1 backend during "initdb", then perhaps this could be turned into a patch. My simple patch is below: -mark http://mark.stosberg.com/ ################################ --- postinit.c.orig Wed Oct 2 12:56:13 2002 +++ postinit.c Wed Oct 2 12:56:42 2002 @@ -176,7 +176,7 @@ * postmaster. Create private "shmem" and semaphores. Setting * MaxBackends = 16 is arbitrary. */ - CreateSharedMemoryAndSemaphores(true, 16, 0); + CreateSharedMemoryAndSemaphores(true, 1, 0); } }