Code status = 48

Hi there,

My .conf file:

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, 162.144.146.93  # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.

security:
  authorization: "enabled"

The output for:

systemctl status mongod.service -l

● mongod.service - MongoDB Database Server
   Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2021-06-02 08:24:18 MDT; 15min ago
     Docs: https://docs.mongodb.org/manual
  Process: 13698 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=48)
  Process: 13695 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
  Process: 13692 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
  Process: 13690 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)
 Main PID: 8732 (code=exited, status=0/SUCCESS)

Jun 02 08:24:17 server.abelardolg.com systemd[1]: Starting MongoDB Database Server...
Jun 02 08:24:18 server.abelardolg.com mongod[13698]: about to fork child process, waiting until server is ready for connections.
Jun 02 08:24:18 server.abelardolg.com mongod[13698]: forked process: 13701
Jun 02 08:24:18 server.abelardolg.com mongod[13698]: ERROR: child process failed, exited with 48
Jun 02 08:24:18 server.abelardolg.com mongod[13698]: To see additional information in this output, start without the "--fork" option.
Jun 02 08:24:18 server.abelardolg.com systemd[1]: mongod.service: control process exited, code=exited status=48
Jun 02 08:24:18 server.abelardolg.com systemd[1]: Failed to start MongoDB Database Server.
Jun 02 08:24:18 server.abelardolg.com systemd[1]: Unit mongod.service entered failed state.
Jun 02 08:24:18 server.abelardolg.com systemd[1]: mongod.service failed.

The output for:

ps aux | grep “mongod”

root     14756  0.0  0.0 112816   980 pts/0    S+   08:45   0:00 grep --color=auto mongod

When I want to kill this process:

root@server.abelardolg.com [log]# kill -9 14756
-bash: kill: (14756) - No such process

:thinking::thinking::thinking::thinking::thinking:

Do you have at your doc a section to solve the code errors, please?

Thanks in advance.

Brs.

Hi @ABELARDO_GONZALEZ,

Can you please share the relevant part from the log file?

Cheers,
Maxime.

I am not sure if these lines are fairly enough:
Jun 02 08:26:25 server.abelardolg.com sshd[13796]: pam_unix(sshd:auth): check pass; user unknown
Jun 02 08:26:25 server.abelardolg.com sshd[13796]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=95-165-131-164.static.spd-mgts.ru
Jun 02 08:26:27 server.abelardolg.com sshd[13796]: Failed password for invalid user bowei from 95.165.131.164 port 58940 ssh2
Jun 02 08:26:28 server.abelardolg.com sshd[13796]: Received disconnect from 95.165.131.164 port 58940:11: Bye Bye [preauth]
Jun 02 08:26:28 server.abelardolg.com sshd[13796]: Disconnected from 95.165.131.164 port 58940 [preauth]

Tell me if you would like to see more lines, please.

Brs.

OFF-TOPIC: have you thought to add a feature to attach logs to this form?

The forum supports markdown.

So, yes, you can include code.

like this

image

The logs you sent are about a failed connection. So I guess the mongod was running at that time. Now you can’t start it, right?

Yes, I can’t start it.

So can you share the relevant logs then plz? The one when you try to start and get the error?

systemctl status mongod.service -l
● mongod.service - MongoDB Database Server
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2021-06-02 08:24:18 MDT; 2h 26min ago
Docs: https://docs.mongodb.org/manual
Process: 13698 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=48)
Process: 13695 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 13692 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 13690 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)
Main PID: 8732 (code=exited, status=0/SUCCESS)

