[SERVER-21199] WiredTiger journal file owned by root when mongod is run as root prevents subsequent starts as mongodb user Created: 29/Oct/15  Updated: 29/Oct/15  Resolved: 29/Oct/15

Status: Closed
Project: Core Server
Component/s: Admin, WiredTiger
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Minor - P4
Reporter: Venkatesh kumar Assignee: Ramon Fernandez Marina
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

ubuntu server


Attachments: PNG File mongoerror.png     PNG File mongoerror1.png    
Participants:

 Description   

Mongodb abruptly got shut down due to reboot the server.

So,we have script to start the mongo process whenever the server is boot up

But got permission denied error.

when i checked in log file, username got changed for that log file.



 Comments   
Comment by Ramon Fernandez Marina [ 29/Oct/15 ]

venkat@890, I'm able to reproduce this behavior by running mongod as root, then attempting to run it as the mongodb user multiple times. This is how my journal directory looks like after that:

$ ls -la journal
total 512028
drwxrwxr-x 2 mongodb   mongodb   4096 Oct 29 18:14 .
drwxrwxr-x 3 mongodb   mongodb   4096 Oct 29 18:14 ..
-rw-r--r-- 1 root      root      2944 Oct 29 18:14 WiredTigerLog.0000000003
-rw-rw-r-- 1 mongodb   mongodb    256 Oct 29 18:14 WiredTigerLog.0000000004
-rw-rw-r-- 1 mongodb   mongodb    256 Oct 29 18:14 WiredTigerLog.0000000005
-rw-rw-r-- 1 mongodb   mongodb    256 Oct 29 18:14 WiredTigerLog.0000000006
-rw-rw-r-- 1 mongodb   mongodb    256 Oct 29 18:14 WiredTigerLog.0000000007

Please review your procedures to make sure mongod is not started as root to prevent this scenario.

Regards,
Ramón.

Comment by Ramon Fernandez Marina [ 29/Oct/15 ]

venkat@890, what filesystem are you using for the journal directory? Also, could you share the script you use to start mongod when the server boots?

We'll also need to look at the MongoDB logs from right before the abrupt shutdown until the restart attempt that failed because of the file permissions.

Thanks,
Ramón.

Generated at Thu Feb 08 03:56:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.