[SERVER-16219] Fedora: cannot start service after installing community edition Created: 18/Nov/14  Updated: 05/Dec/22  Resolved: 08/Nov/22

Status: Closed
Project: Core Server
Component/s: Packaging
Affects Version/s: 2.6.5, 2.8.0-rc0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Jalpa Trivedi (Inactive) Assignee: [DO NOT ASSIGN] Backlog - Server Development Platform Team (SDP) (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
is related to SERVER-7285 Support systemd in future compatible ... Closed
Assigned Teams:
Server Development Platform
Operating System: ALL
Steps To Reproduce:

sudo service mongod start
Starting mongod (via systemctl):  Job for mongod.service failed. See 'systemctl status mongod.service' and 'journalctl -xn' for details.
                                                           [FAILED]
[fedora@ip-172-31-1-127 ~]$ 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 Tue 2014-11-18 14:14:42 UTC; 18s ago
  Process: 8354 ExecStart=/etc/rc.d/init.d/mongod start (code=exited, status=1/FAILURE)
 
[fedora@ip-172-31-1-127 ~]$ sudo journalctl -xn
-- Logs begin at Mon 2014-11-17 21:01:06 UTC, end at Tue 2014-11-18 14:15:27 UTC. --
Nov 18 14:14:33 ip-172-31-1-127 sudo[8335]: fedora : TTY=pts/1 ; PWD=/home/fedora ; USER=root ; COMMAND=/bin/tail -f /var/log/mongodb/mongod.lo
Nov 18 14:14:41 ip-172-31-1-127 sudo[8337]: fedora : TTY=pts/0 ; PWD=/home/fedora ; USER=root ; COMMAND=/sbin/service mongod start
Nov 18 14:14:41 ip-172-31-1-127 systemd[1]: Starting SYSV: Mongo is a scalable, document-oriented database....
-- Subject: Unit mongod.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mongod.service has begun starting up.
Nov 18 14:14:41 ip-172-31-1-127 runuser[8359]: pam_unix(runuser:session): session opened for user mongod by (uid=0)
Nov 18 14:14:42 ip-172-31-1-127 runuser[8359]: pam_unix(runuser:session): session closed for user mongod
Nov 18 14:14:42 ip-172-31-1-127 mongod[8354]: Starting mongod: [FAILED]
Nov 18 14:14:42 ip-172-31-1-127 systemd[1]: mongod.service: control process exited, code=exited status=1
Nov 18 14:14:42 ip-172-31-1-127 systemd[1]: Failed to start SYSV: Mongo is a scalable, document-oriented database..
-- Subject: Unit mongod.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/be02cf6855d2428ba40df7e9d022f03d
-- 
-- Unit mongod.service has failed.
-- 
-- The result is failed.
Nov 18 14:14:42 ip-172-31-1-127 systemd[1]: Unit mongod.service entered failed state.
Nov 18 14:15:27 ip-172-31-1-127 sudo[8370]: fedora : TTY=pts/0 ; PWD=/home/fedora ; USER=root ; COMMAND=/bin/journalctl -xn

  • ownership on the data directories:

[fedora@ip-172-31-1-127 ~]$ ls -ld /var/log/mon*
drwxr-xr-x. 2 mongod mongod 4096 Nov 18 14:13 /var/log/mongodb
[fedora@ip-172-31-1-127 ~]$ ls -ld /var/log/mongodb/*
-rw-r-----. 1 mongod mongod 2067 Nov 18 14:14 /var/log/mongodb/mongod.log
[fedora@ip-172-31-1-127 ~]$ ls -ld /var/lib/mongo/
drwxr-xr-x. 2 mongod mongod 4096 Oct  8 17:29 /var/lib/mongo/

  • in /var/log/mongodb/mongod.log file there is an error:

2014-11-18T15:18:32.926+0000 I CONTROL  [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1" }, processManagement: { fork: true, pidFilePath: "/var/run/mongodb/mongod.pid" }, storage: { dbPath: "/var/lib/mongo" }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2014-11-18T15:18:32.927+0000 I STORAGE  [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: /var/lib/mongo/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
2014-11-18T15:18:32.928+0000 I COMMANDS [initandlisten] dbexit:  rc: 100
 

  • mongod is not running:

[fedora@ip-172-31-0-232 run]$ ps aux | grep mongod
fedora     708  0.0  0.1 112636   964 pts/1    S+   15:19   0:00 grep --color=auto mongod

  • /var/run/mongodb permissions:

[fedora@ip-172-31-0-232 run]$ ls -ld /var/run/mongodb/
drwxr-xr-x. 2 mongod mongod 60 Nov 18 15:18 /var/run/mongodb/

Participants:

 Description   

After installing community packages on Fedora (tried Fedora 8, and Fedora 19), mongod service failed to start.



 Comments   
Comment by Jalpa Trivedi (Inactive) [ 18/Nov/14 ]

Hi ernie.hershey@10gen.com,

I followed the selinux portion of the instructions. I tried on Fedora 19.
Here is what worked for me:

  • semanage port -a -t mongod_port_t -p tcp 27017 needed to have sudo.
  • selinux.conf file did not exist for me, instead I had: /etc/selinux/config file with the content:

 
 
# 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 these two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
 

I had to change SELINUX=enforcing to SELINUX=permissive (did not need to disable SELINUX)

  • and reboot the system, which worked for me.

Question: Maybe we should change the instructions to reflect this ?

Comment by Ernie Hershey [ 18/Nov/14 ]

jalpa.trivedi - did you follow the selinux portion of the instructions? Can you post the contents of your /etc/selinux.conf?

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