[Solved] mongo Startup Error: ERROR: child process failed, exited with error number 1

Because Mongo is abnormally closed, an error message of “error: child process failed, exited with error number 1” may appear when it is started again.

Step 1: delete the lock file

Find Mongo directory and delete mogod lock

Step 2: create a new log file

Find the log file directory of Mongo and delete or modify the original log file name
[because I don’t want to modify Mongo’s configuration file, I modified the file name and added a file with the same name as the original file. I can also take another name and modify Mongo configuration]

Step 3 try to restart

Generally, the restart is successful at this step.

If it still fails, take a look at Mongo’s log file
the errors reported in my log file are as follows:

2021-12-16T11:58:12.810+0800 I CONTROL  [main] ***** SERVER RESTARTED *****
2021-12-16T11:58:12.815+0800 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2021-12-16T11:58:12.820+0800 I CONTROL  [main] ERROR: Cannot write pid file to /var/run/mongodb/mongod2.pid: No such file or directory

Then go to the prompt “/var/run” directory, create a new mongodb folder, and restart. Start successfully and solve the problem!

Read More: