Take the 2-minute tour ×
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. It's 100% free, no registration required.

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? –  FreshPhilOfSO 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
add comment

1 Answer

up vote 1 down vote accepted

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

kernel.shmmax=2147483648
kernel.shmall=2097152

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 postgresql.org/docs/8.4/static/kernel-resources.html and it is like yours :) –  Yurij73 Dec 13 '12 at 23:30
    
@Yurij73 You want postgresql.org/docs/current/static/kernel-resources.html ; 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
add comment

Your Answer

 
discard

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.