I STORAGE [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied

When I try to run mongod I get this error
I STORAGE [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied

Please paste full error.It would have given instance terminated
May be another instance running on the same port
or /data/db not existing or permissions issue

1 Like

Actually without super user mode mongod does not run in /data/db data storage path. But in lectures they are accessing mongod without using super user.
Here is the exception—>

vagrant@database:~$ mongod

2019-07-25T16:45:17.915+0000 I CONTROL [initandlisten] MongoDB starting : pid=2016 port=27017 dbpath=/data/db 64-bit host=database
2019-07-25T16:45:17.915+0000 I CONTROL [initandlisten] db version v3.2.22
2019-07-25T16:45:17.915+0000 I CONTROL [initandlisten] git version: 105acca0d443f9a47c1a5bd608fd7133840a58dd
2019-07-25T16:45:17.916+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2019-07-25T16:45:17.916+0000 I CONTROL [initandlisten] allocator: tcmalloc
2019-07-25T16:45:17.916+0000 I CONTROL [initandlisten] modules: enterprise
2019-07-25T16:45:17.916+0000 I CONTROL [initandlisten] build environment:
2019-07-25T16:45:17.916+0000 I CONTROL [initandlisten] distmod: ubuntu1404
2019-07-25T16:45:17.916+0000 I CONTROL [initandlisten] distarch: x86_64
2019-07-25T16:45:17.916+0000 I CONTROL [initandlisten] target_arch: x86_64
2019-07-25T16:45:17.917+0000 I CONTROL [initandlisten] options: {}
2019-07-25T16:45:17.933+0000 I - [initandlisten] Detected data files in /data/db created by the ‘wiredTiger’ storage engine, so setting the active storage engine to ‘wiredTiger’.
2019-07-25T16:45:17.934+0000 I STORAGE [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
2019-07-25T16:45:17.934+0000 I CONTROL [initandlisten] dbexit: rc: 100
vagrant@database:~$

After I had given read write and execute permission to this folder to all, the problem solved.