MongoDB loads but breaks, returning status=14

So im trying to setup Mongodb on Ubuntu 16.04 but im running into trouble.

when running :

sudo systemctl status mongodb

I get the following:

 mongodb.service - High-performance, schema-free document-oriented database
   Loaded: loaded (/etc/systemd/system/mongodb.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2016-09-10 14:02:22 CEST; 14s ago
     Docs: https://docs.mongodb.org/manual
  Process: 8724 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=14)
 Main PID: 8724 (code=exited, status=14)

According to the mongo-docs, status=14 is:

"Returned by MongoDB applications which encounter an unrecoverable error, an uncaught exception or uncaught signal. The system exits without performing a clean shut down."

I doesnt really point me in any particular direction.

My /etc/systemd/system/mongodb.service looks like this:

[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target

[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf

[Install]
WantedBy=multi-user.target

Any thought on what may be the cause of this?

Thank you


After googling around for a while. I found that that is because the permission setting on /var/lib/mongodb and /tmp/mongodb-27017.lock are wrong. You will have to change the owner to monogdb user

chown -R mongodb:mongodb /var/lib/mongodb
chown mongodb:mongodb /tmp/mongodb-27017.sock

sudo service mongod restart

By using this my error was gone:

  1. Go to the TMP directory: cd /tmp
  2. Check if you have the mongodb sock file: ls *.sock
  3. Change the user:group permission: chown mongodb:mongodb <YOUR_SOCK>
  4. Start MongoDB: sudo service mongod start
  5. Check the MongoDB status: sudo service mongod status

deleting the mongod sock file solved the issue for me sudo rm -rf /tmp/mongodb-27017.sock then start again sudo systemctl start mongod