MongoDB Cannot Start ‘Unknown Storage Engine’ – Fix

debianmongodb

Note: I checked Mongodb doesn't start on reboot and is not the same problem,

I had a rocket chat server, rebooted the server and now mongod cannot start. These are the messages:

2020-06-01T21:39:05.566-0300 I  STORAGE  [initandlisten] ** WARNING: Support for MMAPV1 storage engine has been deprecated and will be
2020-06-01T21:39:05.566-0300 I  STORAGE  [initandlisten] **          removed in version 4.2. Please plan to migrate to the wiredTiger
2020-06-01T21:39:05.566-0300 I  STORAGE  [initandlisten] **          storage engine.
2020-06-01T21:39:05.566-0300 I  STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/deprecated-mmapv1
2020-06-01T21:39:05.566-0300 I  STORAGE  [initandlisten] 
2020-06-01T21:39:05.566-0300 I  STORAGE  [initandlisten] exception in initAndListen: Location18656: Cannot start server with an unknown storage engine: mmapv1, terminating
2020-06-01T21:39:05.567-0300 I  NETWORK  [initandlisten] shutdown: going to close listening sockets...
2020-06-01T21:39:05.567-0300 I  -        [initandlisten] Stopping further Flow Control ticket acquisitions.
2020-06-01T21:39:05.567-0300 I  CONTROL  [initandlisten] now exiting
2020-06-01T21:39:05.567-0300 I  CONTROL  [initandlisten] shutting down with code:100

This is /etc/mongod.conf:

storage:
  dbPath: /var/lib/mongodb
  journal:
    enabled: true
  engine: mmapv1
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log
net:
  port: 27017
  bindIp: 127.0.0.1
processManagement:
  timeZoneInfo: /usr/share/zoneinfo
replication:
  replSetName: rs01

My packages versions:

 dpkg -l | grep mongo
ii  mongodb-org                     4.2.7                        amd64        MongoDB open source document-oriented database system (metapackage)
ii  mongodb-org-mongos              4.0.13                       amd64        MongoDB sharded cluster query router
ii  mongodb-org-server              4.2.7                        amd64        MongoDB database server
ii  mongodb-org-shell               4.0.13                       amd64        MongoDB shell client
ii  mongodb-org-tools               4.0.13                       amd64        MongoDB tools

And OS is Debian Buster

How can I fix it?

Best Answer

I've fixed (at least temporarily) downgrading to mongodb-org 4.0. Previously uninstalled curl and libcurl and libcurl4. Then added the repo to mondo-org:

cat  /etc/apt/sources.list.d/stretch.list
deb http://deb.debian.org/debian stretch main contrib

Remove mongodb-org 4.2 and installed mondodb-org 4.0.

That's because mongodb-org does not support mmapv1 anymore: https://docs.mongodb.com/manual/release-notes/4.2/#removed-mmapv1-storage-engine