Ubuntu – MongoDB loads but breaks, returning status=14

mongodb

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

Best Answer

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
Related Question