Breaking PostgreSQL Upgrading Ubuntu

If you've altered your stock standard postgresql.conf configuration file of your Ubuntu server and upgraded to the lastest release, there is a good chance you'll get an error like:


FATAL: could not create shared memory segment: Invalid argument
DETAIL:  Failed system call was shmget(key=5432001, size=72302592, 03600).

If you get an error like that, it will be because your systems SHMMAX isn't set in sysctl . Its an easy fix, all you need to know is how big your SHMMAX needs to be. This issue is most likely related with the shared_buffers parameter of postgresql.conf - you systems shmmax needs to meet or exceed this limit, but DON'T GO OVER YOUR RAM LIMIT. SHMMAX defines you systems shared memory maximum. My shared_buffers is 512MB and I set my SHMMAX to 2GB because I have 2GB of RAM, though setting it to 1GB would have been fine. To find out if your system has a shmmax value set do:

sysctl -a | grep shmmax

you should find something like kernel.shmmax=2147483648, if not, then this is probably why you can't start postgreSQL, simply set the value and start postgreSQL:

sudo sysctl -w kernel.shmmax=2147483648 #2GB in bytes
sudo /etc/init.d/postgresql-8.3 start

Hope all goes well ;)

This is the most

This is the most straightforward solution I could find to the problem. All the ubuntu guys are arguing that its an upstream problem, all the Postgres guys are arguing that its a distro/kernel problem. Arrrg!
Thanks!

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <h2><h3><h4><a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <div> <span>
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Glossary terms will be automatically marked with links to their descriptions. If there are certain phrases or sections of text that should be excluded from glossary marking and linking, use the special markup, [no-glossary] ... [/no-glossary]. Additionally, these HTML elements will not be scanned: a, abbr, acronym, code, pre.
  • You may insert videos with [video:URL]

More information about formatting options