Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create a new base /usr/pgsql/bin/initdb -D /var/lib/pgsql/data --locale=en_USand got the following:

creating template1 database in /var/lib/pgsql/data/base/1 ... FATAL:  could not create shared memory segment: Invalid argument
DETAIL:  Failed system call was shmget(key=1, size=35233792, 03600).
... To reduce the request size (currently 35233792 bytes), reduce PostgreSQL's shared_buffers parameter (currently 3584) and/or its max_connections parameter (currently 104).
If the request size is already small, it's possible that it is less than your kernel's SHMMIN parameter, in which case raising the request size or reconfiguring SHMMIN is called for

How to fix this? Where can I change these SHMMAX and SHMIN? Do I really need to recompile the linux kernel as PostgreSQL advises me?

share|improve this question
What Linux distribution? – Phil Dec 13 '12 at 22:34
all is done, and rock now. Linux is a Fuduntu (fork of Fedora 14) – Yurij73 Dec 13 '12 at 23:33
Please always mention your PostgreSQL version in questions. – Craig Ringer Dec 14 '12 at 0:53
up vote 1 down vote accepted

As the root user, edit /etc/sysctl.conf and add the following lines:


Then run:

sysctl -p

.. to reload the kernel settings.

That'll set the maximum shared memory segment size to 2Gb & should solve your issue.

share|improve this answer
Thanks, all done! just found answer on and it is like yours :) – Yurij73 Dec 13 '12 at 23:30
@Yurij73 You want ; if you link to the /current/ version of the docs it'll help stop stale links appearing in Google. – Craig Ringer Dec 14 '12 at 0:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.