MongoDB is not starting. I have installed mongo and mongo was running but after reboot it is not running.
ERROR: Cannot write pid file to /var/run/mon
What worked for me in Ubuntu is a combination of the answers from @Tuan Nguyen and @Tom Carchrae
sudo kill $(sudo lsof -t -i:27017)
sudo rm -rf /tmp/mongodb-27017.sock
sudo rm -f /var/lib/mongo/mongod.lock
sudo rm -f /var/run/mongodb/mongod.pid
sudo mkdir -p /var/run/mongodb/
touch /var/run/mongodb/mongod.pid
sudo chown -R mongodb:mongodb /var/run/mongodb/
sudo chown mongodb:mongodb /var/run/mongodb/mongod.pid
You can then run
sudo service mongod start