Mongo db does not start after Configure SELinux step was completed

I am installing mongodb 3.6 on RHEL 8.5, it worked fine, I am using custom directories for data and logs, after implementing the step on the guide (Install MongoDB Community Edition on Red Hat or CentOS — MongoDB Manual) for ‘Configure SELinux’ is does not want to start anymore.

sudo systemctl start mongod
Job for mongod.service failed because the control process exited with error code.
See “systemctl status mongod.service” and “journalctl -xe” for details.

systemctl status mongod.service
● mongod.service - MongoDB Database Server
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2022-06-08 19:50:49 UTC; 1min 2s ago
Docs: https://docs.mongodb.org/manual
Process: 32032 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=1/FAILURE)
Process: 32031 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 32029 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 32027 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)
Main PID: 22352 (code=exited, status=0/SUCCESS)

Would you know what the problem might be, or how can I rolled back the ‘Configure SELinux’ steps,

Thanks a lot
Ivan

That procedure is very complex. It’s quite possible you made a mistake. You might check your ~/.bash_history file and make sure you did it correctly. Or it could be some other cause.

In any case, probably the easiest “sanity check” is to set SELinux to non-enforcing mode and see if mongod starts up correctly. Then you know the problem is SELinux and not something else.

Jack thank you kindly, disabling SELinux allow it to start. I followed the steps exactly as stated, I might have misinterpreted something. I might need to re-enable SELinux at some point, would you recommend to re-execute the SELinux steps as described in the guide again?

I would compare them to what was recorded in your ~/.bash_history file and see if a mistake was made, before I’d try doing them again. SELinux is tricky, it’s easy to make a mistake. And how one corrects mistakes depends on the kind of mistake that was made.