You are not logged in.

#1 2021-04-05 11:22:32

Arsakes
Member
Registered: 2011-09-17
Posts: 27

Mongodb mongo.lock access denied despite permissions

Hey my mongodb.service is not running throwinng following error:

16336 2021-04-05T13:11:08.529+0200 I  CONTROL  [initandlisten] options: { config: "/etc/mongodb.conf", ne      t: { bindIp: "127.0.0.1", port: 27017 }, processManagement: { timeZoneInfo: "/usr/share/zoneinfo" }      , storage: { dbPath: "/home/pietrko/mongo_db", journal: { enabled: true } }, systemLog: { destinati      on: "file", logAppend: true, path: "/var/log/mongodb/mongod.log", quiet: true } }
16337 2021-04-05T13:11:08.537+0200 I  STORAGE  [initandlisten] exception in initAndListen: Location28596:       Unable to determine status of lock file in the data directory /home/pietrko/mongo_db: boost::files      ystem::status: Permission denied: "/home/pietrko/mongo_db/mongod.lock", terminating

Which is weird coz:

$ ls -l mongo_db/

gives:

razem 468
-rw-rw---- 1 mongodb mongodb 20480 04-05 02:17 collection-0--8708570461896956440.wt
-rw-rw---- 1 mongodb mongodb 53248 04-05 02:17 collection-2--8708570461896956440.wt
-rw-rw---- 1 mongodb mongodb 36864 04-05 02:17 collection-4--8708570461896956440.wt
-rw-rw---- 1 mongodb mongodb 36864 04-05 02:17 collection-8--8708570461896956440.wt
drwxrw---- 2 mongodb mongodb  4096 04-05 02:17 diagnostic.data
-rw-rw---- 1 mongodb mongodb 20480 04-05 02:17 index-1--8708570461896956440.wt
-rw-rw---- 1 mongodb mongodb 36864 04-05 02:17 index-3--8708570461896956440.wt
-rw-rw---- 1 mongodb mongodb 36864 04-05 02:17 index-5--8708570461896956440.wt
-rw-rw---- 1 mongodb mongodb 36864 04-05 02:17 index-6--8708570461896956440.wt
-rw-rw---- 1 mongodb mongodb 20480 04-05 02:17 index-9--8708570461896956440.wt
drwxrw---- 2 mongodb mongodb  4096 04-05 01:47 journal
-rw-rw---- 1 mongodb mongodb 36864 04-05 02:17 _mdb_catalog.wt
-rw-rw-r-- 1 mongodb mongodb     0 04-05 13:18 mongod.lock
-rw-rw---- 1 mongodb mongodb 36864 04-05 02:17 sizeStorer.wt
-rw-rw---- 1 mongodb mongodb   114 2020-02-19  storage.bson
-rw-rw---- 1 mongodb mongodb    47 2020-02-19  WiredTiger
-rw-rw---- 1 mongodb mongodb  4096 04-05 02:17 WiredTigerLAS.wt
-rw-rw---- 1 mongodb mongodb    21 2020-02-19  WiredTiger.lock
-rw-rw---- 1 mongodb mongodb  1198 04-05 02:17 WiredTiger.turtle
-rw-rw---- 1 mongodb mongodb 61440 04-05 02:17 WiredTiger.wt

Here are permissions to the directory

drwxr-xr-x  4 mongodb mongodb     4096 04-05 13:18  mongo_db

In systemtmd unit config file for mongodb.service has an option:

User=mongodb

So if I understand correctly mongod  service runs with mongdb user,
What am I missing here?

Last edited by Arsakes (2021-04-05 11:27:00)

Offline

#2 2021-04-05 13:50:10

twelveeighty
Member
From: Alberta, Canada
Registered: 2011-09-04
Posts: 805

Re: Mongodb mongo.lock access denied despite permissions

Update/Add the --dbpath parameter as described in the Wiki. Your database should not be in your home directory, unless you also run the database process as your regular user.

Always back up your data before making any changes.

Offline

Board footer

Powered by FluxBB