5

I am trying to run mongodb-community@4.2 service using brew services start mongodb-community@4.2 (facing similar error, while running httpd service or any other service) Following is the error:

Error: Failure while executing; /bin/launchctl bootstrap gui/502 /Users/chiragsingla/Library/LaunchAgents/homebrew.mxcl.mongodb-community@4.2.plist exited with 5.

  • This tells us nothing. Please provide the start log from `/usr/local/var/log/mongodb/output.log` for x86 Mac, or `/opt/homebrew/var/log/mongodb/output.log` for M1 Mac. – Simba Aug 16 '21 at 16:25
  • I have the same issue but there is empty in the `/usr/local/var/log/mongodb/output.log`. – Kwun Yeung Oct 12 '21 at 03:56
  • 1
    Ah... I instead checked `/usr/local/var/log/mongodb/mongo.log` and saw the following error. `"This version of MongoDB is too recent to start up on the existing data files. Try MongoDB 4.2 or earlier."` I have an old version running before and the data is still there. I install an older version and it works. I will have to the set the compatibility version correctly if I am going to upgrade `MongoDB` again. https://docs.mongodb.com/v5.0/release-notes/5.0-upgrade-standalone/ – Kwun Yeung Oct 12 '21 at 04:16

1 Answers1

0

There can be multiple reasons behind this error message. So, the first thing to do is to find where your mongo related logs are stored. To do that, run the following command -

sudo find / -name mongod.conf

This will get you the mongo db config file. On running this command, I got /usr/local/etc/mongod.conf. You may find it directly under /etc.

On opening mongod.conf, you will find log path mentioned there. You can open the file itself, or instead get the last 15-20 lines of this log file via tail command -

tail -n 15 <<your mongo db log path>>

Now, you will need to debug the issue mentioned in the logs. Generally, I have seen these three sets of issues -

  1. Permission issue with /tmp/mongodb-27017.sock - While some SO answers asked to change the permissions for this file as a solution, my issue with this only went away after I removed this file.

  2. Compatibility issue - If you see a message like Version incompatibility detected, it means that the mongodb version you have currently installed is different from the version whose data is present on your system. Uninstall the current mongodb version and then install the correct older version (if you don't want to lose the data). Once you have done it, and your mongo is up and running, and you want to upgrade mongodb version, follow this SO answer.

  3. Permission issues with WiredTiger - Using chmod to change file permissions resolved these.

In case you have any issue other than these three, you will still need to search more on SO and figure it out. Hope this was of some help! :)

thisisashwani
  • 1,748
  • 2
  • 18
  • 25