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

Become a contributor for community

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

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.