Getting following error while trying to start postgres
* The PostgreSQL server failed to start. Please check the log output:
2013-05-29 14:29:02 IST FATAL: could not create shared memory segment: Invalid argument
2013-05-29 14:29:02 IST DETAIL: Failed system call was shmget(key=5432001, size=39321600, 03600).
2013-05-29 14:29:02 IST HINT: This error usually means that PostgreSQL’s request for a shared memory segment exceeded your kernel’s SHMMAX parameter. You can either reduce the request size or reconfigure the kernel with larger SHMMAX. To reduce the request size (currently 39321600 bytes), reduce PostgreSQL’s shared memory usage, perhaps by reducing shared_buffers or max_connections.
The simple solution for above problem is
go to /etc/sysctl.d/30-postgresql-shm.conf file and add or change this line in the file
kernel.shmmax = 41943040
and then run the command sudo sysctl -p
now you can start your postgres 🙂