Jun 02 08:24:17 systemd[1]: Starting MongoDB Database Server…
Jun 02 08:24:18 mongod[13698]: about to fork child process, waiting until server is ready for connections.
Jun 02 08:24:18 mongod[13698]: forked process: 13701
Jun 02 08:24:18 mongod[13698]: ERROR: child process failed, exited with 48
Jun 02 08:24:18 mongod[13698]: To see additional information in this output, start without the “–fork” option.
Jun 02 08:24:18 systemd[1]: mongod.service: control process exited, code=exited status=48
Jun 02 08:24:18 systemd[1]: Failed to start MongoDB Database Server.
Jun 02 08:24:18 systemd[1]: Unit mongod.service entered failed state.
Jun 02 08:24:18 systemd[1]: mongod.service failed.

These are the log of systemctl. Not mongod.

Also they recommend you try this:

Jun 02 08:24:18 mongod[13698]: To see additional information in this output, start without the “–fork” option.

I didn’t add that parameter.

What is the path of that log you need to see, please?
What is the command I should execute to generate that log?

mongod
{"t":{"$date":"2021-06-02T11:02:45.888-06:00"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2021-06-02T11:02:45.897-06:00"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2021-06-02T11:02:45.897-06:00"},"s":"I",  "c":"NETWORK",  "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
{"t":{"$date":"2021-06-02T11:02:45.901-06:00"},"s":"I",  "c":"STORAGE",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":21841,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":""}}
{"t":{"$date":"2021-06-02T11:02:45.901-06:00"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.6","gitVersion":"72e66213c2c3eab37d9358d5e78ad7f5c1d0d0d7","openSSLVersion":"OpenSSL 1.0.1e-fips 11 Feb 2013","modules":[],"allocator":"tcmalloc","environment":{"distmod":"rhel70","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2021-06-02T11:02:45.901-06:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"CentOS Linux release 7.9.2009 (Core)","version":"Kernel 3.10.0-1160.25.1.el7.x86_64"}}}
{"t":{"$date":"2021-06-02T11:02:45.901-06:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{}}}
{"t":{"$date":"2021-06-02T11:02:45.904-06:00"},"s":"E",  "c":"STORAGE",  "id":20557,   "ctx":"initandlisten","msg":"DBException in initAndListen, terminating","attr":{"error":"NonExistentPath: Data directory /data/db not found. Create the missing directory or specify another path using (1) the --dbpath command line option, or (2) by adding the 'storage.dbPath' option in the configuration file."}}
{"t":{"$date":"2021-06-02T11:02:45.904-06:00"},"s":"I",  "c":"REPL",     "id":4784900, "ctx":"initandlisten","msg":"Stepping down the ReplicationCoordinator for shutdown","attr":{"waitTimeMillis":10000}}
{"t":{"$date":"2021-06-02T11:02:45.905-06:00"},"s":"I",  "c":"COMMAND",  "id":4784901, "ctx":"initandlisten","msg":"Shutting down the MirrorMaestro"}
{"t":{"$date":"2021-06-02T11:02:45.905-06:00"},"s":"I",  "c":"SHARDING", "id":4784902, "ctx":"initandlisten","msg":"Shutting down the WaitForMajorityService"}
{"t":{"$date":"2021-06-02T11:02:45.905-06:00"},"s":"I",  "c":"NETWORK",  "id":20562,   "ctx":"initandlisten","msg":"Shutdown: going to close listening sockets"}
{"t":{"$date":"2021-06-02T11:02:45.905-06:00"},"s":"I",  "c":"NETWORK",  "id":4784905, "ctx":"initandlisten","msg":"Shutting down the global connection pool"}
{"t":{"$date":"2021-06-02T11:02:45.905-06:00"},"s":"I",  "c":"STORAGE",  "id":4784906, "ctx":"initandlisten","msg":"Shutting down the FlowControlTicketholder"}
{"t":{"$date":"2021-06-02T11:02:45.905-06:00"},"s":"I",  "c":"-",        "id":20520,   "ctx":"initandlisten","msg":"Stopping further Flow Control ticket acquisitions."}
{"t":{"$date":"2021-06-02T11:02:45.905-06:00"},"s":"I",  "c":"NETWORK",  "id":4784918, "ctx":"initandlisten","msg":"Shutting down the ReplicaSetMonitor"}
{"t":{"$date":"2021-06-02T11:02:45.905-06:00"},"s":"I",  "c":"SHARDING", "id":4784921, "ctx":"initandlisten","msg":"Shutting down the MigrationUtilExecutor"}
{"t":{"$date":"2021-06-02T11:02:45.905-06:00"},"s":"I",  "c":"CONTROL",  "id":4784925, "ctx":"initandlisten","msg":"Shutting down free monitoring"}
{"t":{"$date":"2021-06-02T11:02:45.905-06:00"},"s":"I",  "c":"STORAGE",  "id":4784927, "ctx":"initandlisten","msg":"Shutting down the HealthLog"}
{"t":{"$date":"2021-06-02T11:02:45.905-06:00"},"s":"I",  "c":"STORAGE",  "id":4784929, "ctx":"initandlisten","msg":"Acquiring the global lock for shutdown"}
{"t":{"$date":"2021-06-02T11:02:45.905-06:00"},"s":"I",  "c":"-",        "id":4784931, "ctx":"initandlisten","msg":"Dropping the scope cache for shutdown"}
{"t":{"$date":"2021-06-02T11:02:45.905-06:00"},"s":"I",  "c":"FTDC",     "id":4784926, "ctx":"initandlisten","msg":"Shutting down full-time data capture"}
{"t":{"$date":"2021-06-02T11:02:45.905-06:00"},"s":"I",  "c":"CONTROL",  "id":20565,   "ctx":"initandlisten","msg":"Now exiting"}
{"t":{"$date":"2021-06-02T11:02:45.905-06:00"},"s":"I",  "c":"CONTROL",  "id":23138,   "ctx":"initandlisten","msg":"Shutting down","attr":{"exitCode":100}}

Config file format: https://docs.mongodb.com/manual/reference/configuration-options/#file-format

Storage options: https://docs.mongodb.com/manual/reference/configuration-options/#storage-options

storage:
dbPath: /var/lib/mongo

This path exists:
root@ [mongo]# pwd
/var/lib/mongo

You are then either not using the config file you think you are using or the file is not formatted correctly because mongod is looking for the default /data/db and not /var/lib/mongo.

There is definitely a problem around that config file or the one used by systemctl.

That output:
{“t”:{"$date":“2021-06-02T11:02:45.904-06:00”},“s”:“E”, “c”:“STORAGE”, “id”:20557, “ctx”:“initandlisten”,“msg”:“DBException in initAndListen, terminating”,“attr”:{“error”:“NonExistentPath: Data directory /data/db not found. Create the missing directory or specify another path using (1) the --dbpath command line option, or (2) by adding the ‘storage.dbPath’ option in the configuration file.”}}

is coming from Mongo after executing “mongod” command, not from systemctl.

I am going to google where the conf file is indicated to Mongo.

My mongod.conf is located is under /etc directory.

What’s wrong? :thinking:

From /var/log/mongodb/mongod.log:
{“t”:{"$date":“2021-06-02T12:26:49.775-06:00”},“s”:“I”, “c”:“CONTROL”, “id”:23138, “ctx”:“initandlisten”,“msg”:“Shutting down”,“attr”:{“exitCode”:48}}

Do you have a section where error cods are showed along with their solutions, please?

The command that systemctl is running is not just mongod. It’s most probably more something like mongod -f /etc/mongod.conf.

If you run mongod without any parameter, it’s a different problem because you aren’t using the config anymore but all the default parameters.

Is there a way to know what ¡s the command executed by systemctl?

Where could I edit the path to mongod.conf?

If you want to understand, you definitively want to take a look at

Otherwise
`

Unit files are stored in the /usr/lib/systemd directory and its subdirectories, while the /etc/systemd/ directory and its subdirectories contain symbolic links to the unit files necessary to the local configuration of this host.

`

1 Like