Permission issue when starting mongodb as service

I'm using GNU/LInux 4.4 on asw and I want to run a mongodb server (v3.4.3)

When I do the follwoing command, I can run the server and everything works:

sudo mongod --config /etc/mongod.conf

I see in the log file that the service is actively running and everything is fine.

When I try to run it as a service (I believe this is the recommended way in production) I get a permission error message

sudo service mongod start

In the log file I then get this error:

assertion: 28595:13: Permission denied src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 267

I have two questions:

  1. Why do I get this error and what can I do about it?
  2. When I run it as a service, it doesn't seem to be necessary to specify the config file, but he seems to read it correctly, as he writes the error message to the log file, which is specified in the config file. How does he automatically know which config file to use when I run it as a service?
1

1 Answer

I've had the same issue. I solved it by:

  • removing the mongod.lock file under your data folder (in my case is /data/mongodb/)
  • changing the permissions: sudo chown -R mongodb:mongodb /data/mongodb/
  • and several reboots..

Take a look at this answer on Stack Overflow which could be informative.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like