Mongodb – How to correct Failed global > initialization: FileNotOpen

mongodb

I am trying to run eos and using the std docs – https://developers.eos.io/eosio-nodeos/docs/build-validation

I am trying – ~/opt/mongodb/bin/mongod -f ~/opt/mongodb/mongod.conf and I get the following –

trevor@ubuntu-s-4vcpu-8gb-lon1-01:~/opt/mongodb$
2018-08-03T13:03:01.096+0000 F CONTROL [main] Failed global
initialization: FileNotOpen: Failed to open
"/home/trevor/opt/mongodb/log/mongodb.log"
~/opt/mongodb/bin/mongod -f ~/opt/mongodb/mongod.conf

I tried already chmod 755 on the log and checking the conf as per other posts here. Nothing worked. Here is the conf –

trevor@ubuntu-s-4vcpu-8gb-lon1-01:~/opt/mongodb$ more *conf
systemLog:
 destination: file
 path: /home/trevor/opt/mongodb/log/mongodb.log
 logAppend: true
 logRotate: reopen
net:
 bindIp: 127.0.0.1,::1
 ipv6: true
storage:
 dbPath: /home/trevor/opt/mongodb/data

I have Ubuntu 18.04.

Any idea what could be the cause?

Best Answer

Run as sudo. That worked for me.

trevor@ubuntu-s-4vcpu-8gb-lon1-01:~/opt$ sudo ~/opt/mongodb/bin/mongod -f ~/opt/mongodb/mongod.conf & [1] 23948 trevor@ubuntu-s-4vcpu-8gb-lon1-01:~/opt$