Error while validating lab

I’m doing the lab “Change the default DB Path” and I’m running into this issue when trying to run the validation script:


Can someone please tell me what went wrong?

Update: Thank you for all responses the problem is solved.

Your mongod is not running with the correct DB path. In your config file you need to update:

path: /data/db

To the newly created DB path.

N.B. people have come unstuck with user permissions on with this problem.
See: Lab - Change the Default DB Path

Thanks man for the reply. Only thing to add to this thread is that the folder “/var” already exists; it is a root directory (just as “/shared”)
I used this dbPath: “var/mongodb/db”. This is obviously wrong but hard to notice when you’re stuck…



Samy, have you checked the permissions in your folder?

From the lab description:

Using what you know about the configuration file and Linux user groups, please complete the following:

  • create a new folder /var/mongodb/db/ and allow mongod to write files to this directory
  • create this directory with sudo, because /var is owned by root
  • use chown to change the owner of this directory to vagrant:vagrant
  • edit your config file to use this new directory as the dbpath

If you are NOT using the Vagrant box, make sure to add the correct permissions to /var/mongodb in your machine to the user you’re using to run the mongo db process.