Resolving MongoDB Child Process Failure on Startup

When starting MongoDB with a command like mongod --dbpath=/data/club --port=27017 --fork --logpath=/var/log/mongodb/mongodb.log, you may encounter the following error:

about to fork child process, waiting until server is ready for connections.
forked process: 43110
all output going to: /var/log/mongodb/mongodb.log
log file [/var/log/mongodb/mongodb.log] exists and couldn't make backup [/var/log/mongodb/mongodb.log.2014-11-17T06-55-20]; run with --logappend or manually remove file: errno:13 Permission denied
Bad logpath value: "/var/log/mongodb/mongodb.log"; terminating.
ERROR: child process failed, exited with error number 1

This error typically indicates that the MongoDB service was not shut down properly, possibly due to a system crash, leaving a lock file or causing permission issues with log files.

To resolve this issue, follow these steps:

  1. Remove Lock and Log Files: Delete the mongod.lock file and any old log files, such as mongodb.log.2014-11-17T06-55-20. Ensure you have the necessary permissions. You may need to clear the entire log directory.

  2. Attempt Database Repair: Run the repair command. Note that with journaling enabled, the --repairpath must be a subdirectory of --dbpath.

    mongod --repair --dbpath /data/db/ --repairpath /data/db/repair_temp
    

    If you encounter an error stating the repair path must be a subdirectory, adjust the command accordingly. An incorrect path may lead to an assertion failure during shutdown.

  3. Restart MongoDB: After cleaning up files and repairing the database, restart the service.

    mongod --dbpath=/data/db --port=27017 --fork --logpath=/var/log/mongodb/mongodb.log
    

    A successful startup will produce output similar to:

    about to fork child process, waiting until server is ready for connections.
    

forked process: 43144 all output going to: /var/log/mongodb/mongodb.log log file [/var/log/mongodb/mongodb.log] exists; copied to temporary file [/var/log/mongodb/mongodb.log.2014-11-17T07-21-41] child process started successfully, parent exiting ```

Tags: mongodb Database Administration troubleshooting Startup Error System Maintenance

Posted on Thu, 17 Sep 2026 16:28:55 +0000 by mlnsharma