Yes, it is SELINUX which is the culprit .
I found this: https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-red-hat/
Which states:
###################################################
If your MongoDB deployment uses custom settings for any of the following:
You cannot use the MongoDB supplied SELinux policy. An alternative is to create a [custom SELinux policy]
###############################################
It gives instructions on how to build a new policy 
- Download the policy repository.
git clone htps://github.com/mongodb/mongodb-selinux
- Build the policy.
cd mongodb-selinuxmake
3. Apply the policy.
sudo make install
However, even doing that does not fix the issue.
Even checking that the new policy is added for the new folder (/data/mongo)
/data/mongo(/.*)? all files system_u:object_r:mongod_var_lib_t:s0
/data/mongo.* all files system_u:object_r:mongod_var_lib_t:s0
/run/mongodb(/.*)? all files system_u:object_r:mongod_runtime_t:s0
/usr/bin/mongod regular file system_u:object_r:mongod_exec_t:s0
/var/lib/mongo(/.*)? all files system_u:object_r:mongod_var_lib_t:s0
/var/log/mongodb(/.*)? all files system_u:object_r:mongod_log_t:s0
We still get permissioned denied when starting up with systemctl.
It is irritating that its documented that it needs a fix, provides a fix, yet still does not work.
I can of course turn off SELINUX but not sure that is the best solution.
Thanks for the help
1 Like