Csrs_1 problem won't start

Let’s see a full screenshot showing the command you ran and the error message that followed.
Also show a full screenshot proving that /data/db2 exists.

in pic 1 displaying the -ld of both db and db2 as the same
along with the command to launch mongod

this is the config file used:
port: 30005
dbPath: “/data/db2”

pic 1 return (2 versions) show that it is a locked file…I know I said that is showed an invalid db path before but I think this would be the case if I chown to vagrant:vagrant…flip side of the same coin - will double check this

I then go into the config file for the simple alter to
dbPath: “/data/db”
and at mongod command it runs

pic1 db2


cd data
-ld of db and db2 display both as owned by vagrant…sent the wrong pic1

the rest is all the samepic 1 correct

When your prompt is vagrant@m103:~$ your current directory is ~ which is a short-cut, is a synonym, is equivalent to /home/vagrant. So when you do dir data or ls -ld db2 or ls -ld db, as in your last screen shots, you execute the commands relative to your current directory. In this case, from your prompt in your screen shot, it is relative to /home/vagrant. This means your commands are equivalent to dir /home/vagrant/data, ls -ld /home/vagrant/db2 and ls -ld /home/vagrant/db. This is not the same as dir /data, …

appreciate all help and patience. to keep things simple I’ll summarize as:
2 dirs side by side with same owner
db, db2

db config requires “/path”
db2 config requires “path”

they appear the same at the ‘data’ dir level side by side - but their unseen paths must differ…

in proceeding to csrs I don’t want to set thing up wrong so it’s important to me…if I can proceed without the / in the config i.e. the db2 model - that’s fine

okay so may have solved the problem…

it is the abbreviated path in the config file

using the full path works for both dir: db and db2
dbPath: “/home/vagrant/data/db”
dbPath: “/home/vagrant/data/db2”

it is not clear why the abbreviated path works for db but not for db2 - however this may be related to my inability to create db2 via a path command. As noted - that did not stick and so I drilled down to the ‘data’ dir and made db2

thus it is not clear why I am unable to create a dir via a path command - in the end this may be the issue
sudo mkdir -p /data/db2

The requirement is /data/db, but instead you’ve done /home/vagrant/data/db. If the validator is going to check the paths, it will not pass the test.

In the first place you never needed sudo for the /data directory, however, you need sudo for the /var directory. The moment you use sudo to create a directory, the ownership is given to root. If only you had taken a few minutes to read about the Directory Structure in Linux, you would have understood this. :wink: To resolve the issue, you need to change the ownership of the /data directory back to vagrant.

the sudo mkdir -p /data/db2 was instructed by Shubham at the 4 hr past post

from the standard vagrant prompt :
ls -ld data
returns vagrant vagrant

Still, not the same as what I mentioned.

from the standard vagrant prompt :
ls -ld /data
returns vagrant vagrant

Screenshot :camera_flash:

owners of data

Remember you didn’t create /data using sudo. You used sudo to create a sub-directory in /data.

ls -l /data will show that the db2 sub-folder is owned by root.

To be explicit, change the folder and its sub-folders to vagrant. You already know the command and option for this.

ok lesson learned…the hard way…have worked the topic thru the csrs set up…

in big apps we would never give 2 objects the same name, not sure why directories are having the same name i.e. data and /data or var and /var

it might be dataV and /dataR

seems like it is begging for confusion - and I want to get into this side of the field with a good approach…

but there maybe is good cause/requirement to have reuse same name…should you have any more patience on this topic I would welcome input though perhaps reading more on linux directories as you suggest will tell me…

Yes!!! :smiley: :pray:

Well you can have two or more folders/directories with the same name in different locations. The same principles apply in Windows so it’s definitely not a problem/confusion.

To expand, if you cd to the root, data and /data will become the same location. The moment you cd to a different location, they will become different locations. Like @Shubham_Ranjan and @steevej-1495 have also explained, data (without a slash) is relative or the continuation of your current location, whilst /data will start from the root directory. The root or parent or topmost directory in Linux is the forward slash (/)

To see all the directories under the root, do this —> ls -l /

Hi @James_58604,

Sorry about this, with this command you will have to change the ownership to vagrant because of the use of sudo. In this particular case, a better approach would be to create it without sudo.

As I can see, you are making good progress in the course. Please feel free to reach out to us if you have any other query.

Shubham Ranjan
Curriculum Support Engineer