[SERVER-14679] (CentOS 7/RHEL 7) init.d script should create directory for pid file if it is missing Created: 25/Jul/14  Updated: 29/Dec/15  Resolved: 31/Jul/14

Status: Closed
Project: Core Server
Component/s: Packaging
Affects Version/s: 2.6.3, 2.7.0, 2.7.1, 2.7.2, 2.7.3
Fix Version/s: 2.6.5, 2.7.5

Type: Bug Priority: Minor - P4
Reporter: Markus Mahlberg Assignee: Benety Goh
Resolution: Done Votes: 0
Labels: pull-request
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

CentOS 7, RHEL 7


Issue Links:
Depends
is depended on by SERVER-7285 Support systemd in future compatible ... Closed
Duplicate
is duplicated by SERVER-15724 Cannot write pid file to /var/run/mon... Closed
is duplicated by SERVER-17462 Server start error in SUSE Enterprise 12 Closed
is duplicated by SERVER-22023 CLONE - Server start error in SUSE En... Closed
Related
related to SERVER-16721 Allow init script PIDFILEPATH to be c... Closed
is related to SERVER-7708 RPMs should automatically create /var... Closed
Backwards Compatibility: Fully Compatible
Operating System: Linux
Backport Completed:
Steps To Reproduce:
  1. Problems when starting MongoDB after installation
    1. Install CentOS 7 Core
    2. Install MongoDB as descibed in Install MongoDB on Red Hat Enterprise, CentOS, Fedora, or Amazon Linux
    3. Try to start mongod using service mongod start
    4. Check the log file
  2. Starting after manually creating /var/run/mongod
    1. Create /var/run/mongod manually by issuing

      install -d -m 0755 -o mongod -g mongod /var/run/mongod

    2. Start mongod via service mongod start
    3. Check that it is running via service mongod status
    4. Reboot
    5. Check the log file
Participants:

 Description   

The initscript of the RPM packages does not check wether the directory the pidfile is written to exists.

This makes it impossible to start mongod via the initscript on CentOS 7 at last, and presumably on RHEL 7, too, as the directory /var/run/mongod does not exist on system startup. The contents of /var/run seem to be deleted over a reboot, so creating the directory manually or via RPM does not help.

The file mongo/rpm/init.d-mongod needs to be updated accordingly.

I have already done that, a pull request will follow.



 Comments   
Comment by Tamas Føldesi [ 24/Sep/14 ]

Had the same issue on Oracle Linux Server release 6.3 using mongoDb 2.6.3 - the commit fixed it.

Comment by Githook User [ 17/Sep/14 ]

Author:

{u'username': u'mwmahlberg', u'name': u'Markus W. Mahlberg', u'email': u'markus.mahlberg@me.com'}

Message: SERVER-14679 fixed init.d script to create directory for pid file

Startup scripts not fit for CentOS 7 / RHEL 7

Default location for pid file is under /var/run/mongodb. /var/run can be mounted
on a temporary filesystem so the pid file directory is
not guaranteed to persist across reboots.

Closes #723

Signed-off-by: Benety Goh <benety@mongodb.com>
(cherry picked from commit 50ca596ace0b1390482408f1b19ffb1f9170cab6)

Conflicts:
rpm/init.d-mongod
Branch: v2.6
https://github.com/mongodb/mongo/commit/ddce701ed775996f2a49fc949e26c5bcbc38fe84

Comment by Githook User [ 31/Jul/14 ]

Author:

{u'username': u'mwmahlberg', u'name': u'Markus W. Mahlberg', u'email': u'markus.mahlberg@me.com'}

Message: SERVER-14679 fixed init.d script to create directory for pid file

Startup scripts not fit for CentOS 7 / RHEL 7

Default location for pid file is under /var/run/mongodb. /var/run can be mounted
on a temporary filesystem so the pid file directory is
not guaranteed to persist across reboots.

Closes #723

Signed-off-by: Benety Goh <benety@mongodb.com>
Branch: master
https://github.com/mongodb/mongo/commit/50ca596ace0b1390482408f1b19ffb1f9170cab6

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