I have tried all previous commands like
sudo chmod -R 0777 /var/lib/mongodb
sudo rm /var/lib/mongodb/mongod.lock
sudo mongod --repair
sudo service mongod start
sudo service mongod status
first command saying that file not availableand not removed i also gave the all priveleges to it
sudo chown -R mongodb:mongodb /var/lib/mongodb
but its not showing any thing also repairing commands not working also restart ubantu but still not working
CodePudding user response:
When debugging any problems with a service on Ubuntu try this:
# cat /var/log/messages
There you may find out more information about the problem.
Also, in your case mongod should be logging to a folder like
/var/log/mongod
Or something similar, and for that to happen the mongo
user should have permissions to write there.
Allways look for the log, every service will log something either to their own file or to a system log. And hopefully inside that log you’ll find the concrete problem that’s preventing your service from starting.