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 mongodbI 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: 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.targetAny thought on what may be the cause of this?
Thank you
210 Answers
After googling around for a while. I found that that is because the permission settings on/var/lib/mongodb and /tmp/mongodb-27017.lock are wrong. You will have to change the owner to monogdb user
sudo chown -R mongodb:mongodb /var/lib/mongodb
sudo chown mongodb:mongodb /tmp/mongodb-27017.sockthen
sudo service mongod restart 11 By using this my error was gone:
- Go to the
TMPdirectory:cd /tmp - Check if you have the mongodb sock file:
ls *.sock - Change the user:group permission:
chown mongodb:mongodb <YOUR_SOCK> - Start MongoDB:
sudo service mongod start - Check the MongoDB status:
sudo service mongod status
deleting the mongod sock file solved the issue for me sudo rm -rf /tmp/mongodb-27017.sockthen start again sudo systemctl start mongod
- Check for both mentioned directories If they don't exist, use the following commands:
sudo mkdir /var/lib/mongodb
sudo mkdir /var/log/mongodb
sudo chown -R mongodb:mongodb /var/lib/mongodb
sudo chown -R mongodb:mongodb /var/log/mongodb- Clear the socket with the following command:
chown mongodb:mongodb /tmp/mongodb-27017.sock- Restart and check the status of the service:
sudo service mongod restart 1 i tried this and it worked :
sudo nano /etc/mongod.confcomment the "bind ip" line.
sudo mongod --auth --port 27017 --dbpath /data/dbthen i ran
sudo service mongod restart for beginners only if you are trying the following and getting errors :
sudo chown -R mongodb:mongodb /var/lib/mongodb sudo chown mongodb:mongodb /tmp/mongodb-27017.sock sudo service mongod restartthen try checking the status
sudo systemctl status mongodit will show active ..
I also got status 14 at some point, but it was not because of my .lock files.
Looks like everything in your dbPath (in my case /data/mongodb) should belong to mongodb. In my case, two files and files in the journal folder were owned by root, possibly because I have run the mongod command with sudo instead of the mongodb user (as configured in mongod.service).
sudo chown mongodb:mongodb /data/mongodb/ -RIn order to find my problem, it helped to set the verbosity to 5 in /etc/mongod.conf:
systemLog: verbosity: 5and run tail /var/log/mongodb/mongodb.log -n 100 after sudo systemctl start mongod
For this to work, mongod.conf needs to be loaded by mongod. mongod.service does that with the --config parameter.
Make sure to remove the high verbosity when your mongodb works again, because that logfile can grow very large.
My /var/lib/mongodb was corrupt, rming it and reinstalling mongo worked.
This error occurred for me just because the disk space was full. And solved after deleting some unused files.
In my case, it was because of an incomplete repair operation, in which case I had to run mongod --repair --dbpath /var/lib/mongodb.
More in general
"Zoraya ter Beek, age 29, just died by assisted suicide in the Netherlands. She was physically healthy, but psychologically depressed. It's an abomination that an entire society would actively facilitate, even encourage, someone ending their own life because they had no hope. Th…"