I was recently forced to remove and reinstall MongoDB on my web server, which is a VM running Ubuntu 20.04.6 LTS. Before I erased all of the previous MongoDB files, I copied the data directory /var/lib/mongodb
to a backup directory, /var/lib/mongodb_backup_force
. When I first redownloaded MongoDB, everything started and ran fine. However, upon copying the data files from the backup directory back to /var/lib/mongodb
, restarting, and running sudo systemctl status mongod
, I get the following errors:
mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2024-12-24 20:51:26 EST; 12min ago
Docs: https://docs.mongodb.org/manual
Process: 29193 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=14)
Main PID: 29193 (code=exited, status=14)
Dec 24 20:51:26 rapid-1662.vm.duke.edu systemd[1]: Started MongoDB Database Server.
Dec 24 20:51:26 rapid-1662.vm.duke.edu mongod[29193]: {"t":{"$date":"2024-12-25T01:51:26.863Z"},"s":"I", "c":"CONTROL", "id":7484500, "ctx":"-","msg":"Environment variable MONGODB_CONFIG_OVERRIDE_NOFORK == 1, overriding "processManagement.fork" to false"}
Dec 24 20:51:26 rapid-1662.vm.duke.edu systemd[1]: mongod.service: Main process exited, code=exited, status=14/n/a
Dec 24 20:51:26 rapid-1662.vm.duke.edu systemd[1]: mongod.service: Failed with result 'exit-code'.
I’ve tried running the following commands to change permissions:
sudo chown -R mongodb:mongodb /var/lib/mongodb
, sudo chown mongodb:mongodb /tmp/mongodb-27017.sock
, sudo chown -R mongodb:mongodb /var/lib/mongodb/*
, and I’ve tried deleting the file /tmp/mongodb-27017.sock
. But to no avail.
When I consult the logs, I see An incomplete repair has been detected! This is likely because a repair operation unexpectedly failed before completing. MongoDB will not start up again without --repair.
However, running mongod --repair
fails with: Failed to start up WiredTiger under any compatibility version. This may be due to an unsupported upgrade or downgrade.
I would appreciate any guidance on how to resolve this and get MongoDB running again.
Here is my /etc/mongod.conf
file:
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
# engine:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1
# how the process runs
processManagement:
timeZoneInfo: /usr/share/zoneinfo
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp: