install mongoDB (child process failed, exited with error number 100)

I had a similar issue and it was not related to any 'sudo' problem. I was trying to recover from a kernel panic!

When I look at my data folder I found out a mongod.lock file was there. In my case this page helped a lot: http://docs.mongodb.org/manual/tutorial/recover-data-following-unexpected-shutdown/. As they explain,

if the mongod.lock is not a zero-byte file, then mongod will refuse to start.

I tested this solution in my environment and it works perfectly:

  1. Remove mongod.lock file.
  2. Repair the database: mongod --dbpath /your/db/path --repair
  3. Run mongod: mongod --dbpath /your/db/path

It's because you probably didn't shutdown mongodb properly and you are not starting mongodb the right way. According your mongodb.config, you have dbpath = /mongodb/data/db - so I assume you created the repository /mongodb/data/db? Let me clarify all the steps.

  1. TO START MONGODB

In your mongodb.config change the dbpath = /mongodb/data/db to dbpath = /data/db. On your terminal create the db repository by typing: mkdir /data/db. Now you have a repository - you can start your mongo.

To start mongo in the background type: mongod --dbpath /data/db --fork --logpath /dev/null.

  • /data/db is the location of the db.
  • --fork means you want to start mongo in the background - deamon.
  • --logpath /dev/null means you don't want to log - you can change that by replacing /dev/null to a path like /var/log/mongo.log

    1. TO SHUTDOWN MONGODB

Connect to your mongo by typing: mongo and then use admin and db.shutdownServer(). Like explain in mongoDB

If this technique doesn't work for some reason you can always kill the process.

Find the mongodb process PID by typing: lsof -i:27017 assuming your mongodb is running on port 27017

Type kill <PID>, replace <PID> by the value you found the previous command.


There was the same problem on my machine. In the log file was:

Mon Jul 29 09:57:13.689 [initandlisten] ERROR: Insufficient free space for journal file
Mon Jul 29 09:57:13.689 [initandlisten] Please make at least 3379MB available in /var/mongoexp/rs2/journal or use --smallfiles

It was solved by using mongod --smallfiles. Or if you start mongod with --config option than in a configuration file disable write-ahead journaling by nojournal=true (remove the beginning #). Some more disk space would also solve the above problem.


The data folders you created were very likely created with sudo, yes? They are owned by root and are not writable by your normal user. If you are the only user of your macbook, then change the ownership of the directories to you:

sudo chown juneyoungoh /data
sudo chown juneyoungoh /data/db
sudo chown juneyoungoh /data/log

If you plan on installing this on a public machine or somewhere legit, then read more about mongo security practices elsewhere. I'll just get you running on your macbook.