Unable to excute validate_lab_different_logpath command on vagrant

I have performed all steps as mentioned in the task, unable to execute validate_lab_different_logpath command getting an error “validate_lab_different_logpath: command not found”

Could please help.

Your task for this lab is to change the config file such that:

  • mongod sends logs to /var/mongodb/db/mongod.log
  • mongod is forked and run as a daemon (this will not work without a logpath)
  • any query that takes 50ms or longer is logged (remember to specify this in the configuration file!)

My configuration file:
step 1: root@m103:~# mongo admin --port 27000 -u m103-admin -p m103-pass --eval ‘db.shutdownServer()’
MongoDB shell version v3.6.14
connecting to: mongodb://
Implicit session: session { “id” : UUID(“ca8efbfb-86a6-4349-ab2e-1edf13020a22”) }
MongoDB server version: 3.6.14
server should be down…
2019-09-22T19:09:24.011+0000 I NETWORK [thread1] trying reconnect to ( failed
2019-09-22T19:09:24.013+0000 W NETWORK [thread1] Failed to connect to, in(checking socket for error after poll), reason: Connection refused
2019-09-22T19:09:24.013+0000 I NETWORK [thread1] reconnect ( failed failed
2019-09-22T19:09:24.013+0000 I QUERY [thread1] Failed to end session { id: UUID(“ca8efbfb-86a6-4349-ab2e-1edf13020a22”) } due to SocketException: socket exception [CONNECT_ERROR] for couldn’t connect to server, connection attempt failed

Step 2: my mongod.conf file
root@m103:~# cat /root/mongod.conf
dbPath: “/var/mongodb/db/”
path: “/var/mongodb/db/mongod.log”
destination: “file”
logAppend: true
bindIp : “,”
port: 27000
authorization: enabled
fork : true
slowOpThresholdMs: 50

step3 root@m103:~# mongod --config /root/mongod.conf
about to fork child process, waiting until server is ready for connections.
forked process: 3425
child process started successfully, parent exiting

root@m103:~# validate_lab_different_logpath
validate_lab_different_logpath: command not found

Seems all your work is done as root user
You should not use root

You should run as vagrant
vagrant@m103:~$ id
uid=1000(vagrant) gid=1000(vagrant) groups=1000(vagrant)
When you vagrant ssh you are automatically set to vagrant
Did you sudo again?

1 Like

I am having a similar problem. What does this error mean? I can confirm that mongod is running on port 27000 and that the m103-admin user exists.


Hi @Michael_Williams_92594,

Can you please share the command that you are using to launch your mongod process and the details of how the user was created?

There probably might be some issue in those and looking at it will help us debug in a better way.

Curriculum Support Engineer

vagrant@m103:~$ mongod --config mongod.conf

Here is my config file:

dbPath: /var/mongodb/db
port: 27000
authorization: enabled

Hi @Michael_Williams_92594,

Is this your complete configuration file?

Also, in your other post I can see that you have already checked if the user exists and the localhost mapping to IP address is correct.

Can you please share the exact set of commands you are using to create the user and please confirm if the user is created with “root” role on admin database.

Curriculum Support Engineer