Configuration problems with log path file not opening

Hi am having further difficulties with this mongod config file.
Once I changed permissions that allowed me to store a conf file in etc. I have written an config file with
and processManagement.
when I run mongod --config /etc/…conf
I get this

note also mongod.log exists in the data/log directory and I can open and edit with vim.
take this out then it tells me that my keyfile permissions are too lose.
If I take out the systemLog and security I can install mongod and run from another shell.

I can also run mongod with the command line with fork not a problem.

Problem is trying to read the config manual to find out why I get these errors.
Any way the 25th looms and still trying to get there.

Good thing you mentioned this.

data/log exists but /data/log doesn’t. Hopefully you can see the difference.

1 Like

Yes I see the difference in the / will check code but sure it is there.
My typo in the email. Still does not answer about the lose permissions in in the keyfile though.

Check and report back. If you’re adamant that it exists, let’s see the output of ls -l /data.

In the lectures, it briefly uses the chmod command soon after creating the keyfile. Suggest you review the lecture again.

Hi Again

The following is the conf file and messages from ls -l /data.

I note that you don’t want code shown, however I can’t see why this conf file does not work. And others have posted similar.

I also seem to have an obsolete link to the course as I have gone through the config mongod lecture chapter 1 and I cannot see any sign of chmod to the /data/keyfile command.

I did after getting the error that /data/log/mongod.log couldn’t be opened change the settings to 777 for /data.

I am going through the lectures sequentially, but it appears that you want me to listen to all lectures before attempting the lab and quizzes at the end of each chapter. Is this so?

ls-l log.PNG



No, not at all.

Can you confirm the title of the lab that you’re on? And also share the screenshot of the security section of your config file.


The lab is from Chap 1 Configuration File. Second lab of the chapter.

Attached is a copy of the config file from the boot directory.

(Attachment formongoconfig is missing)

Hi @tertius_keen,

In addition to @007_jb,

I don’t think you need to use these options in the Lab - Configuration File. Please go through the requirements mentioned in the lab again and edit your configuration file accordingly.

In addition to that, I would highly recommend you to use the /shared directory in your virtual machine for storing all the configuration files.

Shubham Ranjan
Curriculum Services Engineer

Yes I can get the conf file to mongod without the mongod.log file and without the fork as I have explained to you. This means that I have to open another shell does it not? However if you look at the end of the lecture it gives an example with the log
files and fork given. So I put them in. Theoretically it should run but it does not want to open the file. Why not is my question? It works on the command line and not in the config file so why, I tried to gleen the reason from your documentation but alas
it told me nothing about why the file would not open.

I cannot fathom why you are reluctant to explain why it does not work.

logAppend: true and logRotate: reopen are in conflict. Suggest you remove logRotate. The other three options under systemLog are fine. And although processManagement is not a requirement in the lab, it’s useful to fork the mongod process, which automatically makes the systemLog mandatory.

This screenshot didn’t come through. Please copy and paste the screenshot directly into the reply box.


I have supplied a copy of the config file that works labelled working.

I then progressed to what I thought was a logical progression, given the command line execution of the mongod, by adding storage.

You see by the error message that it fails to open the file mongod.log file,even though vim does and the command line for mongod works as well.

I have added the config file from the boot dir for Linux as formongouni.txt as requested.

An interesting note is that you say that LogAppend and LogRotate are in conflict but I have given you a screen shot of your documentation that says this must be declared for reopen to work. My rationale for using this was to force the mongod
to reopen the log maybe.

formongoconfig.txt (162 KB)

(Attachment marksmongod.conf is missing)

(Attachment nologpathworks.conf is missing)

1 Like

I have changed to txt files as your filewall does not accept .conf.

marksmongod.txt (190 Bytes)

nologpathworks.txt (124 Bytes)

Thanks for pointing out the documentation. I was actually thinking about rename and true causing a potential conflict.

Try these steps:

  1. rm -r /data/{db,log}
  2. mkdir -p /data/{db,log}
  3. Use the config below to startup mongod:
    <Deleted to keep in-line with forum guidelines>
  4. And for testing purposes, create the config file in a dir other than /etc, ensure that it is owned by vagrant, and close the vim session before running mongod.

PS: I’m not a MongoDB staff/affiliate. I took this course a while back and you’ll find me helping out when I have a moment to spare.


Thanks for this.

I have moved the mongod statrtup config to shared. The penny dropped that I could edit with notepad++ in my machine and transferred over to virtual.

Was it corrupt files?

I assumed that you already knew this but preferred editing your config files in the VM :slight_smile:

It could be anything; another program using the file, corrupt files, permissions (even though it says otherwise). Something just wasn’t right.

Just tried what you suggested in removing the dir and replacing them still an error in opening system log file

Are you using the config file from my previous post and is Notepad++ closed? I’m guessing the config file is now located in the /shared file.

Also confirm if it’s the exact same error message.


Just to let you know I feel like a complete idiot.

I created the data/log file in my directory not the root directory where it was meant to be if that makes sense.

Created the file in there and now connects to mongo with fork.

I should have made the path “~/data/log/mongod.log” but I don’t know if ~ would be recognised in the config string?

I think that the validation executable checks the dbpath in which case your config file will fail validation. And I think that tilde (~) or dot (.) is recognised, but give it a try.

This makes me think that there’s a permissions issue with the /data folder. Can you try copying these commands as-is and running them:
sudo chmod -R 777 /data
sudo chown -R vagrant:vagrant /data

Try to run the config again.


The error was mine.

/home/vagrant/data/ - was where I made the log directory. That was not opening because I had not included full path.

I used /data/…… which was made in the provision file and where I was calling in the config.

Having made the necessary directories in /data/ with files the config now works.

That is why I feel like an idiot, because I thought that Linux opened in the root?

I have learnt or re-learnt a valuable lesson GIGO or WYSIWYG.

As to the sudo commands they appear in the provision file, which is where I picked up my error in watching it load.

1 Like