Skip to content

Operation not permitted on NTFS volumes #243

Closed

Description

@bhamon

The following command fails:

% docker run -it --rm -v ${PWD}/db:data/db mongo:3.6-jessie
2018-01-26T17:08:45.414+0000 I CONTROL  [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=0c2777f39bd4
2018-01-26T17:08:45.415+0000 I CONTROL  [initandlisten] db version v3.6.2
2018-01-26T17:08:45.415+0000 I CONTROL  [initandlisten] git version: 489d177dbd0f0420a8ca04d39fd78d0a2c539420
2018-01-26T17:08:45.415+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1t  3 May 2016
2018-01-26T17:08:45.415+0000 I CONTROL  [initandlisten] allocator: tcmalloc
2018-01-26T17:08:45.415+0000 I CONTROL  [initandlisten] modules: none
2018-01-26T17:08:45.415+0000 I CONTROL  [initandlisten] build environment:
2018-01-26T17:08:45.415+0000 I CONTROL  [initandlisten]     distmod: debian81
2018-01-26T17:08:45.415+0000 I CONTROL  [initandlisten]     distarch: x86_64
2018-01-26T17:08:45.415+0000 I CONTROL  [initandlisten]     target_arch: x86_64
2018-01-26T17:08:45.415+0000 I CONTROL  [initandlisten] options: { net: { bindIpAll: true }, storage: { dbPath: "/data/db" } }
2018-01-26T17:08:45.416+0000 I -        [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2018-01-26T17:08:45.416+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=3419M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2018-01-26T17:08:45.432+0000 E STORAGE  [initandlisten] WiredTiger error (1) [1516986525:432513][1:0x7fbba23e3a00], file:WiredTiger.wt, connection: /data/db/WiredTiger.wt: handle-open: open: Operation not permitted
2018-01-26T17:08:45.433+0000 E -        [initandlisten] Assertion: 28595:1: Operation not permitted src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 413
2018-01-26T17:08:45.436+0000 I STORAGE  [initandlisten] exception in initAndListen: Location28595: 1: Operation not permitted, terminating
2018-01-26T17:08:45.436+0000 I NETWORK  [initandlisten] shutdown: going to close listening sockets...
2018-01-26T17:08:45.436+0000 I NETWORK  [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2018-01-26T17:08:45.436+0000 I CONTROL  [initandlisten] now exiting
2018-01-26T17:08:45.436+0000 I CONTROL  [initandlisten] shutting down with code:100

The path ${PWD}/db is located to an NTFS drive.
It seems to be a known issue around the NTFS support over mounted volumes (#190 for example).

However, what I can't explain is the following (that works!):

% docker run -it --rm -v $PWD/db:/data/db mongo:3.6-jessie /bin/bash
% mongod --dbpath /data/db
2018-01-26T17:40:26.701+0000 I CONTROL  [initandlisten] MongoDB starting : pid=7 port=27017 dbpath=/data/db 64-bit host=d904a58096a3
2018-01-26T17:40:26.702+0000 I CONTROL  [initandlisten] db version v3.6.2
2018-01-26T17:40:26.702+0000 I CONTROL  [initandlisten] git version: 489d177dbd0f0420a8ca04d39fd78d0a2c539420
2018-01-26T17:40:26.702+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1t  3 May 2016
2018-01-26T17:40:26.702+0000 I CONTROL  [initandlisten] allocator: tcmalloc
2018-01-26T17:40:26.702+0000 I CONTROL  [initandlisten] modules: none
2018-01-26T17:40:26.702+0000 I CONTROL  [initandlisten] build environment:
2018-01-26T17:40:26.702+0000 I CONTROL  [initandlisten]     distmod: debian81
2018-01-26T17:40:26.702+0000 I CONTROL  [initandlisten]     distarch: x86_64
2018-01-26T17:40:26.702+0000 I CONTROL  [initandlisten]     target_arch: x86_64
2018-01-26T17:40:26.702+0000 I CONTROL  [initandlisten] options: { storage: { dbPath: "/data/db" } }
2018-01-26T17:40:26.704+0000 I -        [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2018-01-26T17:40:26.704+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=3419M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2018-01-26T17:40:31.417+0000 I STORAGE  [initandlisten] WiredTiger message [1516988431:417429][7:0x7fb440362a00], txn-recover: Main recovery loop: starting at 4/4736
2018-01-26T17:40:31.521+0000 I STORAGE  [initandlisten] WiredTiger message [1516988431:521303][7:0x7fb440362a00], txn-recover: Recovering log 4 through 5
2018-01-26T17:40:31.615+0000 I STORAGE  [initandlisten] WiredTiger message [1516988431:615200][7:0x7fb440362a00], txn-recover: Recovering log 5 through 5
2018-01-26T17:40:32.260+0000 I CONTROL  [initandlisten] 
2018-01-26T17:40:32.261+0000 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-01-26T17:40:32.261+0000 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2018-01-26T17:40:32.261+0000 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2018-01-26T17:40:32.261+0000 I CONTROL  [initandlisten] 
2018-01-26T17:40:32.261+0000 I CONTROL  [initandlisten] ** WARNING: This server is bound to localhost.
2018-01-26T17:40:32.261+0000 I CONTROL  [initandlisten] **          Remote systems will be unable to connect to this server. 
2018-01-26T17:40:32.261+0000 I CONTROL  [initandlisten] **          Start the server with --bind_ip <address> to specify which IP 
2018-01-26T17:40:32.261+0000 I CONTROL  [initandlisten] **          addresses it should serve responses from, or with --bind_ip_all to
2018-01-26T17:40:32.261+0000 I CONTROL  [initandlisten] **          bind to all interfaces. If this behavior is desired, start the
2018-01-26T17:40:32.261+0000 I CONTROL  [initandlisten] **          server with --bind_ip 127.0.0.1 to disable this warning.
2018-01-26T17:40:32.261+0000 I CONTROL  [initandlisten] 
2018-01-26T17:40:32.290+0000 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2018-01-26T17:40:32.290+0000 I NETWORK  [initandlisten] waiting for connections on port 27017

Do you have an explanation on this?
If there is an issue with the NTFS support, why does it works when entering the container directly?

Activity

  1. tianon commented on Jan 26, 2018

    @tianon
    Member

    Duplicate of #205.

  2. bhamon commented on Jan 26, 2018

    @bhamon
    Author

    This issue is in contradiction with #205.
    The autostart command fails (mongod), but with the same NTFS volume mounted I got it to work with a simple mongod call from inside the container.

  3. tianon commented on Jan 26, 2018

    @tianon
    Member

    Oh, interesting quirk! Investigating now!

  4. reopened this on Jan 26, 2018
  5. tianon commented on Jan 26, 2018

    @tianon
    Member

    Oh, the difference is root vs non-root. When you run mongod directly from the bash shell, it's running as root and thus has permission to access the NTFS filesystem. It also works if you mount the NTFS partition as the target user directly:

    $ docker run -it --rm -v "$PWD/mongo":/data/db --user 1000:1000 mongo:3.4-jessie
    2018-01-26T18:09:19.964+0000 I CONTROL  [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=d18f8f1be2d4
    2018-01-26T18:09:19.964+0000 I CONTROL  [initandlisten] db version v3.4.10
    2018-01-26T18:09:19.964+0000 I CONTROL  [initandlisten] git version: 078f28920cb24de0dd479b5ea6c66c644f6326e9
    2018-01-26T18:09:19.964+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1t  3 May 2016
    2018-01-26T18:09:19.964+0000 I CONTROL  [initandlisten] allocator: tcmalloc
    2018-01-26T18:09:19.964+0000 I CONTROL  [initandlisten] modules: none
    2018-01-26T18:09:19.964+0000 I CONTROL  [initandlisten] build environment:
    2018-01-26T18:09:19.964+0000 I CONTROL  [initandlisten]     distmod: debian81
    2018-01-26T18:09:19.964+0000 I CONTROL  [initandlisten]     distarch: x86_64
    2018-01-26T18:09:19.964+0000 I CONTROL  [initandlisten]     target_arch: x86_64
    2018-01-26T18:09:19.964+0000 I CONTROL  [initandlisten] options: {}
    2018-01-26T18:09:19.968+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=31638M,session_max=20000,eviction=(threads_min=4,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),
    2018-01-26T18:10:33.127+0000 I CONTROL  [initandlisten] 
    2018-01-26T18:10:33.127+0000 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
    2018-01-26T18:10:33.127+0000 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
    2018-01-26T18:10:33.127+0000 I CONTROL  [initandlisten] 
    2018-01-26T18:10:33.127+0000 I CONTROL  [initandlisten] 
    2018-01-26T18:10:33.127+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
    2018-01-26T18:10:33.127+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
    2018-01-26T18:10:33.127+0000 I CONTROL  [initandlisten] 
    2018-01-26T18:10:33.432+0000 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
    2018-01-26T18:10:33.852+0000 I INDEX    [initandlisten] build index on: admin.system.version properties: { v: 2, key: { version: 1 }, name: "incompatible_with_version_32", ns: "admin.system.version" }
    2018-01-26T18:10:33.852+0000 I INDEX    [initandlisten] 	 building index using bulk method; build may temporarily use up to 500 megabytes of RAM
    2018-01-26T18:10:33.894+0000 I INDEX    [initandlisten] build index done.  scanned 0 total records. 0 secs
    2018-01-26T18:10:33.899+0000 I COMMAND  [initandlisten] setting featureCompatibilityVersion to 3.4
    2018-01-26T18:10:33.900+0000 I NETWORK  [thread1] waiting for connections on port 27017
  6. bhamon commented on Jan 28, 2018

    @bhamon
    Author

    Based on your comment I derived your Dockerfile by adding a USER root instruction and it works like a charm.

  7. norbertherbert commented on Feb 15, 2018

    @norbertherbert

    It does not work for me :-(
    Instead of "Operation not permitted" error I get "fdatasync: Invalid argument" error.

    `
    Windows PowerShell
    Copyright (C) Microsoft Corporation. All rights reserved.

    PS C:\Users\user01> docker run -it --rm -v $PWD/data/db:/data/db mongo:3.6-jessie /bin/bash
    root@adb5d976df7f:/# mongod --dbpath /data/db
    2018-02-15T10:08:02.495+0000 I CONTROL [initandlisten] MongoDB starting : pid=7 port=27017 dbpath=/data/db 64-bit host=adb5d976df7f
    2018-02-15T10:08:02.495+0000 I CONTROL [initandlisten] db version v3.6.2
    2018-02-15T10:08:02.495+0000 I CONTROL [initandlisten] git version: 489d177dbd0f0420a8ca04d39fd78d0a2c539420
    2018-02-15T10:08:02.495+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1t 3 May 2016
    2018-02-15T10:08:02.495+0000 I CONTROL [initandlisten] allocator: tcmalloc
    2018-02-15T10:08:02.495+0000 I CONTROL [initandlisten] modules: none
    2018-02-15T10:08:02.495+0000 I CONTROL [initandlisten] build environment:
    2018-02-15T10:08:02.495+0000 I CONTROL [initandlisten] distmod: debian81
    2018-02-15T10:08:02.496+0000 I CONTROL [initandlisten] distarch: x86_64
    2018-02-15T10:08:02.496+0000 I CONTROL [initandlisten] target_arch: x86_64
    2018-02-15T10:08:02.496+0000 I CONTROL [initandlisten] options: { storage: { dbPath: "/data/db" } }
    2018-02-15T10:08:02.503+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=478M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
    2018-02-15T10:08:02.559+0000 E STORAGE [initandlisten] WiredTiger error (17) [1518689282:559261][7:0x7f25b832ca00], connection: /data/db/WiredTiger.wt: handle-open: open: File exists
    2018-02-15T10:08:02.566+0000 I STORAGE [initandlisten] WiredTiger message unexpected file WiredTiger.wt found, renamed to WiredTiger.wt.2
    2018-02-15T10:08:02.567+0000 E STORAGE [initandlisten] WiredTiger error (22) [1518689282:567535][7:0x7f25b832ca00], connection: /data/db/: directory-sync: fdatasync: Invalid argument
    2018-02-15T10:08:02.570+0000 F - [initandlisten] Fatal Assertion 28561 at src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 410
    2018-02-15T10:08:02.570+0000 F - [initandlisten]

    ***aborting after fassert() failure

    root@adb5d976df7f:/#
    `

  8. yosifkit commented on Feb 15, 2018

    @yosifkit
    Member

    @norbertherbert, if you are using Docker for Windows or Boot2Docker it will not work to share a volume from the Windows host to the Linux container VM.

    MongoDB requires a filesystem that supports fsync() on directories. For example, HGFS and Virtual Box’s shared folders do not support this operation.

    - https://docs.mongodb.com/manual/administration/production-notes/#kernel-and-file-systems

    With Linux containers on Windows, you cannot use a volume mapped to the host (bind mount that is shared from VM to host) and instead must use a named volume to persist your database. You can use native Windows Docker containers on Windows 10 Pro (like mongo:3.6-windowsservercore), but they are not currently being updated since #241.

    This issue is about accessing an NTFS mount on a Linux host and it turns out, it was just a permissions issue. As such, it is solved and so I'll close.

  9. reuwi commented on Jun 6, 2018

    @reuwi

    @yosifkit So is there any solution or workaround to use volume mapped in win?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions