1

this is my mongod.lock:

-rw-r--r-- 1 mongodb mongodb    0 Dec  3 17:09 mongod.lock

hence this solution doesn't apply: https://dba.stackexchange.com/a/183018

this is how I start mongodb:

sudo systemctl start mongodb

and this is the output in mongod.log:

2019-12-03T17:12:01.676+0100 I  STORAGE  [initandlisten] exception in initAndListen: Location28596: Unable to determine status of lock file in the data directory /run/media/minze/ssd/mongodb: boost::filesystem::status: Permission denied: "/run/media/minze/ssd/mongodb/mongod.lock", terminating

thanks in advance. I really don't see how mongodb would not be permitted to access a file owned by mongodb

1
  • 1
    it works when the path is not /run/media/minze/ssd/mongodb/ but /var/lib/mongodb. Even when the directory in /run is copied by using cp -a so that all permissions remain the same. Why is that – sezanzeb Dec 3 '19 at 16:45
1

It works after I did:

sudo chmod +r /run/media/minze/ssd
sudo chmod +x /run/media/minze/ssd

I don't understand why.

mongodb.lock is located in /run/media/minze/ssd/mongodb/mongodb.lock

ls -lha gives me (permissions of '.' are important here):

drwxr-xr-x 8 minze   minze   4.0K Dec  3 17:40 .
drwxr-xr-x 3 root    root      60 Dec  3 10:49 ..
drwx------ 2 root    root     16K Oct 15 20:24 lost+found
drwx------ 4 mongodb mongodb 4.0K Dec  3 17:54 mongodb

now

0

The same situation but I also had to do (database location is /mnt/database1/mongodb):

sudo chmod +x ./database1

And ls -lha gives me:

drwxr-xr-x  5 root    root    4,0K мар  4 21:47 .
drwxr-xr-x 24 root    root    4,0K фев 21 06:29 ..
drwxr-xr-x  5 root    root      70 фев 10 18:44 archive
drwx------  3 user    user      25 мар  4 21:44 database
drwxr-xr-x  3 user    user      21 мар  4 21:49 database1

The same database in the folder ./database doesn't work. And what is most interesting it had worked until I reboot the system one day. The "permission denied" error had appeared suddenly without any seemed reasons.

Your Answer

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

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