"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"}} after upgrade from 4.4.18 to 4.4.21

I tried upgrade DB Mongo from 4.4.18 to 4.4.21 with yum update the upgrade work correctly.
After reboot system the Mongo go to error and doesn’t start.
I have this errore in the log:

{“t”:{“$date”:“2023-05-22T12:45:27.649+02:00”},“s”:“I”, “c”:“CONTROL”, “id”:20698, “ctx”:“main”,“msg”:“***** SERVER RESTARTED *****”}
{“t”:{“$date”:“2023-05-22T12:45:27.653+02: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-22T12:45:27.669+02: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-22T12:45:27.669+02: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”}}

My configurations is:

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
bindIpAll: true

#security:

#operationProfiling:

replication:
replSetName: rs0
#sharding:

Enterprise-Only Options

#auditLog:

#snmp:

HI,
I managed to solve on test environment:
I commented on the config file
processManagement:
fork: true # fork and run in background

pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile

timeZoneInfo: /usr/share/zoneinfo

Then I gave the mongod user privileges for the /var/lib/mongo folder
chown -R mongod:mongod /var/lib/mongo

Seeing the note you don’t need to specify the pidfile:

1 Like