Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-20075

Debian init script not setting correct permissions on PIDFILEPATH

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.0.2
    • Component/s: Packaging
    • None
    • Environment:
    • Linux
    • Hide

      1. Create a configuration file.

      1. /etc/mongod.conf
        processManagement.fork: false
        processManagement.pidFilePath: /var/run/mongod.pid
        systemLog.destination: file
        systemLog.path: /var/log/mongodb/mongod.log
        systemLog.logAppend: true
        storage.mmapv1.smallFiles: false
        storage.journal.enabled: true
        storage.dbPath: /var/lib/mongodb/
        net.bindIp: 127.0.0.1

      2. Start mongod as a service.
      > sudo service mongod start
      [FAIL] Starting database: mongod failed!

      3. Check the server log.
      > tail -f /var/log/mongodb/mongod.log
      2015-08-21T10:20:20.096-0400 I CONTROL ERROR: Cannot write pid file to /var/run/mongod.pid: Permission denied

      4. Check the PID permissions.
      > ls -l /run/mongod.pid
      rw-rr- 1 root root 5 Aug 21 10:20 /run/mongod.pid

      Show
      1. Create a configuration file. /etc/mongod.conf processManagement.fork: false processManagement.pidFilePath: /var/run/mongod.pid systemLog.destination: file systemLog.path: /var/log/mongodb/mongod.log systemLog.logAppend: true storage.mmapv1.smallFiles: false storage.journal.enabled: true storage.dbPath: /var/lib/mongodb/ net.bindIp: 127.0.0.1 2. Start mongod as a service. > sudo service mongod start [FAIL] Starting database: mongod failed! 3. Check the server log. > tail -f /var/log/mongodb/mongod.log 2015-08-21T10:20:20.096-0400 I CONTROL ERROR: Cannot write pid file to /var/run/mongod.pid: Permission denied 4. Check the PID permissions. > ls -l /run/mongod.pid rw-r r - 1 root root 5 Aug 21 10:20 /run/mongod.pid

      Debian init script does not ensure proper ownership/permissions on the PID file. The created PID file is not writable by the $DAEMONUSER (mongodb) causing the server to fail to start.

      Is it possible to ensure the PID location is writable before starting the service - like you do in the Ubuntu upstart script at lines 23-24: https://github.com/mongodb/mongo/blob/f7675b0a306764d8a435a623b4af0b5bd63180d4/debian/mongod.upstart

            Assignee:
            Unassigned Unassigned
            Reporter:
            petmal Petr Malik
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: