Mongodb can not start because of WiredTiger.turtle permissions
Asked Answered
N

4

19

I am trying to start mongodb 4.0.4 on ubuntu 16.04, but the database denies all my tries. I checked mongodb log files and find out that the file named WiredTiger.turtle has no needed permissions. Here log errors:

2018-11-26T15:14:32.438+0600 E STORAGE  [initandlisten] WiredTiger error (13) [1543223672:438144][32673:0x7fee423e3a40], wiredtiger_open: __posix_open_file, 715: /var/lib/mongodb/WiredTiger.turtle: handle-open: open: Permission denied Raw: [1543223672:438144][32673:0x7fee423e3a40], wiredtiger_open: __posix_open_file, 715: /var/lib/mongodb/WiredTiger.turtle: handle-open: open: Permission denied
2018-11-26T15:14:32.438+0600 E STORAGE  [initandlisten] WiredTiger error (13) [1543223672:438429][32673:0x7fee423e3a40], wiredtiger_open: __posix_open_file, 715: /var/lib/mongodb/WiredTiger.turtle: handle-open: open: Permission denied Raw: [1543223672:438429][32673:0x7fee423e3a40], wiredtiger_open: __posix_open_file, 715: /var/lib/mongodb/WiredTiger.turtle: handle-open: open: Permission denied
2018-11-26T15:14:32.438+0600 E STORAGE  [initandlisten] WiredTiger error (13) [1543223672:438594][32673:0x7fee423e3a40], wiredtiger_open: __posix_open_file, 715: /var/lib/mongodb/WiredTiger.turtle: handle-open: open: Permission denied Raw: [1543223672:438594][32673:0x7fee423e3a40], wiredtiger_open: __posix_open_file, 715: /var/lib/mongodb/WiredTiger.turtle: handle-open: open: Permission denied
2018-11-26T15:14:32.438+0600 W STORAGE  [initandlisten] Failed to start up WiredTiger under any compatibility version.
2018-11-26T15:14:32.438+0600 F STORAGE  [initandlisten] Reason: 13: Permission denied
2018-11-26T15:14:32.438+0600 F -        [initandlisten] Fatal Assertion 28595 at src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 646
2018-11-26T15:14:32.438+0600 F -        [initandlisten] 

***aborting after fassert() failure

I gave all permissions to the all files in /var/lib/mongodb/. But when I start mongodb WiredTiger.turtle file's permission reset. Just for check I deleted this file, but file appears itself again and error repeats.

Ninurta answered 26/11, 2018 at 9:30 Comment(0)
C
43

Same problem with WiredTiger.turtle permissions. Ubuntu 18.04 My problem was I started a mongod service with sudo. This created files with root:root ownership in my database directory. When starting mongod service without sudo I received the permission denied error.

Solution was to change ownership of all files in the db directory back to mongodb:mongodb

$ sudo chown -R mongodb:mongodb /var/lib/mongodb/*

Clutch answered 9/3, 2020 at 17:25 Comment(3)
It saved me hours. Thanks.Merino
Worked for me, Thanks!Backflow
I recommend also looking at @W. Ding's answer below to understand and avoid the causes of this.Larimore
W
2

The above answers only tell how to solve this problem for one time, but if you don't know why this happens, it may occur over and over again.

Let me add why this problem happens and how it can be avoided.

It is most likely you have ever run sudo mongod directly, so that root user tries to write something into the database directory, corrupting the path. You should use monogodb user to start the process.

So, please always stick to the following two ways to start mongod:

  1. sudo service mongod start: This will use /etc/systemd/system/mongod.service as config file to start mongod. In this config file, user monogodb has been specified.
  2. sudo -u mongodb mongod: Another way is to specify which user to start this process directly. This grants you more flexibility but less reproducibility. When you finish configuring your MongoDB, it is recommended to persistent your config into /etc/mongod.conf or /etc/systemd/system/mongod.service, and use the first way to start process.
Winger answered 19/11, 2023 at 3:52 Comment(1)
This answers exactly the kind of systemic concern that hack/workaround answers seem to miss. "Why is it a problem to begin with?!" We want to prevent these things, not just chase the problems forever.Larimore
R
0

I solve the same problem that you had deleting my /data/db folder, after that I re-created it and I gave it write and read control.

I used the official documentation to install my version but additional I did the stuff with data folder

Hope help.

Ruy answered 2/1, 2019 at 18:32 Comment(0)
A
0

In my case on Manjaro-Linux (Arch-Linux like), there was a wrong user:group permission on /var/lib/mongodb/WiredTiger.turtle.

Doing sudo chown mongodb:daemon /var/lib/mongodb/WiredTiger.turtle fix it for me.

BUT what was the cause of this permission-failure?

The cause was, that I've tried to limit the Cache-Usage of the wiredTigerCache. Everytime I try this, permissions are set in wrong way to root:root sudo mongod --wiredTigerCacheSizeGB 1

Aftmost answered 3/3, 2021 at 10:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.