Postgresql — could not create shared memory segment: Invalid argument (shmget)

If your new postgresql settings are causing your postgres server to not start with this error, it helpfully reminds you that it’s probably due to the kernel’s SHMMAX parameter being too low.

* Restarting PostgreSQL 8.4 database server
* The PostgreSQL server failed to start. Please check the log output:
2011-11-04 05:06:26 UTC FATAL: could not create shared memory segment: Invalid
2011-11-04 05:06:26 UTC DETAIL: Failed system call was shmget(key=5432001, size
=161849344, 03600).
2011-11-04 05:06:26 UTC HINT: This error usually means that PostgreSQL’s reques
t 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 161849344 bytes), reduce PostgreSQL’s shared
_buffers parameter (currently 19200) and/or its max_connections parameter (curre
ntly 53).
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 recon
figuring SHMMIN is called for.
The PostgreSQL documentation contains more information about shared memo
ry configuration.

On my ubuntu system, the shmmax was 32 mb or something like that.

Check your systems shmmax

$> sudo cat /proc/sys/kernel/shmmax/

Set a new shmmax value

As usual, I blog about this stuff when it breaks, so when I saw this, I just searched yuji shmmax.

$> sysctl -w kernel.shmmax=BYTES

Make shmmax persist across a reboot

The setting clearly didn’t persist when I last rebooted a few minutes ago and caused my postgres to fail.

$> sudo vim /etc/sysctl.conf
# add kernel.shmmax = bytes
kernel.shmmax = 134217728

5 thoughts on “Postgresql — could not create shared memory segment: Invalid argument (shmget)

  1. With these dresses,you are going to seem as a famous star on the red carpet that many people can’t help to pay close attention to you. That is what had so long been hoped for by many, not only on the shopping end of the spectrum, but also by these in the fashion industry envisioning stunning creations for ladies of all ages, shapes, and sizes. Dressing up for an evening revelry is actually noteworthy for any lady and it adds an exceptional feeling of jubilation in her.

  2. There are several possibilities in which your Long Beach psoriasis dermatologist can discuss with you. Depending on the severity of the disorder, there are many different treatment options to try. You may be wondering, “How’d I get scalp psoriasis.

  3. The depression experienced alongside CFS may be chemically induced, due to a serotonin and norepinephrine imbalance, as well as a consequence of external events, such as severe pain, disability, and hopelessness due to lack of treatment options. If they start to experience other complications, they will need to get those tested immediately to ensure that they do not have another medical condition. Other researchers also began to investigate whether it could be theoretically possible to unblock the lymphatic drainage system with massage techniques.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s