I am on Ubuntu 14.04.1 LTS.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.1 LTS
Release:    14.04
Codename:   trusty

Instead of using the system provided MongoDB which is 2.4, I want to use 2.6 so I downloaded MongoDB executable and just put it in the places I wanted. Then I mostly copied the upstart script comes with the 2.4 package:

description "MongoDB"

start on runlevel [2345]
stop on runlevel [!2345]

limit nofile 64000 64000

kill timeout 300 # wait 300s between SIGTERM and SIGKILL.

pre-start script
    mkdir -p /data/db/
end script

    if [ -f /etc/default/mongodb ]; then
        . /etc/default/mongodb
    if [ "x$ENABLE_MONGODB" = "xyes" ]; then
        exec start-stop-daemon --start --quiet --chuid mongodb \
            --exec /usr/local/bin/mongod -- --config /etc/mongodb.conf
end script

When I run manually like so:

sudo /usr/local/bin/mongod --config /etc/mongodb.conf

It runs just fine.

But when I use sudo start mongodb the process probably dies out as I was not able to see it in ps -ef. The upstart log doesn't say much (/var/log/upstart/mongodb.log):

warning: bind_ip of is unnecessary; listens on all ips by default

What may be the problem?

1 Answer 1


You say you did this:

Instead of using the system provided MongoDB which is 2.4, I want to use 2.6 so I downloaded MongoDB executable and just put it in the places I wanted.

That’s really not the supported and recommended way you should be installing MongoDB on your system. The MongoDB team is very well aware that official Linux repositories don’t always keep up to date with latest releases of many packages, so they provide their own PPA for MongoDB as explained here. I would recommend removing whatever you just installed and follow these steps instead.

First, import the public key used by the package management system:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10

Then create a sources list file for MongoDB:

echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list

Now run apt-get with update to refresh the sources list:

sudo apt-get update

And finally, install MongoDB directly from the repository like this:

sudo apt-get install -y mongodb-org
  • Oh that's great! I'll use that instead. Do you have any idea how to check how that upstart mongodb dies on me?
    – huggie
    Mar 2, 2015 at 6:33
  • 1
    @huggie No idea why it would die on you like that, but honestly that is why you should not “reinvent the wheel” like that. You’ve most likely created a problem highly idiosyncratic to your system that cannot be easily diagnosed. And as pro Linux systems administrator, sometimes upstart/init.d scripts can take days to debug on a good day. Better just chalk this up to experience and move forward. Mar 2, 2015 at 6:36
  • 1
    Thanks for the help. I'll accept your answer in two minutes since the system won't allow it right now.
    – huggie
    Mar 2, 2015 at 6:40
  • @huggie Thanks! Also I looked in the upstart script again and saw this. Look at this chunk of code: mongod -- --config. What is that extra -- in there? It's not in your manual version of the startup command. Regardless, the official MongoDB version from the repo would definitely work so just posting this note as an FYI. Mar 2, 2015 at 8:12
  • Psst! Notice that the command being run, and receiving the --, is start-stop-daemon. Think about how one stops --config from being interpreted as an option by that command. I just had to deal with this at unix.stackexchange.com/a/187540/5132 .
    – JdeBP
    Mar 2, 2015 at 11:56

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.