guy labs guy labs

PostgreSQL – CET FATAL: could not create shared memory segment

Lately I updated to the latest PostgreSQL from the Ubuntu repositories and then I got the error “CET FATAL: could not create shared memory segment”.

As the following error message states, the SHMMAX  value of the kernel is too less or the shared memory propery of PostgreSQL is too high.

The complete error message looked like this:

My solution was to increase the SHMMAX  kernel parameter as I have a lot of memory left on my server.

To see the current value of your SHMMAX  parameter execute the following command :

And to check the size of the shared memory of your PostgreSQL instance open up the file /etc/postgresql/<version>/main/postgresql.conf  and search for the parameter shared_buffers .

To increase the SHMMAX  parameter of your system you need to edit the /etc/sysctl.conf  file and add the following at the end of the file:

That would increase the SHMMAX  value to 100 mega bytes (104857600 bytes).

Next you need to reload the sysctl file with the following command:

After that you should be able to restart the PostgreSQL server without any problems.

Cheers and have a nice weekend,

Guy

28,674 total views, 2 views today

Share Post :

2 Comments

  • humberto fuentealba
    March 31, 2016 8:17 PM at 8:17 PM 

    Great solution!

    After RTFM, this was just what i needed.

  • Gorgias Lee
    October 8, 2016 10:50 AM at 10:50 AM 

    Thanks!

Leave a Reply

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.