2

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.

mustaccio
28.7k24 gold badges60 silver badges77 bronze badges
asked May 4, 2015 at 18:21
1
  • Maybe this depends that ubununtu 15.04 use systemd. Have you tried systemd sudo systemctl start mongod.service? You can get a list of services with systemctl. Commented Aug 8, 2015 at 10:31

2 Answers 2

2

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."

answered May 4, 2015 at 19:14
4
  • I am using the default db path. It was all working fine before ubuntu update Commented May 4, 2015 at 19:16
  • @ShahzadTariq Answer from StackOverflow last week is likely the cause. Updated post. Commented May 4, 2015 at 19:44
  • i did't get what u want to say Commented May 4, 2015 at 20:00
  • I updated the post with a reference to what appears to be your problem and gives an apparent solution. Commented May 4, 2015 at 20:11
0

The problem is with the upstart service on Ubuntu. Mongo doesn't plan to support 15, and will instead support 16 LTS.

In the meantime, you can use the Mongo provided Debian sources.list instead of the Ubuntu one, and that will work on Ubuntu 15 (tested and proven to work on 15.04). Since you've already got the packages installed, you'll need to remove them first, add the new source, then reinstall.

sudo apt-get remove mongodb-org
echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update
sudo apt-get install mongodb-org 
service mongod status
answered Sep 23, 2015 at 18:45
1
  • Do you have a source for "Mongo doesn't plan to support 15, and will instead support 16 LTS"? I'm not arguing the point, but I think it would add weight to your answer. Commented Sep 23, 2015 at 19:06

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.