After installing postgresql-8.4 from the Ubuntu repos on an Ubuntu 9.10 machine, I received the following when the daemon tried to start up:
1 2 3 4 5 6 7 | * The PostgreSQL server failed to start. Please check the log output: FATAL: could not create shared memory segment: Invalid argument DETAIL: Failed system call was shmget(key=5433001, size=35233792, 03600). 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 35233792 bytes), reduce PostgreSQL's shared_buffers parameter (currently 4096) and/or its max_connections parameter (currently 13). 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. The PostgreSQL documentation contains more information about shared memory configuration. [fail] |
Fail indeed. Here’s the fix:
1 2 3 4 | sudo cp /etc/sysctl.conf /etc/sysctl.conf-orig && sudo sh -c 'echo "#\n# For postgres\nkernel.shmmax = 104857600" >> /etc/sysctl.conf' && sudo sysctl -p && sudo /etc/init.d/postgresql-8.4 start |
This increases a particular kernel parameter to allow postgres enough memory to start. Yay for poor defaults…
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.









Excellent, just what happened to me. Thanks for this!
Thanks! Great fix and instructions.
Thanks, mate, You really made my day!
Thanks man! You saved me a lot of time and pain!
Hey Samuel,
I am on ubuntu lucid x64. Am facing the same issue and this soln don’t seem to work.
Any other ideas?
Thanks.
Hi Samuel,
Got it up & running again. Pls ignore my previous comment.
Many Thanks..
This worked for me too. Thanks a lot!
Thanks..Really its working for me
Since last 1 monthi was trying to solve this error but it was not going from my PC but not its working..
thanks once again thanks a lot..
Thank you Samuel.
This worked for me.
Thanks,
Happened to me after upgrade to 12.04 LTS Polished Penguin.