ERROR: child process failed, exited with error number 1 - when setting up a replica set

Hi All,

I have been struggling for a while with setting up a replica set and after my initial problems with keyfile permissions seem to have been resolved (as assured on a corresponding thread) I was suggested to set a up a new one regarding my current issue:

ERROR: child process failed, exited with error number 1
To see additional information in this output, start without the “–fork” option.

As encouraged by Mr Bond (007_jb) I have tried to run mongod without forking it, so changed my .conf file accordingly but still having issues, as below:

Screenshot 2020-01-13 at 14.27.04

Please help!
Thank you in advance!

You keep blowing my cover… I’m supposed to be incognito :wink:

I wonder how many other times you’ve sudo'd. Check who owns each sub-directory starting from /var/mongodb

Thank you for being so helpful!

I admit, I may have been too excited with the sudo :pleading_face:, here’s wha The God says:

Screenshot 2020-01-13 at 14.46.38

Suggest that you delete the mongodb sub dir, use sudo to recreate it, use sudo to change ownership to vagrant… and after this point, don’t sudo anymore.

Really?

Wouldn’t this mess up some other things depending on mongodb subdirectory?

Besides, it seems that the ownership of everything in mongodb is set to vagrant anyway:

Screenshot 2020-01-13 at 14.58.17

You’re trying to build the first node and the only thing you’ve created is the keyfile, there’s nothing else there that it will affect.

Ok!

I’m willing to try your solution, so just to so I know I understand it clearly:

  1. Delete mongodb sub dir (mongodb folder itself or everything within it?),
  2. Recreate it using sudo,
  3. Change ownership to vagrant using sudo (again, of the mongodb folder itself or all folders within?).

Unfortunately removing and re-creating mongodb sub dir has not worked as expected and I have still the issue with forking the child process:

Screenshot 2020-01-13 at 17.19.10

What’s interesting is that my previous log file still works and can launch mongod from it (which does also require forking the process).

Loosing my mind here…

Quick update to my issue:

I have kind of resolved it - managed to run mongo shell (the primary node) using sudo and than everything else do without sudo. It has worked (I really don’t know how!). This enabled me to finish the lecture and successfully complete the lab afterwards (this time was able to do everything without sudo - again no idea why had this problem with the primary node during following the lecture).

Anyways, my validation script has been accepted so will move forward.

Thank you for your help Mr DoubleO - martini shaken not stirred is on the way - till the next time!

This is indicative of a sudo conundrum (as seen in your last screenshot). Somewhere along the line you have done a sudo too many and because root has elevated privileges, it will happily run anything. mongo should never be run using sudo.

To reiterate, the moment you give vagrant ownership of the mongodb sub folder, every other command that has to do with the mongodb folder and its sub folders should not use sudo. Even when creating the keyfile, don’t use sudo on any of the commands. The lecture notes uses sudo to create the pki sub folder because at the time, the mongodb parent folder was still owned by root.

For your benefit, I’d suggest that you re-do this exercise just to get the hang of it.

1 Like

How didi you that? I’m having the same issue.

Hi @ANDRE_GUSTAVO_19804,

Please provide the following details so that we can better understand your problem :

  1. Name of the lab that you are doing.

  2. Screenshot of the command that you ran and the error message that you got. Share any other relevant information if needed such as the content of your configuration file and log files.

  3. Steps that you followed.

Thanks,
Shubham Ranjan
Curriculum Services Engineer

I run mongod with sudo the first time, but as 007 said it’s not the right way, so I would recommend following the steps suggested by the mongodb uni staff and post some more info about your particular scenario, so they can help you. I’ve completed this course now, but had to use this forum’s help quite a few times, re-do some stages when necessary, which actually made me learn more. I’m sure you’ll get through it too!

Good luck!

1 Like

Lab - Initiate a Replica Set Locally

I did not get to create the path folder:
image
but if I use sudo (sudo mkdir -p /var/mongodb/db/1) i get.
But I didn’t get to fork the process:


But If i fork the process using sudo, i get:
image
I run mongo on port 27001. So far so good.
However when I run rs.initiate() I get the following message:

I have permission for nothing.
Help me, my time is running out.

You’re missing an option from the chown line. You need to recreate all the folders again and copy, paste and execute each line:


Don’t sudo mongod.

Thank you for the help. I did exactly what you did. The only diference was “-R” in second line and “chmod 600”, in last line. I just didn’t caputre the first line. However I recreate all the folder again, like you said and did not sudo mongod. Note, I had to use sudo to create the folder:

Thank you in advance.

That’s still not right. Please look at the commands again and compare.
Like I said before, copy and paste. Don’t try and re-use old commands from the shell.

Man, I’m loosing my mind here:

Now you can see that the “permission denied” error has gone away.
This is now a different problem. Suggest you do what it’s advising, remove the “–fork” option and try again and you should see a better error message. Or better still, look in the log file.

I am greatfull for your help. I’m almost getting there.
I got fork the 3 processes without using sudo. I connected mongo on port 27001
However I’m still getting the following message: