Starting mongod fork, ERROR: child process failed, exited with error number 1

MongodbUnixAmazon Ec2

Mongodb Problem Overview


In attempting to run the command

mongod --fork --logpath /var/log/mongodb.log

On a amazon ec2 32 bit instance (Amazon Linux AMI release 2014.09), I run into the following error:

2015-02-18T18:14:09.007+0000 
2015-02-18T18:14:09.007+0000 warning: 32-bit servers don't have journaling    
enabled by default. Please use --journal if you want durability.
2015-02-18T18:14:09.007+0000 
about to fork child process, waiting until server is ready for connections.
forked process: 17116
ERROR: child process failed, exited with error number 1

I also notice no log file is created in the process.

Mongodb Solutions


Solution 1 - Mongodb

I had the same thing and it turned out to be a permissions issue. If the owner of the child process cannot access the log path or the log path does not exist, it will fail.

What I did was put the log directory in my home directory:

mkdir ~/log
mongod --fork --logpath ~/log/mongodb.log

If you really want to put it in your /var/log directory, just change the permissions.

Solution 2 - Mongodb

I also had the same error, however I used sudo it and ran sudo mongod --fork --logpath /var/log/mongodb.log. As @jryancanty mentioned, it's simply a permissions error.

Solution 3 - Mongodb

For anyone else running into this error [even if you run it with sudo] make sure that you state the filename of the log file as in: /var/log/mongodb.log. I had just the directory path as in /var/log/ since I miss read the mongo docs.

Solution 4 - Mongodb

I have deleted old

/var/run/mongodb/mongod.pid

and all worked.

Solution 5 - Mongodb

I have same issue after

sudo rm /tmp/mongodb-27017.sock
sudo chown mongod:mongod /var/log/mongodb

and all worked.

Solution 6 - Mongodb

If you have a keyfile, it is also possible that the permissions are too open. Make sure you set it to 0400

Solution 7 - Mongodb

I incorrectly set the log path to var/mongodb/db/mongo.log instead of /var/mongodb/db/mongo.log so Mongo was trying to access a non-existent folder in /home.

Solution 8 - Mongodb

this might work if you see issues with /tmp/mongodb-27017.sock in the log file

sudo chown mongodb:mongodb /tmp/mongodb-27017.sock

Solution 9 - Mongodb

sudo mongod --fork --logpath /var/log/mongodb.log

In ubuntu no need to change permissions in /var, use full logfile name in logpath

Solution 10 - Mongodb

I got the same issues because of user permission , when i logged in ubuntu with user who's don't have permission to create file then also this error was occur.

So , you have to run the command with sudo. :)

Solution 11 - Mongodb

I have same issue after remove mongo from EPEL repo (2.x) and install mongo from mongo repo (4.x).

journalctl -xe says:

ERROR: child process failed, exited with error number 1

In my case I have old log file with root permissions. Just set correct permission or delete log and check log directory permission.

Solution 12 - Mongodb

This error is also generated if you are already having folder for dbpath where db data is being stored and in conf file you gave a new path for dbpath. When you are creating new folders for dbpath, logs and PID then delete the old ones, if they are there.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRyder BergerudView Question on Stackoverflow
Solution 1 - MongodbonetwopunchView Answer on Stackoverflow
Solution 2 - MongodbNathan L.View Answer on Stackoverflow
Solution 3 - MongodbparsethisView Answer on Stackoverflow
Solution 4 - MongodbrlibView Answer on Stackoverflow
Solution 5 - MongodbSavorboardView Answer on Stackoverflow
Solution 6 - MongodbmasterforkerView Answer on Stackoverflow
Solution 7 - MongodbPatience MpofuView Answer on Stackoverflow
Solution 8 - MongodbkgsView Answer on Stackoverflow
Solution 9 - MongodbzKajView Answer on Stackoverflow
Solution 10 - MongodbRaman KumarView Answer on Stackoverflow
Solution 11 - MongodbAlexanderView Answer on Stackoverflow
Solution 12 - MongodbRaghav GuptaView Answer on Stackoverflow