Error Environment variable MONGODB_CONFIG_OVERRIDE_NOFORK == 1

Hi, Installed mongodb few weeks ago and was working fine, but today I found an error in the server(centos7)

this is the error:
Environment variable MONGODB_CONFIG_OVERRIDE_NOFORK == 1, overriding "processManagement.fork" to false

I dont know what to do

log file

{"t":{"$date":"2023-05-30T23:16:54.136+00:00"},"s":"I",  "c":"CONTROL",  "id":20698,   "ctx":"-","msg":"***** SERVER RESTARTED *****"}
{"t":{"$date":"2023-05-30T23:16:54.138+00: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":"2023-05-30T23:16:54.140+00:00"},"s":"I",  "c":"NETWORK",  "id":4915701, "ctx":"main","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":17},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":17},"outgoing":{"minWireVersion":6,"maxWireVersion":17},"isInternalClient":true}}}
{"t":{"$date":"2023-05-30T23:16:54.140+00: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":"2023-05-30T23:16:54.407+00:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","namespace":"config.tenantMigrationDonors"}}
{"t":{"$date":"2023-05-30T23:16:54.407+00:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","namespace":"config.tenantMigrationRecipients"}}
{"t":{"$date":"2023-05-30T23:16:54.407+00:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"ShardSplitDonorService","namespace":"config.tenantSplitDonors"}}
{"t":{"$date":"2023-05-30T23:16:54.407+00:00"},"s":"I",  "c":"CONTROL",  "id":23330,   "ctx":"main","msg":"ERROR: Cannot write pid file to {path_string}: {errAndStr_second}","attr":{"path_string":"/var/run/mongodb/mongod.pid","errAndStr_second":"No such file or directory"}}

I couldnt find /var/run/mongodb/mongod.pid, but it was working fine, any idea?

Hey :wave: @Jose_Salazar_N_A,

Thank you for reaching out to the MongoDB Community forums!

Could you please share the steps you followed to install MongoDB and confirm if you are using any container such as Docker?

Also, could you provide the content of the directory /var/run/mongodb?

Additionally, can you confirm if any recent changes have been made that could be causing this error?

Best regards,
Kushagra

1 Like

I solved it, doing this
modified this fild
/etc/systemd/system/mongod.service
then I created a copy here
/usr/lib/systemd/system/mongod.service

modify the file only in service

[Service]
User=mongod
Group=mongod
Environment=“OPTIONS=-f /etc/mongod.conf”
EnvironmentFile=-/etc/sysconfig/mongod
ExecStart=/usr/bin/mongod $OPTIONS
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
ExecStartPre=/usr/bin/mkdir -p /var/lib/mongo
ExecStartPre=/usr/bin/chown mongod:mongod /var/lib/mongo
ExecStartPre=/usr/bin/chmod 0700 /var/lib/mongo
PermissionsStartOnly=true
PIDFile=/var/run/mongodb/mongod.pid
Type=forking

then

sudo systemctl daemon-reload

and restart mongo

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.