I recently upgraded to Ubuntu 15.10 after which MongoDB 3.0.2 is not starting.

$ sudo service mongod start

which would throw error:

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


It's just the lack of a service file for systemd. No need to go back to upstart like Kartik did or use a different repository than described in https://docs.mongodb.org/manual/installation/.

Create a file /lib/systemd/system/mongodb.service with the following content:

Description=High-performance, schema-free document-oriented database

ExecStart=/usr/bin/mongod --quiet --config /etc/mongodb.conf

  • See also the note in askubuntu.com/a/617869/43344 . – JdeBP Nov 17 '15 at 10:02
  • I would add that you need to keep careful eye on file ownership of the data directory, the tmp fs lock and the log file. I was messing around trying to get this working and sudo service... was silently failing because of permissions issues – Hotbelgo Jan 17 '16 at 11:14
  • 4
    for some reason the default config file is called /etc/mongod.conf and not /etc/mongodb.conf – mightyuhu Mar 25 '16 at 12:36
  • 1
    @mightyuhu is correct, without the correct path defined I get failure. with the correct path I don't get failure. – user1063287 Apr 21 '16 at 6:43
  • 2
    Thanks! This is the right answer. One small thing: the service name should be mongod because this is what they use on their official site. So mongodb.conf should be mongod.conf and the file name should be /lib/systemd/system/mongod.service – caisah Apr 24 '16 at 7:55

This error occurred due to the problem with the new Ubuntu (15 and ahead).

Default init system is systemd which was Upstart previously. So you need to install Upstart, reboot your system and here you go, you can now run mongodb service.

  • Install Upstart

sudo apt-get install upstart-sysv

  • Reboot your system

sudo service mongod start

mongod start/running, process 3371

  • 1
    The service name is now mongodb – sowrov Apr 29 '16 at 10:02
  • @sowrov, no, the latest service name is still 'mongod' – Clay Ferguson May 15 '16 at 16:36
  • 1
    after installing upstart-sysv, and rebooting my ubuntu 16.04 it went blank; I had to go in recovery and apt-get remove it. This thread might be helpful if you want to keep using upstart askubuntu.com/questions/760615/… – jrgd Jun 15 '16 at 21:48

I used debian package in ubuntu 15.10

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 -y mongodb-org

I had similar issues after upgrading to 15.10.

There could be a lot of issues but depending on what's caused your problem you may be able to get your mongodb running through init.d :

sudo /etc/init.d/mongodb start

That worked for me, but not a long term solution since you need to run that after every restart or add it to your startup tasks. So I followed the following:

1) creating the service file as explained by 'sclausen'.

2) reload the service by running:

sudo systemctl daemon-reload

3) ran sudo service mongodb start

4) The command ran without output. So I tested by running mongo and got a socket error:

Error: connect ECONNREFUSED at Object.exports._errnoException (util.js:870:11) at exports._exceptionWithHostPort (util.js:893:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1062:14)

5) Looked through the logs tail -n 50 /var/log/mongodb/ and found out the underlying error :

2016-02-26T14:28:23.538+1100 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted

6) deleted the problematic socket file: sudo rm /tmp/mongodb-27017.sock as suggested on this thread: https://stackoverflow.com/questions/29813648/failed-to-unlink-socket-file-error-in-mongodb-3-0

7) re ran the service: sudo service mongodb start

at that point all was good and Bob returned to his rightful position as my uncle.


In my case, I have Ubuntu 16.04.1, I was installing MongoDB 3.2.11, and I was getting that same error. After several cleaned ups and retry's, it finally worked "enabling" the service:

systemctl enable mongod.service

Then it just worked

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.