7

I am getting errors starting Mongod v3.0.15 in Debian linux. I had changed the /etc/mongod.conf file to use smallFiles by adding mmapv1: smallFiles: true to the storage options.

I now get the following error when I execute $mongod --config /etc/mongod.conf:

ib1:/ 514 $ mongod --config /etc/mongod.conf

2017-10-03T12:14:21.183-0500 F CONTROL Failed global initialization: FileNotOpen Failed to open "/var/log/mongodb/mongod.log"

The mongod.log file exists, and it is also defined in the mongod.conf file as in that directory.

I am able to open the /var/log/mongodb/mongod.log file myself in the shell. It hasn't been written to in a long time (months) curiously.

Any ideas?

Thanks very much, Karen

4
  • Is mongo already/still running (is the file locked by something)? Commented Oct 3, 2017 at 18:04
  • No, it's not already running. I'm the only one using it. I have also tried restarting the server with no luck. Thanks.
    – Karen A.
    Commented Oct 3, 2017 at 18:35
  • What is the permission for mongod.log ?
    – TheDataGuy
    Commented Oct 3, 2017 at 18:51
  • ib1:~ 504 $ ls -l /var/log/mongodb/mongod.log -rw-r--r-- 1 mongodb mongodb 39858 Oct 3 13:34 /var/log/mongodb/mongod.log
    – Karen A.
    Commented Oct 3, 2017 at 18:59

2 Answers 2

3

You may need to change the permissions for the parents directory /var/log/ as the user running the mongod instance might not have access to it. The below code should do it

sudo chmod 755 /var/log
1
  1. cd /var/log
  2. sudo mkdir -m 777 mongodb
  3. sudo service mongod start
  4. sudo service mongod status

Hopefully that will do!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.