[root@ip-192-168-41-156 ~]# service mongod startStarting mongod (via systemctl): Job for mongod.service failed because the control process exited with error code. See "systemctl status mongod.service" and "journalctl -xe" for details. [FAILED]
[root@ip-192-168-41-156 ~]# systemctl status mongod.service● mongod.service - SYSV: Mongo is a scalable, document-oriented database. Loaded: loaded (/etc/rc.d/init.d/mongod) Active: failed (Result: exit-code) since Fri 2016-04-15 10:45:46 UTC; 43s ago Docs: man:systemd-sysv-generator(8) Process: 24605 ExecStart=/etc/rc.d/init.d/mongod start (code=exited, status=1/FAILURE) Main PID: 13547 (code=exited, status=0/SUCCESS)
Apr 15 10:45:46 ip-192-168-41-156 systemd[1]: Starting SYSV: Mongo is a scalable, document-oriented database....Apr 15 10:45:46 ip-192-168-41-156 runuser[24612]: pam_unix(runuser:session): session opened for user mongod by (uid=0)Apr 15 10:45:46 ip-192-168-41-156 runuser[24612]: pam_unix(runuser:session): session closed for user mongodApr 15 10:45:46 ip-192-168-41-156 mongod[24605]: Starting mongod: [FAILED]Apr 15 10:45:46 ip-192-168-41-156 systemd[1]: mongod.service: control process exited, code=exited status=1Apr 15 10:45:46 ip-192-168-41-156 systemd[1]: Failed to start SYSV: Mongo is a scalable, document-oriented database..Apr 15 10:45:46 ip-192-168-41-156 systemd[1]: Unit mongod.service entered failed state.Apr 15 10:45:46 ip-192-168-41-156 systemd[1]: mongod.service failed.
[root@ip-192-168-41-156 ~]# journalctl -xeApr 15 10:45:14 ip-192-168-41-156 yum[24479]: Installed: mongodb-org-3.2.5-1.el7.x86_64Apr 15 10:45:46 ip-192-168-41-156 polkitd[13528]: Registered Authentication Agent for unix-process:24600:1421059 (system bus name :1.95 [/usr/bin/pkttyagent --nApr 15 10:45:46 ip-192-168-41-156 systemd[1]: Starting SYSV: Mongo is a scalable, document-oriented database....-- Subject: Unit mongod.service has begun start-up-- Defined-By: systemd---- Unit mongod.service has begun starting up.Apr 15 10:45:46 ip-192-168-41-156 runuser[24612]: pam_unix(runuser:session): session opened for user mongod by (uid=0)Apr 15 10:45:46 ip-192-168-41-156 runuser[24612]: pam_unix(runuser:session): session closed for user mongodApr 15 10:45:46 ip-192-168-41-156 mongod[24605]: Starting mongod: [FAILED]Apr 15 10:45:46 ip-192-168-41-156 systemd[1]: mongod.service: control process exited, code=exited status=1Apr 15 10:45:46 ip-192-168-41-156 systemd[1]: Failed to start SYSV: Mongo is a scalable, document-oriented database..-- Subject: Unit mongod.service has failed-- Defined-By: systemd---- Unit mongod.service has failed.---- The result is failed.Apr 15 10:45:46 ip-192-168-41-156 systemd[1]: Unit mongod.service entered failed state.Apr 15 10:45:46 ip-192-168-41-156 systemd[1]: mongod.service failed.Apr 15 10:45:46 ip-192-168-41-156 polkitd[13528]: Unregistered Authentication Agent for unix-process:24600:1421059 (system bus name :1.95, object path /org/free
Hi Mikko,
I tested this with two CentOS instances:
7.2.1511
(Core) and CentOS Linux release 7.1.1503
(Core) Using MongoDB v3.2.5:
> mongod --version
db version v3.2.5
git version: 34e65e5383f7ea1726332cb175b73077ec4a1b02
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
allocator: tcmalloc
modules: none
build environment:
distmod: rhel70
distarch: x86_64
target_arch: x86_64
Both tests ran as expected using sudo service mongod start
.
In my test I used the values of SELINUX=enforcing
and SELINUX=targeted
to try to replicate your environment. However for a guide of SELinux setup please refer to the manual Configure SELinux with MongoDB.
Did you change any configurations between the two versions ? i.e. storage engine, data path, etc
If you change the data path of your mongod
, the default SELinux policies will prevent mongod
from having write access on the new data path if you don’t change the security context. See also data directories and permissions.
If you are still having difficulties with MongoDB v3.2.5 on CentOS 7, could you:
mongod
output log in /var/log/mongodb/mongod.log
mongod
directly without going through service
. If the process failed, please post the output log of mongod
mongod --version
/etc/redhat-release
Kind regards,
Wan.
- Check the few last lines of
mongod
output log in/var/log/mongodb/mongod.log
sudo service mongod start
Starting mongod (via systemctl): Job for mongod.service failed because the control process exited with error code. See "systemctl status mongod.service" and "journalctl -xe" for details.
[FAILED]
tail -f /var/log/mongodb/mongod.log
- Try running
mongod
directly without going throughservice
. If the process failed, please post the output log ofmongod
sudo mongod --config /etc/mongod.confabout to fork child process, waiting until server is ready for connections.forked process: 19162child process started successfully, parent exiting
2016-04-07T05:52:04.468-0400 I CONTROL [main] ***** SERVER RESTARTED *****2016-04-07T05:52:04.474-0400 I CONTROL [initandlisten] MongoDB starting : pid=19162 port=27017 dbpath=/var/lib/mongo 64-bit host=localhost.localdomain2016-04-07T05:52:04.474-0400 I CONTROL [initandlisten] db version v3.2.52016-04-07T05:52:04.474-0400 I CONTROL [initandlisten] git version: 34e65e5383f7ea1726332cb175b73077ec4a1b022016-04-07T05:52:04.474-0400 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 20132016-04-07T05:52:04.474-0400 I CONTROL [initandlisten] allocator: tcmalloc2016-04-07T05:52:04.474-0400 I CONTROL [initandlisten] modules: none2016-04-07T05:52:04.474-0400 I CONTROL [initandlisten] build environment:2016-04-07T05:52:04.474-0400 I CONTROL [initandlisten] distmod: rhel702016-04-07T05:52:04.474-0400 I CONTROL [initandlisten] distarch: x86_642016-04-07T05:52:04.474-0400 I CONTROL [initandlisten] target_arch: x86_642016-04-07T05:52:04.474-0400 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, processManagement: { fork: true, pidFilePath: "/var/run/mongodb/mongod.pid" }, storage: { dbPath: "/var/lib/mongo", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }2016-04-07T05:52:04.493-0400 I - [initandlisten] Detected data files in /var/lib/mongo created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.2016-04-07T05:52:04.493-0400 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),2016-04-07T05:52:04.668-0400 I CONTROL [initandlisten]2016-04-07T05:52:04.668-0400 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.2016-04-07T05:52:04.668-0400 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.2016-04-07T05:52:04.668-0400 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.2016-04-07T05:52:04.668-0400 I CONTROL [initandlisten]2016-04-07T05:52:04.672-0400 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/var/lib/mongo/diagnostic.data'2016-04-07T05:52:04.672-0400 I NETWORK [initandlisten] waiting for connections on port 270172016-04-07T05:52:04.672-0400 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
- Post the output of
mongod --version
mongod --version
db version v3.2.5git version: 34e65e5383f7ea1726332cb175b73077ec4a1b02OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013allocator: tcmallocmodules: nonebuild environment: distmod: rhel70 distarch: x86_64 target_arch: x86_64
- Post the content of
/etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
Hi Adrian,
I’ve managed to reproduced the problem with CentOS 7 Minimal, and have opened SERVER-23863 ticket on MongoDB JIRA issue tracker.
Please feel free to watch or upvote for updates.
Regards,
Wan.
tail -f /var/log/audit/audit.log
service mongod start
grep mongod /var/log/audit/audit.log | audit2allow -m mongod > mongod.te
module mongod 1.0;
require { type locale_t; type mongod_t; type ld_so_cache_t; class file execute;}
#============= mongod_t ==============allow mongod_t ld_so_cache_t:file execute;allow mongod_t locale_t:file execute;
grep mongod /var/log/audit/audit.log | audit2allow -M mongod
semodule -i mongod.pp
sudo service mongod startStarting mongod (via systemctl): [ OK ]
chcon -Rv --type=mongod_var_lib_t $dbpath
chcon -Rv --type=mongod_log_t $logpath
setmanage permissive -a mongod_t
Have the same issue. Have tried some recipes mentione here, like the ones form Mikko with semodule and boncalo but the error persist
Hi leckozol,
The problem described in this thread is related to setting SELINUX=enforcing
on MongoDB v3.2.5 and v3.2.6.
If you have tried setting SELINUX
to ‘permissive’ and is still having an issue to start mongod
, it may be a different problem causing the issue you are seeing.
Please start a new thread discussion with relevant details of:
/etc/selinux/config
Hopefully will be fixed in 3.2.7
There is a patch committed into git master for the issue described in this thread, and will be targeted for release for v3.2.7. Please see JIRA ticket SERVER-24117 for more information.
Kind regards,
Wan.
I still facing with this error in centos 7 minimal install and mongodb 3.2.8
Hi Balazs,
I ran a test to install and start MongoDB 3.2.8 on CentOS Minimal 7.2 without any issues. As mentioned in ticket SERVER-24117, the issue has been resolved since MongoDB v3.2.7.
For installation steps see MongoDB install on RHEL.
If you are still having issues installing and/or starting MongoDB 3.2.8 in CentOS 7 Minimal, please open a new thread discussion with the following relevant information:
/etc/selinux/config
/etc/yum.repos.d/mongodb-org-3.2.repo
Regards,
Wan.
# This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:# enforcing - SELinux security policy is enforced.# permissive - SELinux prints warnings instead of enforcing.# disabled - No SELinux policy is loaded.SELINUX=enforcing# SELINUXTYPE= can take one of three values:# targeted - Targeted processes are protected,# minimum - Modification of targeted policy. Only selected processes are protected.# mls - Multi Level Security protection.SELINUXTYPE=targeted
# This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:# enforcing - SELinux security policy is enforced.# permissive - SELinux prints warnings instead of enforcing.# disabled - No SELinux policy is loaded.SELINUX=permissive# SELINUXTYPE= can take one of three values:# targeted - Targeted processes are protected,# minimum - Modification of targeted policy. Only selected processes are protected.# mls - Multi Level Security protection.SELINUXTYPE=targeted