Question

Mongo 7 on Ubuntu 20 fails to start

I have installed Mongo 7.0 Community on my recently updated Droplet Ubuntu 18 -> 20. Following the instrctions from here https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-20-04.

when running the sudo systemctl status mongod command I get

mongod.service - MongoDB Database Server
     Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Thu 2023-09-07 19:35:20 UTC; 6s ago
       Docs: https://docs.mongodb.org/manual
    Process: 48528 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=14)
   Main PID: 48528 (code=exited, status=14)

There were some SO that referred to changing the permissions on /var/lib/mongo I have tried that as well to no avail.


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.

This may have not been the correct way to fix this but it worked for me. I deleted everything so don’t do this if you’re upgrading/ don’t have a backup. I didn’t need one.

sudo apt-get remove mongodb-org
sudo apt-get purge mongodb-ord*
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb
sudo apt autoremove

Then started again with the directions from the post.

alexdo
Site Moderator
Site Moderator badge
September 14, 2023

You can find more detailed information about the error in the MongoDB log files. By default, MongoDB logs to /var/log/mongodb/mongodb.log.

You can view the log using a command like this:

  1. sudo cat /var/log/mongodb/mongodb.log

Look for any error messages or stack traces that may provide more context about what went wrong during startup.

  • Check for conflicting processes: Sometimes, another process might be using the same port as MongoDB, causing it to fail. You can use the netstat or ss command to check for processes listening on MongoDB’s port (default is 27017):
  1. sudo netstat -tuln | grep 27017
  • Check for available disk space: MongoDB may fail to start if there isn’t enough disk space available on your Droplet. Check the available disk space using the df command:

  • Restart MongoDB: Try restarting MongoDB to see if it resolves the issue:

  1. sudo systemctl restart mongodb

Hope that this helps!

KFSys
Site Moderator
Site Moderator badge
September 8, 2023

Heya,

From that information alone it would be very hard to pinpoint the exact issue.

Check your Error log and see what it say when you try to start your Mongo service. It should give a more detailed error and reason why this is happening.

Try DigitalOcean for free

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

Sign up

Featured on Community

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