Mongod Service start exits with code 100
I know it's quite late, but maybe this will help someone in need.
I checked the /var/log/mongodb and found this:
Failed to unlink socket file /tmp/mongodb-27017.sock Operation not permitted
I guess that permission is set to root, not mongodb because I used sudo to start mongod. (Maybe someone can help clarifying this)
So the solution is to delete that /tmp/mongodb-27017.sock
and restart the service again. At least that worked for me. (Sorry for my bad English)
https://mkyong.com/mongodb/mongodb-failed-to-unlink-socket-file-tmpmongodb-27017/
Remove the mongod.lock
file under 'dbath'
, and it should start without issues.
You may still have some problems with the permissions in your data directory. Especially if you have run mongod from the terminal to start with.
I find that the data files are created under root not the mongodb user when you run from the terminal. To fix ..
sudo chown -R mongodb:mongodb /var/lib/mongodb/*
rm /var/lib/mongodb/mongod.lock
systemctl restart mongod
systemctl status mongod
Try this!