Attempting to start my MongoDB server using service mongod start fails for the reason: exception in initAndListen: IllegalOperation: Attempted to create a lock file on a read-only directory: /var/lib/mongo/, terminating

I've setup the permissions to the directories it needs using chown mongod:mongod -R /var/lib/mongo/ and also ran chmod 775 -R /var/lib/mongo

Even though I can see that the group and permissions are setup for the directory /var/lib/mongo its still saying the folder is read-only?

Have I missed something in my setup? I'll attach the ls -ld output of my mongo data folder.

drwxrwxr-x. 5 mongod mongod 8192 May 29 15:35 /var/lib/mongo

  • Please refer stackoverflow.com/questions/54860208/… – Mani May 29 at 20:09
  • Thanks I looked into it but its not really a solution to the problem, I'm not understanding why a folder with 777 permissions (I know its bad but i want to confirm if its a folder thing or not) cannot access and create a file. – Jake1996 May 29 at 20:15
  • Are you logged in as a mongod user? – Mani Jun 7 at 22:00

Your Answer

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

Browse other questions tagged or ask your own question.