Thread: Error: shmget failed

Error: shmget failed

From
Roberto Joao Lopes Garcia
Date:
Hi

Sorry if it´s the wrong place to post this. Please let me know where is the
correct place.

I'm upgrading from PostgreSQL 6.4 to 6.5.2. I compiled 6.5.2 and installed
it in an machine (that was not running 6.4) for tests but Postmaster want
not run.

Os: Sun sparc solaris 2.5
compiled with GCC 2.8.1, FLEX 2.5.4

Compilation and install runs OK! 
Initidb could not tell what username to use (I was su postgres) so I tried
initdb -u postgres and works, see bellow:

$ LD_LIBRARY_PATH=/usr/local/pgsql/lib
$ export  LD_LIBRARY_PATH
$
initdb

Can't tell what username to use.  You don't have the
USER
environment variable set to your username and didn't specify the

--username option
$ initdb -u postgres

We are initializing the database
system with username postgres (uid=1156).
This user will own all the files
and must also own the server process.

Creating Postgres database system
directory /usr/local/pgsql/data

Creating Postgres database system
directory /usr/local/pgsql/data/base

Creating template database in
/usr/local/pgsql/data/base/template1

Creating global classes in
/usr/local/pgsql/data/base

Adding template1 database to
pg_database...

Vacuuming template1
Creating public pg_user view
Creating
view pg_rules
Creating view pg_views
Creating view pg_tables
Creating view
pg_indexes
Loading pg_description
$

I tried to start postmaster and it report an error, see bellow:

$ nohup  postmaster -i > pserver.log 2>&1 &
[1]    17192
$ ps -ef | grep
post
postgres  6006   529  0 10:22:05 pts/1    0:00 ksh
postgres 17225
6006  1 11:01:41 pts/1    0:00 grep post
[1] +  Done
nohup  postmaster -i > pserver.log 2>&1 &
$ cat
pserver.log
IpcMemoryCreate: shmget failed (Invalid argument) key=5432001,
size=1073152, permission=600
FATAL 1:  ShmemCreate: cannot create region
$  
I have tried 3 times this installation and the result is the same. I
installed 6.5.2 in my house linux machine and work well.

Thank you for your attention

Roberto



Re: [HACKERS] Error: shmget failed

From
Tom Lane
Date:
Roberto Joao Lopes Garcia <roberto@mha.com.br> writes:
> I tried to start postmaster and it report an error, see bellow:
> IpcMemoryCreate: shmget failed (Invalid argument) key=5432001,
> size=1073152, permission=600
> FATAL 1:  ShmemCreate: cannot create region

As a quick hack you can start the postmaster with smaller-than-
normal -B and -N (say -B 40 -N 20).  Long term solution is to
increase your kernel's SHMMAX limit to more than 1 megabyte.

I thought we had adjusted the default -B and -N to stay just
under a meg, which is the default SHMMAX value on many kernels.
But it looks like someone chewed up some more shared memory when
I wasn't looking :-(.
        regards, tom lane


Re: [HACKERS] Error: shmget failed

From
Bruce Momjian
Date:
> Roberto Joao Lopes Garcia <roberto@mha.com.br> writes:
> > I tried to start postmaster and it report an error, see bellow:
> > IpcMemoryCreate: shmget failed (Invalid argument) key=5432001,
> > size=1073152, permission=600
> > FATAL 1:  ShmemCreate: cannot create region
> 
> As a quick hack you can start the postmaster with smaller-than-
> normal -B and -N (say -B 40 -N 20).  Long term solution is to
> increase your kernel's SHMMAX limit to more than 1 megabyte.
> 
> I thought we had adjusted the default -B and -N to stay just
> under a meg, which is the default SHMMAX value on many kernels.
> But it looks like someone chewed up some more shared memory when
> I wasn't looking :-(.

7.0 backend will point them to FAQ on such errors.

--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: [HACKERS] Error: shmget failed - SOLVED!

From
Roberto Joao Lopes Garcia
Date:
Hi

To change maximun Shared Memory segment size in my Sparc Solaris 2.5, I
have to add the following line into /etc/system file and then reboot the
system
set  shmsys:shminfo_shmmax=268435456

It solved the problem. 

Also, Solaris ANSWER BOOK recomends to change the follow. Please note that
I do not test the lines bellow in my system, only the above change in
/etc/system solved the problem.
set  semsys:seminfo_semmap=250set  semsys:seminfo_semmni=500set
semsys:seminfo_semmns=500set  semsys:seminfo_semmsl=500set
semsys:seminfo_semmnu=500set  semsys:seminfo_semume=100set
semsys:seminfo_shmmin=200set  semsys:seminfo_shmmni=200set
semsys:seminfo_shmseg=200

To see the actual system sets one can use the command sysdef that, in my
system produce the follow:

#sysdef... ...
*
* IPC Semaphores
*   10    entries in semaphore map (SEMMAP)   10
semaphore identifiers (SEMMNI)   60    semaphores in system (SEMMNS)   30
undo structures in system (SEMMNU)   25    max semaphores per id (SEMMSL)
10    max operations per semop call (SEMOPM)   10    max undo entries per
process (SEMUME)32767    semaphore maximum value (SEMVMX)16384    adjust on
exit max value (SEMAEM)
*
* IPC Shared Memory
*
268435456    max shared memory
segment size (SHMMAX)    1    min shared memory segment size (SHMMIN)  100
shared memory identifiers (SHMMNI)    6    max attached shm segments per
process (SHMSEG)
*
* Time Sharing Scheduler Tunables
*
60    maximum time
sharing user priority (TSMAXUPRI)
SYS    system class name (SYS_NAME)
# 

Please read the man pages before execute this command or the changes showed
above.

Thank you for you help

Roberto

At 12:51 26/10/99 -0400, you wrote:
>> Roberto Joao Lopes Garcia <roberto@mha.com.br> writes:
>> > I tried to start postmaster and it report an error, see bellow:
>> > IpcMemoryCreate: shmget failed (Invalid argument) key=5432001,
>> > size=1073152, permission=600
>> > FATAL 1:  ShmemCreate: cannot create region
>> 
>> As a quick hack you can start the postmaster with smaller-than-
>> normal -B and -N (say -B 40 -N 20).  Long term solution is to
>> increase your kernel's SHMMAX limit to more than 1 megabyte.
>> 
>> I thought we had adjusted the default -B and -N to stay just
>> under a meg, which is the default SHMMAX value on many kernels.
>> But it looks like someone chewed up some more shared memory when
>> I wasn't looking :-(.
>
>7.0 backend will point them to FAQ on such errors.
>
>-- 
>  Bruce Momjian                        |  http://www.op.net/~candle
>  maillist@candle.pha.pa.us            |  (610) 853-3000
>  +  If your life is a hard drive,     |  830 Blythe Avenue
>  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
>
>************
>
>