Mongodb can not start because of WiredTiger.turtle permissions

18.7k views Asked by At

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.

4

There are 4 answers

0
W. Ding On

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.
0
suther On

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

0
Juanbg.dev On

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.

2
FiaSoM On

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/*