Question

Postgres not able to start

I have a problem with postgres not being able to start:

  • Starting PostgreSQL 9.5 database server * The PostgreSQL server failed to start. Please check the log output: 2016-08-25 04:20:53 EDT [1763-1] FATAL: could not map anonymous shared memory: Cannot allocate memory 2016-08-25 04:20:53 EDT [1763-2] HINT: This error usually means that PostgreSQL’s request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 1124007936 bytes), reduce PostgreSQL’s shared memory usage, perhaps by reducing shared_buffers or max_connections. This is the response that I got. I checked the log in tail -f /var/log/postgresql/postgresql-9.5-main.logand I can see the same response.

Can someone suggest what can be the problem?

I used following commands to stop/start the postgres server on Ubuntu 14.04 with postgres 9.5:

sudo service postgresql stop sudo service postgresql start


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Ryan Quinn
DigitalOcean Employee
DigitalOcean Employee badge
August 25, 2016
Accepted Answer

As the error message indicates, you appear to not have enough available memory to start the service. You can check your available memory at any time by running the command:

free -m

When you see this error, aside from the suggestions for optimizations presented by the error message you can also add a swap file and/or upgrade to a larger droplet in order to have more memory+swap available for the PostgreSQL process.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel