title: Can't open PID file /var/run/mongodb/mongod.pid (yet?) after start: Too many levels of symbolic links MongoDB Centos 7
body: <p>I've installed mongodb on centos 7, but I can't start the service with systemctl.
  Running <code>mongod</code> starts successfully.</p>
  
  <p>I've followed all the instructions from here: <a href="https://mongoing.com/docs/tutorial/install-mongodb-on-red-hat.html" rel="nofollow noreferrer">https://mongoing.com/docs/tutorial/install-mongodb-on-red-hat.html</a></p>
  
  <p>systemctl status mongod returns this:</p>
  
  <pre><code>* mongod.service - MongoDB Database Server
     Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
    Drop-In: /etc/systemd/system/mongod.service.d
             `-override.conf
     Active: failed (Result: timeout) since Sun 2020-05-03 14:58:02 CEST; 4min 27s ago
       Docs: https://docs.mongodb.org/manual
    Process: 528 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=0/SUCCESS)
    Process: 525 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
    Process: 522 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
    Process: 519 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)
  
  May 03 14:56:32 zakazise systemd[1]: Starting MongoDB Database Server...
  May 03 14:56:32 zakazise mongod[528]: about to fork child process, waiting until server is ready for connections.
  May 03 14:56:32 zakazise mongod[528]: forked process: 530
  May 03 14:56:34 zakazise systemd[1]: Can't open PID file /var/run/mongodb/mongod.pid (yet?) after start: Too many levels of symbolic links
  May 03 14:58:02 zakazise systemd[1]: mongod.service start operation timed out. Terminating.
  May 03 14:58:02 zakazise systemd[1]: Failed to start MongoDB Database Server.
  May 03 14:58:02 zakazise systemd[1]: Unit mongod.service entered failed state.
  May 03 14:58:02 zakazise systemd[1]: mongod.service failed.
  </code></pre>
  
  <p>There is a line in /var/log/mongodb/mongod.log , that I think might be important:</p>
  
  <pre><code>2020-05-03T14:58:02.210+0200 I  CONTROL  [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends
  </code></pre>
  
  <p>/etc/mongod.conf:</p>
  
  <pre><code># mongod.conf
  
  # for documentation of all options, see:
  #   http://docs.mongodb.org/manual/reference/configuration-options/
  
  # where to write logging data.
  systemLog:
    destination: file
    logAppend: true
    path: /var/log/mongodb/mongod.log
  
  # Where and how to store data.
  storage:
    dbPath: /var/lib/mongo
    journal:
      enabled: true
  #  engine:
  #  wiredTiger:
  
  # how the process runs
  processManagement:
    fork: true  # fork and run in background
    pidFilePath: /var/run/mongodb/mongod.pid  # location of pidfile
    timeZoneInfo: /usr/share/zoneinfo
  
  # network interfaces
  net:
    port: 27017
    bindIp: 127.0.0.1  # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.
  
  
  #security:
  
  #operationProfiling:
  
  #replication:
  
  #sharding:
  
  ## Enterprise-Only Options
  
  #auditLog:
  
  #snmp:
  </code></pre>
  
  <p>/etc/systemd/system/multi-user.target.wants/mongod.service:</p>
  
  <pre><code>[Unit]
  Description=MongoDB Database Server
  Documentation=https://docs.mongodb.org/manual
  After=network.target
  
  [Service]
  User=mongod
  Group=mongod
  Environment="OPTIONS=-f /etc/mongod.conf"
  EnvironmentFile=-/etc/sysconfig/mongod
  ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb
  ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb
  ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb
  ExecStart=/usr/bin/mongod $OPTIONS
  PermissionsStartOnly=true
  PIDFile=/var/run/mongodb/mongod.pid
  Type=forking
  # file size
  LimitFSIZE=infinity
  # cpu time
  LimitCPU=infinity
  # virtual memory size
  LimitAS=infinity
  # open files
  LimitNOFILE=64000
  # processes/threads
  LimitNPROC=64000
  # locked memory
  LimitMEMLOCK=infinity
  # total threads (user+kernel)
  TasksMax=infinity
  TasksAccounting=false
  # Recommended limits for for mongod as specified in
  # http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings
  
  [Install]
  WantedBy=multi-user.target
  </code></pre>
  
  <p><strong>I didn't change anything in mongod.conf and mongod.service. This is a fully fresh install.</strong></p>
  
  <p><strong>Steps I've tried:</strong></p>
  
  <pre><code> touch /var/run/mongodb/mongod.pid 
   chown mongod:mongod/var/run/mongodb/mongod.pid
  </code></pre>
  
  <ul>
  <li>I've checked every path with mongo in it, and they have the right
  privileges. (mongod:mongod)</li>
  <li>Checked that SELinux is disabled. </li>
  <li>Allowed 27017 in ufw.</li>
  </ul>
  
  <p><strong>EDIT</strong></p>
  
  <p>/var/run/mongodb has every rwx.</p>
  
  <p>I'm logged in as root</p>