8

When I try to run mongod --dbpath=./data I get the following error:

2017-09-20T21:47:55.720+0200 I CONTROL  [initandlisten] MongoDB starting : pid=20500 port=27017 dbpath=./data 64-bit host=debian
2017-09-20T21:47:55.721+0200 I CONTROL  [initandlisten] db version v3.2.11
2017-09-20T21:47:55.721+0200 I CONTROL  [initandlisten] git version: 009580ad490190ba33d1c6253ebd8d91808923e4
2017-09-20T21:47:55.721+0200 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2l  25 May 2017
2017-09-20T21:47:55.721+0200 I CONTROL  [initandlisten] allocator: tcmalloc
2017-09-20T21:47:55.721+0200 I CONTROL  [initandlisten] modules: none
2017-09-20T21:47:55.721+0200 I CONTROL  [initandlisten] build environment:
2017-09-20T21:47:55.721+0200 I CONTROL  [initandlisten]     distarch: x86_64
2017-09-20T21:47:55.721+0200 I CONTROL  [initandlisten]     target_arch: x86_64
2017-09-20T21:47:55.722+0200 I CONTROL  [initandlisten] options: { storage: { dbPath: "./data" } }
2017-09-20T21:47:55.781+0200 I -        [initandlisten] Detected data files in ./data created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2017-09-20T21:47:55.802+0200 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2017-09-20T21:47:55.894+0200 E STORAGE  [initandlisten] WiredTiger (1) [1505936875:894516][20500:0x7f357e7c1cc0], file:WiredTiger.wt, connection: ./data/WiredTiger.wt: handle-open: open: Operation not permitted
2017-09-20T21:47:55.895+0200 I -        [initandlisten] Assertion: 28595:1: Operation not permitted
2017-09-20T21:47:55.895+0200 I STORAGE  [initandlisten] exception in initAndListen: 28595 1: Operation not permitted, terminating
2017-09-20T21:47:55.895+0200 I CONTROL  [initandlisten] dbexit:  rc: 100

The contents and permissions of the ./data directory is as follows:

drwxrwx--- 1 root vboxsf  4096 Sep 20 05:11 .
drwxrwx--- 1 root vboxsf  4096 Sep 20 22:07 ..
-rwxrwx--- 1 root vboxsf 36864 Sep 19 05:25 collection-0--661121965341019305.wt
-rwxrwx--- 1 root vboxsf 36864 Sep 19 05:26 collection-0--9187569579836644431.wt
-rwxrwx--- 1 root vboxsf 16384 Sep 19 05:24 collection-2--661121965341019305.wt
drwxrwx--- 1 root vboxsf     0 Sep 19 19:16 diagnostic.data
-rwxrwx--- 1 root vboxsf 16384 Sep 19 05:24 index-0-7518289071480072689.wt
-rwxrwx--- 1 root vboxsf 16384 Mar  1  2017 index-1-7518289071480072689.wt
-rwxrwx--- 1 root vboxsf 36864 Sep 19 05:26 index-2-7518289071480072689.wt
-rwxrwx--- 1 root vboxsf 36864 Sep 19 05:25 index-3-7518289071480072689.wt
drwxrwx--- 1 root vboxsf     0 Sep 20 05:12 journal
-rwxrwx--- 1 root vboxsf 36864 Sep 19 05:24 _mdb_catalog.wt
-rwxrwx--- 1 root vboxsf     0 Sep 20 05:11 mongod.lock
-rwxrwx--- 1 root vboxsf 36864 Sep 19 05:26 sizeStorer.wt
-rwxrwx--- 1 root vboxsf    95 Feb 23  2017 storage.bson
-rwxrwx--- 1 root vboxsf    49 Feb 23  2017 WiredTiger
-rwxrwx--- 1 root vboxsf  4096 Sep 19 05:24 WiredTigerLAS.wt
-rwxrwx--- 1 root vboxsf    21 Sep 20 04:49 WiredTiger.lock
-rwxrwx--- 1 root vboxsf  1000 Sep 19 05:27 WiredTiger.turtle
-rwxrwx--- 1 root vboxsf 61440 Sep 20 05:12 WiredTiger.wt

My user is in the vboxsf group.

Does anyone know why I'm getting this error, or what I can do to fix this?


I should note that I'm running Debian inside Virtual Box on a Windows 8.1 host. The directory in question is a shared folder (hence the vboxsf group).

2
  • I have update query according to your log files. The real error is Cannot start server. Sep 21, 2017 at 8:33
  • Have your tried your dbpath with repair mongo command such as "mongod --dbpath /data/db –repair" . Sep 21, 2017 at 9:16

3 Answers 3

4

Know problem with mongod... It don't work with VirtualBox shared folders. dbPath must be local, NFS, SAN.. Anyway something what is mounted...

1
  • 1
    Seems like this is the problem. Rats.
    – o01
    Sep 21, 2017 at 15:28
6

A summary of possible solutions are listed below for your convenience:

MongoDB Operation Not Permitted

MongoDB was working perfectly until one day it generated a lock file and stopped starting with the following error:

The corresponding accepted Answer was:

Assuming permissions are correct. It could be an selinux issue, try:

setenforce 0

then try to start the server. If the server starts, you will have to use semanage to set the proper context to the mongo data folder

Windows mounting /data/db

I'm trying to mount /data/db from my Windows dev PC but everytime I try, Mongo crashes as it seems to not have the right BUT :

  • I have changed the security parameters in windows to allow everyone to do everything (full access)
  • If I mount in a different directory, it works (the container launchs itself and I can write in my directory)

A possible explanation was:

Found a link: VirtualBox Shared Folders are not supported by mongodb.

Apparently one user found a workaround and documented it as:

It works using a volume which is created using docker volume create --name=myvolume The volume name is used instead of the local path. It's just a workaround. To be more precise the line I used in my case :

docker volume create --name=mongodata
docker run -d -p 27017:27017 -v mongodata:/data/db --name=mymongo mongodb:3.3

Mongodb with volume doesn't work (Operation not permitted)

The initial person writing the issue had already determined that it wouldn't work and was in search of a solution.

Mongo docs says For example, HGFS and Virtual Box’s shared folders do not support this operation. https://docs.mongodb.com/manual/administration/production-notes/#fsync-on-directories

I wonder if it is possible to make work on current docker for windows.

There was a link in this case that recommeded tuning the mongodb storage engine:

Doesn't docker plan to implemnt something like this?

No, not right now. You might be able to tweak the mongodb storage engine to work on an SMB share: https://forums.docker.com/t/issues-with-mongo-with-mounted-volume-for-data/15085/4

Summary

There are multiple issues surrounding MongoDB and virtual servers on Microsoft Windows, so you might want to consider running your MongoDB in a *nix environment.

1
  • For me, it was the relative path in the volume mapping -v mongodata:/data/db. When I changed to an absolute local path -v ${PWD}/mongodata:/data/db it worked.
    – Amnon
    Jan 31, 2022 at 16:33
1
2017-09-20T21:47:55.802+0200 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2017-09-20T21:47:55.894+0200 E STORAGE  [initandlisten] WiredTiger (1) [1505936875:894516][20500:0x7f357e7c1cc0], file:WiredTiger.wt, connection: ./data/WiredTiger.wt: handle-open: open: Operation not permitted
2017-09-20T21:47:55.895+0200 I -        [initandlisten] Assertion: 28595:1: Operation not permitted
2017-09-20T21:47:55.895+0200 I STORAGE  [initandlisten] exception in initAndListen: 28595 1: Operation not permitted, terminating
2017-09-20T21:47:55.895+0200 I CONTROL  [initandlisten] dbexit:  rc: 100

Mr. @o01, I have gone through your error log actually the real error is Cannot start server. The default storage engine wiredTiger is not available with this build of mongod.

what is your installation mongod server path from there you run the below mention command.

Please specify a different storage engine explicitly.

e.g. mongod.exe --storageEngine=mmapv1

for your further ref Storage Engines

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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