MongoDB (code=exited, status=14)
1 min readAug 23, 2019
Hi, here is a quick tip if you get this annoying problem when you install MongoDB in linux.
When you start your MongoDB through:
service mongod start
and in result you got this error :
● mongod.service - MongoDB Database Server
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2019-08-23 05:33:57 UTC; 4s ago
Docs: https://docs.mongodb.org/manual
Process: 29284 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=14)
Process: 29281 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 29278 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 29276 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)
Main PID: 25199 (code=exited, status=0/SUCCESS)
this code problem means that your mongodb SOCK dont belong to mongodb user. So here is a quick fix :
- Go to
/tmp
and find mongodb sock
cd /tmp; ls -l *.sock
2. Change the owner of that .sock file, it used to named as mongodb-27017.sock, but if you find it in a different name, its ok.
chown mongod:mongod mongodb-27017.sock
if the result come like this chown: invalid user: 'mongod:mongod'
then it means that the user and group for mongodb was not mongod.
you can find the right username in the list of user in /etc/passwd
file.