toolkit icon indicating copy to clipboard operation
toolkit copied to clipboard

mongo DB premission issus on WSL 2 during initial setup

Open TKMYing opened this issue 2 months ago • 1 comments

Steps to Reproduce

New deployment with overleaf-toolkit using WSL 2 Ubuntu+Docker Desktop for Windows My user is the administrator of windows.

  1. clone overleaf-toolkit into the directory and rename it.
  2. C:\srv\Overleaf>wsl
:/mnt/c/srv/Overleaf$ tree -L 1
.
├── CHANGELOG.md
├── LICENSE
├── README.md
├── bin
├── config
├── data
├── doc
└── lib
  1. :/mnt/c/srv/Overleaf$ ./bin/init
  2. :/mnt/c/srv/Overleaf$ ./bin/up

Expected Behaviour

I have experience in using docker-compose.yml to self-host overleaf. I expect the new deployment work the same as deploying with docker-compose.yml, which is compose stack up with all 3 containers also up: mongo, redis, sharelatex

Observed Behaviour

Only mongo 6.0 is showing in the compose stack in docker desktop, shown but seems keeps up and stop. other containers did't show as expected.

Context

Compose stack did not work as expected, tried to acqiure logs of mongo DB by docker logs mongo

Technical Info

  • Windows 10 22H2 10.0.19045.6456
  • Docker version 28.5.1, build e180ab8
  • Ubuntu 24.04.3 LTS
C:\srv\Overleaf>wsl -l
适用于 Linux 的 Windows 子系统分发:
Ubuntu (默认值)
docker-desktop
Logs of mongo DB↓

:/mnt/c/srv/Overleaf$ docker logs mongo
{"t":{"$date":"2025-10-24T14:22:25.013+00:00"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"-","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --s
slDisabledProtocols 'none'"}
{"t":{"$date":"2025-10-24T14:22:25.016+00:00"},"s":"I",  "c":"NETWORK",  "id":4915701, "ctx":"-","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalCli
ent":{"minWireVersion":0,"maxWireVersion":17},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":17},"outgoing":{"minWireVersion":6,"maxWireVersion":17},"isInter
nalClient":true}}}
{"t":{"$date":"2025-10-24T14:22:25.018+00:00"},"s":"I",  "c":"NETWORK",  "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, s
et tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
{"t":{"$date":"2025-10-24T14:22:25.020+00:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"Te
nantMigrationDonorService","namespace":"config.tenantMigrationDonors"}}
{"t":{"$date":"2025-10-24T14:22:25.020+00:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"Te
nantMigrationRecipientService","namespace":"config.tenantMigrationRecipients"}}
{"t":{"$date":"2025-10-24T14:22:25.020+00:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"Sh
ardSplitDonorService","namespace":"config.tenantSplitDonors"}}
{"t":{"$date":"2025-10-24T14:22:25.020+00:00"},"s":"I",  "c":"CONTROL",  "id":5945603, "ctx":"main","msg":"Multi threading initialized"}
{"t":{"$date":"2025-10-24T14:22:25.020+00:00"},"s":"I",  "c":"CONTROL",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":1,"port":27017,"dbPath":
"/data/db","architecture":"64-bit","host":"b37e1ba3e8e5"}}
{"t":{"$date":"2025-10-24T14:22:25.020+00:00"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"6.0.26","git
Version":"0c4ec4b6005f75582ce208fc800f09f561b6c2e8","openSSLVersion":"OpenSSL 3.0.2 15 Mar 2022","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu2204","
distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2025-10-24T14:22:25.020+00:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version
":"22.04"}}}
{"t":{"$date":"2025-10-24T14:22:25.020+00:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"net":{"
bindIp":"*"},"replication":{"replSet":"overleaf"}}}}
{"t":{"$date":"2025-10-24T14:22:25.026+00:00"},"s":"I",  "c":"STORAGE",  "id":22315,   "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=
15511M,session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,remove=true,path=journal,compressor=snappy),builtin_ex
tension_config=(zstd=(compression_level=6)),file_manager=(close_idle_time=600,close_scan_interval=10,close_handle_minimum=2000),statistics_log=(wait=0),json_output=(error,m
essage),verbose=[recovery_progress:1,checkpoint_progress:1,compact_progress:1,backup:0,checkpoint:0,compact:0,evict:0,history_store:0,recovery:0,rts:0,salvage:0,tiered:0,ti
mestamp:0,transaction:0,verify:0,log:0],"}}
{"t":{"$date":"2025-10-24T14:22:25.200+00:00"},"s":"E",  "c":"WT",       "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error message","attr":{"error":1,"message":{"
ts_sec":1761315745,"ts_usec":199558,"thread":"1:0x736e61c5acc0","session_name":"connection","category":"WT_VERB_DEFAULT","category_id":9,"verbose_level":"ERROR","verbose_le
vel_id":-3,"msg":"__posix_open_file:812:/data/db/WiredTiger.wt: handle-open: open","error_str":"Operation not permitted","error_code":1}}}
{"t":{"$date":"2025-10-24T14:22:25.216+00:00"},"s":"E",  "c":"WT",       "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error message","attr":{"error":17,"message":{
"ts_sec":1761315745,"ts_usec":216473,"thread":"1:0x736e61c5acc0","session_name":"connection","category":"WT_VERB_DEFAULT","category_id":9,"verbose_level":"ERROR","verbose_l
evel_id":-3,"msg":"__posix_open_file:812:/data/db/WiredTiger.wt: handle-open: open","error_str":"File exists","error_code":17}}}
{"t":{"$date":"2025-10-24T14:22:25.219+00:00"},"s":"I",  "c":"WT",       "id":22430,   "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":17613157
45,"ts_usec":218987,"thread":"1:0x736e61c5acc0","session_name":"connection","category":"WT_VERB_BLOCK","category_id":3,"verbose_level":"NOTICE","verbose_level_id":-1,"msg":
"unexpected file WiredTiger.wt found, renamed to WiredTiger.wt.1"}}}
{"t":{"$date":"2025-10-24T14:22:25.220+00:00"},"s":"E",  "c":"WT",       "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error message","attr":{"error":1,"message":{"
ts_sec":1761315745,"ts_usec":220548,"thread":"1:0x736e61c5acc0","session_name":"connection","category":"WT_VERB_DEFAULT","category_id":9,"verbose_level":"ERROR","verbose_le
vel_id":-3,"msg":"__posix_open_file:812:/data/db/WiredTiger.wt: handle-open: open","error_str":"Operation not permitted","error_code":1}}}
{"t":{"$date":"2025-10-24T14:22:25.235+00:00"},"s":"E",  "c":"WT",       "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error message","attr":{"error":17,"message":{
"ts_sec":1761315745,"ts_usec":235436,"thread":"1:0x736e61c5acc0","session_name":"connection","category":"WT_VERB_DEFAULT","category_id":9,"verbose_level":"ERROR","verbose_l
evel_id":-3,"msg":"__posix_open_file:812:/data/db/WiredTiger.wt: handle-open: open","error_str":"File exists","error_code":17}}}
{"t":{"$date":"2025-10-24T14:22:25.238+00:00"},"s":"I",  "c":"WT",       "id":22430,   "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":17613157
45,"ts_usec":238437,"thread":"1:0x736e61c5acc0","session_name":"connection","category":"WT_VERB_BLOCK","category_id":3,"verbose_level":"NOTICE","verbose_level_id":-1,"msg":
"unexpected file WiredTiger.wt found, renamed to WiredTiger.wt.2"}}}
{"t":{"$date":"2025-10-24T14:22:25.239+00:00"},"s":"E",  "c":"WT",       "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error message","attr":{"error":1,"message":{"
ts_sec":1761315745,"ts_usec":239837,"thread":"1:0x736e61c5acc0","session_name":"connection","category":"WT_VERB_DEFAULT","category_id":9,"verbose_level":"ERROR","verbose_le
vel_id":-3,"msg":"__posix_open_file:812:/data/db/WiredTiger.wt: handle-open: open","error_str":"Operation not permitted","error_code":1}}}
{"t":{"$date":"2025-10-24T14:22:25.242+00:00"},"s":"W",  "c":"STORAGE",  "id":22347,   "ctx":"initandlisten","msg":"Failed to start up WiredTiger under any compatibility ve
rsion. This may be due to an unsupported upgrade or downgrade."}
{"t":{"$date":"2025-10-24T14:22:25.242+00:00"},"s":"F",  "c":"STORAGE",  "id":28595,   "ctx":"initandlisten","msg":"Terminating.","attr":{"reason":"1: Operation not permitt
ed"}}
{"t":{"$date":"2025-10-24T14:22:25.242+00:00"},"s":"F",  "c":"ASSERT",   "id":23091,   "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":28595,"file":"src/mongo
/db/storage/wiredtiger/wiredtiger_kv_engine.cpp","line":708}}
{"t":{"$date":"2025-10-24T14:22:25.242+00:00"},"s":"F",  "c":"ASSERT",   "id":23092,   "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
{"t":{"$date":"2025-10-24T14:22:25.816+00:00"},"s":"I",  "c":"NETWORK",  "id":4915701, "ctx":"-","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalCli
ent":{"minWireVersion":0,"maxWireVersion":17},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":17},"outgoing":{"minWireVersion":6,"maxWireVersion":17},"isInter
nalClient":true}}}

Analysis

My kimiAI gave me the key infomation as follows:

{"t":{"$date":"2025-10-24T14:22:26.959+00:00"},"s":"F", "c":"STORAGE", "id":28595, "ctx":"initandlisten","msg":"Terminating.","attr":{"reason":"1: Operation not permitted"}} {"t":{"$date":"2025-10-24T14:22:26.959+00:00"},"s":"F", "c":"ASSERT", "id":23091, "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":28595,"file":"src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp","line":708}} {"t":{"$date":"2025-10-24T14:22:28.022+00:00"},"s":"W", "c":"STORAGE", "id":22347, "ctx":"initandlisten","msg":"Failed to start up WiredTiger under any compatibility version. This may be due to an unsupported upgrade or downgrade."}}

MongoDB 6’s WiredTiger engine requires chmod and mmap(MAP_SHARED) on its data files. When the data directory is mounted from Windows via WSL 2’s 9P filesystem (/mnt/c/...), these operations return “Operation not permitted”, causing the daemon to abort. Placing the directory inside WSL’s native ext4 (/home/...) avoids the 9P limitation and lets WiredTiger start normally.

Solution

change this line in overleaf.rc MONGO_DATA_PATH=data/mongo from NTFS directory to WSL’s native ext4 directory MONGO_DATA_PATH=/home/<wsl_user>/mongo

The compose stack now works as expected.

(This is my first GitHub issue—documenting the deployment problems I ran into and how I solved them. Hope it helps future users:) Feel free to correct anything that looks off.)

TKMYing avatar Oct 24 '25 16:10 TKMYing

update

Observed Behaviour

the frontend have no premission to access the complied file, although the pdf file is complied successfully inC:\srv\Overleaf\data\overleaf\data\compiles. Server Error Sorry, something went wrong and your project could not be compiled. Please try again in a few moments.

2490-e5c02a4f5b91d87cc413.js:1   POST http://localhost:31000/project/68fc7d75aa52f57a38750c18/compile? 500 (Internal Server Error)

Analysis

docker exec -it sharelatex bash
root@3761da5b937a:/overleaf# cd /var/log/overleaf
root@3761da5b937a:/var/log/overleaf# tail -f web.log
/var/log/overleaf# tail -f web.log

{
    "name": "web",
    "hostname": "3761da5b937a",
    "pid": 166,
    "level": 50,
    "err": {
        "message": "CLSI returned non-success code: 500",
        "name": "OError",
        "stack": "OError: CLSI returned non-success code: 500\n    at _postToClsi (/overle
        af/services/web/app/src/Features/Compile/ClsiManager.js:492:15)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async _sendBuiltRequest (/overleaf/services/web/app/src/F
        eatures/Compile/ClsiManager.js:188:38)\n    at async sendRequestOnce (/overleaf/services/web/app/src/Features/Compile/ClsiManager.js:92:10)\n    at async Object.sendRequest (/overleaf/services/web/app/src/Features
        /Compile/ClsiManager.js:58:16)\n    at async compile (/overleaf/services/web/app/src/Features/Compile/CompileManager.js:90:7)\n    at async Object.compile (/overleaf/services/web/app/src/Features/Compile/CompileMa
        nager.js:22:14)\n    at async compile (/overleaf/services/web/app/src/Features/Compile/CompileController.js:186:9)",
        "info": {
            "projectId": "68fc7d75aa52f57a38750c18",
            "userId": "68fb96f0430c8a428e85d086",
            "compileOption
            s": {
                "buildId": "19a1adf5052-86336cb303aae487",
                "editorId": "df031f07-1f31-493b-8005-43021327adaf",
                "compiler": "pdflatex",
                "timeout": 180,
                "draft": false,
                "stopOnFirstError": false,
                "check": "silent",
                "syncType": "full",
                "syncSta
                te": "ba3e5f4223777763dad79c5a52558db65ed78fea",
                "compileGroup": "standard",
                "compileFromClsiCache": false,
                "populateClsiCache": false,
                "enablePdfCaching": false,
                "metricsMethod": "standard"
            },
            "rootResourcePath": "main.tex",
            "c
            lsiResponse": "{\"compile\":{\"status\":\"error\",\"error\":\"EPERM: operation not permitted, copyfile '/var/lib/overleaf/data/compiles/68fc7d75aa52f57a38750c18-68fb96f0430c8a428e85d086/output.aux' -> '/var/lib/ove
            rleaf/data/output/68fc7d75aa52f57a38750c18-68fb96f0430c8a428e85d086/generated-files/19a1adf5052-86336cb303aae487/output.aux'\",\"stats\":{\"latexmk-errors\":0,\"latex-runs\":0,\"latex-runs-with-errors\":0,\"latex-
            runs-0\":1,\"latex-runs-with-errors-0\":0},\"timings\":{\"sync\":32,\"compile\":463},\"outputUrlPrefix\":\"\",\"outputFiles\":[]}}",
            "statusCode": 500
        }
    },
    "responseTimeMs": 552,
    "req": {
        "method": "POST",
        "url": "/project/68
        fc7d75aa52f57a38750c18/compile?",
        "remoteAddress": "127.0.0.1",
        "headers": {
            "referer": "http://localhost:31000/project/68fc7d75aa52f57a38750c18",
            "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.3
            6 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36 Edg/141.0.0.0",
            "content-length": "159"
        }
    },
    "res": {
        "statusCode": 500,
        "headers": {
            "content-length": "788"
        }
    },
    "msg": "POST /project/68fc7d75aa52f57a38750c18/compile?",
    "tim
    e": "2025-10-25T10:17:14.605Z",
    "v": 0
}

"error":"EPERM: operation not permitted, copyfile '/var/lib/overleaf/data/compiles/.../output.aux' -> '/var/lib/overleaf/data/output/.../generated-files/.../output.aux'"

The root cause is not traditional Unix permissions but a WSL + Docker Desktop limitation:

Even with chmod 777, Node still gets EPERM because the files reside on Windows drives (/mnt/c/...) mounted via 9P.
The 9P filesystem does not support chmod/chown/ACL operations, so any copy or permission change on those paths silently fails, causing the "operation not permitted" error during post-compile file moves.

Soultion

Please also change this path OVERLEAF_DATA_PATH=/home/<wsl_user>/overleaf into EXT4 filesystem. Otherwise the frontend have no premission to access the complied file.

Overall, using the combibnation of Windows + WSL2 + overleaf-toolkit will experience permission issues. Not suggested.

TKMYing avatar Oct 25 '25 10:10 TKMYing