HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

MongoDB refuse to start, operation not permitted

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
refusemongodboperationpermittedstartnot

Problem

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:

Solution

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.

Code Snippets

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

Context

StackExchange Database Administrators Q#186478, answer score: 7

Revisions (0)

No revisions yet.