[SERVER-9985] wrong user and group on dirs created by upstart script Created: 21/Jun/13  Updated: 04/Nov/14  Resolved: 05/Jun/14

Status: Closed
Project: Core Server
Component/s: Packaging, Tools
Affects Version/s: 2.2.5, 2.4.4, 2.5.0
Fix Version/s: 2.7.2

Type: Bug Priority: Trivial - P5
Reporter: Idan Kamara Assignee: Ernie Hershey
Resolution: Done Votes: 0
Labels: cap-ticket-needed, pull-request
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu


Issue Links:
Related
related to SERVER-15937 mongod service fails to start if log ... Closed
related to SERVER-15941 mongod service fails to start if log ... Closed
related to SERVER-15943 mongod service fails to start if log ... Closed
Tested
Backwards Compatibility: Fully Compatible
Operating System: Linux
Participants:

 Description   

The upstart script creates dirs if /var/

{lib,log}

/mongodb aren't there. These will be created by root which will cause mongodb to refuse to load since it runs with a different user.



 Comments   
Comment by Githook User [ 05/Jun/14 ]

Author:

{u'username': u'ehershey', u'name': u'Ernie Hershey', u'email': u'ernie.hershey@10gen.com'}

Message: SERVER-9985 Adjust pre-script mkdir commands in upstart config
Branch: master
https://github.com/mongodb/mongo/commit/e5da7115afeee64fa24b467ab5ed22767bb040b8

Comment by Githook User [ 05/Jun/14 ]

Author:

{u'username': u'idank', u'name': u'Idan Kamara', u'email': u'idankk86@gmail.com'}

Message: SERVER-9985: chown dirs created by upstart's pre-start stanza

Usually these are created by the the post-install script that runs after installing the package, but if those were rm'ed later on and then created by this script, their permission would be most likely set to root, causing mongod to fail starting.

Signed-off-by: Ernie Hershey <ernie.hershey@mongodb.com>
Branch: master
https://github.com/mongodb/mongo/commit/849a83f3649a7c3e7f31c0858804dbb354cad298

Comment by Ernie Hershey [ 04/Jun/14 ]

I was just able to reproduce this. I used the enterprise build because I had it handy but the symptoms/fix should be identical -

  1. sudo apt-get install mongodb-enterprise
  2. sudo service mongod stop
  3. sudo mv /var/log/mongodb /var/log/mongodb.bak
  4. sudo mv /var/lib/mongodb /var/lib/mongodb.bak
  5. sudo service mongod start
  6. ls -ld /var/*/mongo

    drwxr-xr-x 2 root    root    4096 Jun  4 22:01 /var/lib/mongodb
    drwxr-xr-x 2 root    root    4096 Jun  4 22:01 /var/log/mongodb

    And mongod is not running.

Comment by Idan Kamara [ 21/Jun/13 ]

Pull request: https://github.com/mongodb/mongo/pull/443

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