Not able to start mongod - mongod.service: Main process exited, code=exited, status=1/FAILURE

Facing this error while trying to start:
mongodb@cfg1:/$ sudo systemctl status mongod.service
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2022-04-14 14:35:13 IST; 6min ago
Docs: https://docs.mongodb.org/manual
Main PID: 8656 (code=exited, status=1/FAILURE)

Apr 14 14:35:13 systemd[1]: Started MongoDB Database Server.
Apr 14 14:35:13 systemd[1]: mongod.service: Main process exited, code=exited, status=1/FAILURE
Apr 14 14:35:13 systemd[1]: mongod.service: Failed with result ‘exit-code’.

I have checked permissions/ownership for dbpath , logpath & keyFile .
mongod.log doesn’t print anything. Also .sock file doesn’t print anything.

Share your systemd service file.

Share your configuration file.

Share the output of the following commands:

ps -aef | grep [m]ongod
ss -tlnp

mongodb@ACIPRO:/$ ps -aef | grep [m]ongod
root 1237 3043 0 05:17 ? 00:00:00 sshd: mongodb [priv]
mongodb 1429 1237 0 05:17 ? 00:00:01 sshd: mongodb@pts/1
mongodb 1454 1429 0 05:17 pts/1 00:00:00 -bash
root 5410 1 99 Apr25 ? 1-05:32:10 mongod -f /apps/mongodb/config/mongod.conf --fork
root 5977 19077 6 Apr25 ? 01:20:37 /usr/local/percona/pmm2/exporters/mongodb_exporter --collector.collstats-limit=200 --collector.diagnosticdata --collector.replicasetstatus --compatible-mode --discovering-mode --mongodb.global-conn-pool --web.listen-address=:42002
root 7892 3043 0 07:12 ? 00:00:00 sshd: mongodb [priv]
mongodb 8039 7892 0 07:12 ? 00:00:00 sshd: mongodb@pts/2
mongodb 8093 8039 0 07:12 pts/2 00:00:00 -bash
root 10879 3043 0 07:14 ? 00:00:00 sshd: mongodb [priv]
mongodb 11036 10879 0 07:14 ? 00:00:00 sshd: mongodb@notty
mongodb 11037 11036 0 07:14 ? 00:00:00 /usr/lib/openssh/sftp-server
root 11209 3043 0 07:15 ? 00:00:00 sshd: mongodb [priv]
mongodb 11348 11209 0 07:15 ? 00:00:04 sshd: mongodb@notty
mongodb 11349 11348 0 07:15 ? 00:00:01 /usr/lib/openssh/sftp-server
mongodb 13188 8093 0 11:24 pts/2 00:00:00 ps -aef
mongodb 13189 8093 0 11:24 pts/2 00:00:00 grep --color=auto [m]ongod
mongodb 52940 1 0 Apr25 ? 00:01:38 /lib/systemd/systemd --user
mongodb 52941 52940 0 Apr25 ? 00:00:00 (sd-pam)
mongodb@ACIPRO:/$ ss -tlnp
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 127.0.0.1:27017 0.0.0.0:*
LISTEN 0 128 10.98.20.5:27017 0.0.0.0:*
LISTEN 0 10 127.0.0.1:29130 0.0.0.0:*
LISTEN 0 128 0.0.0.0:25324 0.0.0.0:*
LISTEN 0 4096 0.0.0.0:80 0.0.0.0:*
LISTEN 0 4096 127.0.0.1:42001 0.0.0.0:*
LISTEN 0 4096 127.0.0.1:45013 0.0.0.0:*
LISTEN 0 128 127.0.0.53%lo:53 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 0.0.0.0:8089 0.0.0.0:*
LISTEN 0 100 0.0.0.0:25 0.0.0.0:*
LISTEN 0 4096 0.0.0.0:443 0.0.0.0:*
LISTEN 0 1024 10.98.20.5:17472 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:17473 0.0.0.0:*
LISTEN 0 4096 127.0.0.1:7777 0.0.0.0:*
LISTEN 0 10 127.0.0.1:28130 0.0.0.0:*
LISTEN 0 10 127.0.0.1:28230 0.0.0.0:*
LISTEN 0 4096 :42000 :
LISTEN 0 4096 [::]:80 [::]:

LISTEN 0 4096 :42002 :
LISTEN 0 128 :8084 :
LISTEN 0 128 [::]:22 [::]:

LISTEN 0 100 [::]:25 [::]:

LISTEN 0 4096 [::]:443 [::]:*
mongodb@ACIPRO:/$

  1. you should not be logged in and working as mongodb user
  2. you already have mongod running so you cannot start another
  3. you should not run mongod as root user
  4. you should not try to run mongod both manually and with systemd
1 Like

Hi can you help me out

ubuntu@esopdev:/etc$ ps -aef | grep [m]ongod
root 804843 1 0 07:12 ? 00:00:16 mongod --fork --logpath /var/lib/mongodb/mongodb.log --dbpath /var/lib/mongodb
root 805223 805199 0 07:14 pts/2 00:00:00 tail -100f /var/log/mongodb/mongod.log

$ ss -tlnp
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 4096 0.0.0.0:9191 0.0.0.0:*
LISTEN 0 128 127.0.0.1:27017 0.0.0.0:*
LISTEN 0 4096 0.0.0.0:8080 0.0.0.0:*
LISTEN 0 511 0.0.0.0:80 0.0.0.0:*
LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:*
LISTEN 0 4096 127.0.0.1:43637 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 4096 0.0.0.0:6080 0.0.0.0:*
LISTEN 0 4096 0.0.0.0:6081 0.0.0.0:*
LISTEN 0 4096 0.0.0.0:6082 0.0.0.0:*
LISTEN 0 4096 [::]:9191 [::]:*
LISTEN 0 4096 [::]:8080 [::]:*
LISTEN 0 511 [::]:80 [::]:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 4096 [::]:6080 [::]:*
LISTEN 0 4096 [::]:6081 [::]:*
LISTEN 0 4096 [::]:6082 [::]:*
LISTEN 0 100 *:9090 :