MongoDB service not working after upgrade to Ubuntu 15.04

mongodbUbuntu

I have recently upgraded my Ubuntu from 14.10 to 15.04. All features seems to be working fine except MongoDB. It is not controllable from service as we do normally in Ubuntu.

sudo service mongodb start

or

sudo service mongod start

I get this error message

Failed to restart mongod.service: Unit mongod.service failed to load:
No such file or directory.

But I have to start it manually each time I have to connect my application to MongoDB server using

sudo mongod -f /etc/mongod.conf

So MongoDB is connected as long as that terminal is opened. I am using MongoDB in Ruby on Rails application using Mongoid adapater/ORM. Any help in this regard will be appreciated.

Best Answer

Since your error is:

Failed to restart mongod.service: Unit mongod.service failed to load: No such file or directory.

This is pretty much saying that your startup path is not in the expected location or else the Ubuntu install has led to problems. See: http://docs.mongodb.org/manual/tutorial/manage-mongodb-processes/

EDIT: Updated with link to what appears to be the answer, namely something is wrong with Ubuntu and mongo.

https://stackoverflow.com/questions/29879231/upgrade-to-ubuntu-15-04-from-14-10-breaks-mongo-how-to-fix

Joel Parke has defined the problem and pointed to a ticket on the issue. https://jira.mongodb.org/browse/SERVER-17742

That ticket reportedly explains how to "cleanly install current versions of mongodb on Ubuntu 15.04 by replacing the apt source."