Thread: Error on initdb with 7.4RC2

Error on initdb with 7.4RC2

From
Martin Marques
Date:
When running initdb on a fresh 7.4 install I get this error:

postgres@bugs:~$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data -E
latin1
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 es_AR.

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
selecting default max_connections... 10
selecting default shared_buffers... 50
creating configuration files... ok
creating template1 database in /usr/local/pgsql/data/base/1... FATAL:
semctl(1638435, 16, SETVAL, 536) failed: Argumento inválido

Any ideas on how to fix it?


--
 11:09:01 up 23 days, 18:31,  5 users,  load average: 0.46, 0.63, 0.81
-----------------------------------------------------------------
Martín Marqués        | select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica  |  DBA, Programador, Administrador
             Universidad Nacional
                  del Litoral
-----------------------------------------------------------------


Re: Error on initdb with 7.4RC2

From
Tom Lane
Date:
Martin Marques <martin@bugs.unl.edu.ar> writes:
> creating template1 database in /usr/local/pgsql/data/base/1... FATAL:
> semctl(1638435, 16, SETVAL, 536) failed: Argumento inv�lido

Hmm.  If it got that far and no farther, I'd guess you have SEMVMX
set too small.

            regards, tom lane

Re: Error on initdb with 7.4RC2

From
Martin Marques
Date:
El Vie 14 Nov 2003 12:37, Tom Lane escribió:
> Martin Marques <martin@bugs.unl.edu.ar> writes:
> > creating template1 database in /usr/local/pgsql/data/base/1... FATAL:
> > semctl(1638435, 16, SETVAL, 536) failed: Argumento inválido
>
> Hmm.  If it got that far and no farther, I'd guess you have SEMVMX
> set too small.

Is there a way of changing this value on Linux without recompiling?
I remember that on solaris I had to change a file and restart the server.

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-----------------------------------------------------------------
Martín Marqués                  |        mmarques@unl.edu.ar
Programador, Administrador, DBA |       Centro de Telemática
                       Universidad Nacional
                            del Litoral
-----------------------------------------------------------------


Re: Error on initdb with 7.4RC2

From
Tom Lane
Date:
Martin Marques <martin@bugs.unl.edu.ar> writes:
> El Vie 14 Nov 2003 12:37, Tom Lane escribi�:
>> Hmm.  If it got that far and no farther, I'd guess you have SEMVMX
>> set too small.

> Is there a way of changing this value on Linux without recompiling?

See sysctl.  But what is the current value?  I've never heard of a Linux
installation with small SEMVMX.

            regards, tom lane

Re: Error on initdb with 7.4RC2

From
Martin Marques
Date:
El Dom 16 Nov 2003 15:23, Tom Lane escribió:
> Martin Marques <martin@bugs.unl.edu.ar> writes:
> > El Vie 14 Nov 2003 12:37, Tom Lane escribió:
> >> Hmm.  If it got that far and no farther, I'd guess you have SEMVMX
> >> set too small.
>
> > Is there a way of changing this value on Linux without recompiling?
>
> See sysctl.  But what is the current value?  I've never heard of a Linux
> installation with small SEMVMX.

martin@bugs:~/latex$ cat /proc/sys/kernel/sem
250     32000   32      128

This is a Linux Kernel for SPARC (Debian) that came with the distribution (no
recompile done yet here).

martin@bugs:~/latex$ uname -a
Linux bugs 2.4.21 #1 Thu Aug 7 20:30:12 EDT 2003 sparc64 GNU/Linux

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-----------------------------------------------------------------
Martín Marqués                  |        mmarques@unl.edu.ar
Programador, Administrador, DBA |       Centro de Telemática
                       Universidad Nacional
                            del Litoral
-----------------------------------------------------------------


Re: Error on initdb with 7.4RC2

From
Tom Lane
Date:
Martin Marques <martin@bugs.unl.edu.ar> writes:
> El Dom 16 Nov 2003 15:23, Tom Lane escribi�:
>> See sysctl.  But what is the current value?  I've never heard of a Linux
>> installation with small SEMVMX.

> martin@bugs:~/latex$ cat /proc/sys/kernel/sem
> 250     32000   32      128

> This is a Linux Kernel for SPARC (Debian) that came with the distribution (no
> recompile done yet here).

As far as I can tell, SEMVMX isn't readable or writable via /proc or
sysctl in Linux at all; at least it is not visible in my Red Hat 8.0
installation.  So it's really hard to see why it'd be different in
your installation than everywhere else.

Just to make sure we're barking up the right tree, would you see whether
it helps to change this line in src/backend/port/sysv_sema.c:

#define PGSemaMagic          537             /* must be less than SEMVMX */

Try making it 100 or so instead of 537.

            regards, tom lane

Re: Error on initdb with 7.4RC2

From
Martin Marques
Date:
El Dom 16 Nov 2003 16:56, escribió:
> Martin Marques <martin@bugs.unl.edu.ar> writes:
> > El Dom 16 Nov 2003 15:23, Tom Lane escribió:
> >> See sysctl.  But what is the current value?  I've never heard of a Linux
> >> installation with small SEMVMX.
>
> > martin@bugs:~/latex$ cat /proc/sys/kernel/sem
> > 250     32000   32      128
>
> > This is a Linux Kernel for SPARC (Debian) that came with the distribution
(no
> > recompile done yet here).
>
> As far as I can tell, SEMVMX isn't readable or writable via /proc or
> sysctl in Linux at all; at least it is not visible in my Red Hat 8.0
> installation.  So it's really hard to see why it'd be different in
> your installation than everywhere else.
>
> Just to make sure we're barking up the right tree, would you see whether
> it helps to change this line in src/backend/port/sysv_sema.c:
>
> #define PGSemaMagic          537             /* must be less than SEMVMX */
>
> Try making it 100 or so instead of 537.

Same problem. Changed it and I got this:

bugs:/home/martin/basura/postgresql-7.4RC2# su - postgres
postgres@bugs:~$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data -E
latin1
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.

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
selecting default max_connections... 10
selecting default shared_buffers... 50
creating configuration files... ok
creating template1 database in /usr/local/pgsql/data/base/1... FATAL:
semctl(7766033, 16, SETVAL, 99) failed: Invalid argument

initdb: failed
initdb: removing data directory "/usr/local/pgsql/data"


Now the interesting part of all this is that, with all the initdb that failed,
lots of semaphores where been used, so when I tried this last initdb at first
I got this, which looks like I'm out of semaphores, not as in the message
from above:

postgres@bugs:~$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data -E
latin1
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.

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
selecting default max_connections... 10
selecting default shared_buffers... 50
creating configuration files... ok
creating template1 database in /usr/local/pgsql/data/base/1... FATAL:  could
not create semaphores: No space left on device
DETAIL:  Failed system call was semget(129, 17, 03600).
HINT:  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 10).
        The PostgreSQL documentation contains more information about
configuring your system for PostgreSQL.

initdb: failed
initdb: removing data directory "/usr/local/pgsql/data"


--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-----------------------------------------------------------------
Martín Marqués                  |        mmarques@unl.edu.ar
Programador, Administrador, DBA |       Centro de Telemática
                       Universidad Nacional
                            del Litoral
-----------------------------------------------------------------