0

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?

3
  • What Linux distribution? Commented Dec 13, 2012 at 22:34
  • all is done, and rock now. Linux is a Fuduntu (fork of Fedora 14) Commented Dec 13, 2012 at 23:33
  • Please always mention your PostgreSQL version in questions. Commented Dec 14, 2012 at 0:53

1 Answer 1

1

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.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.