I am trying to install and start a MongoDB on a fresh installation of Ubuntu 20 (it’s literally the first thing I did after ssh
ing onto the server).
I followed the setup tutorial and did the following steps:
curl -fsSL https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
sudo apt-get update
sudo apt-get -y install mongodb-org
sudo systemctl start mongod
When I run sudo systemctl status mongod
I get the following error:
mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: core-dump) since Sun 2021-08-22 23:25:56 CEST; 2s ago
Docs: https://docs.mongodb.org/manual
Process: 86514 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=dumped, signal=ILL)
Main PID: 86514 (code=dumped, signal=ILL)
Aug 22 23:25:55 Ubuntu20-64Bit systemd[1]: Started MongoDB Database Server.
Aug 22 23:25:56 Ubuntu20-64Bit systemd[1]: mongod.service: Main process exited, code=dumped, status=4/ILL
Aug 22 23:25:56 Ubuntu20-64Bit systemd[1]: mongod.service: Failed with result 'core-dump'.
If I simply run mongod
I get the following error:
Illegal instruction (core dumped)
This is my configuration (unchanged after installing, located at /lib/systemd/system/mongod.service):
[Unit]
Description=MongoDB Database Server
Documentation=https://docs.mongodb.org/manual
After=network-online.target
Wants=network-online.target
[Service]
User=mongodb
Group=mongodb
EnvironmentFile=-/etc/default/mongod
ExecStart=/usr/bin/mongod --config /etc/mongod.conf
PIDFile=/var/run/mongodb/mongod.pid
# file size
LimitFSIZE=infinity
# cpu time
LimitCPU=infinity
# virtual memory size
LimitAS=infinity
# open files
LimitNOFILE=64000
# processes/threads
LimitNPROC=64000
# locked memory
LimitMEMLOCK=infinity
# total threads (user+kernel)
TasksMax=infinity
I already checked the mongoDB-logs, it seems like MongoDB crashes before creating any logs at all because the folder is empty.
I am not sure if that is normal but I looked for the environment file at /etc/default/mongod
(see in config) but it doesn’t exist…
I tried the following things to fix this error:
- Restart the service with
systemctl
- Uninstalling MongoDB with
sudo apt-get purge mongodb-org*
, deleting all/var/log/mongodb
,/var/lib/mongodb
directories and all other files containing the namemongo
, as well as the user and usergroupmongodb
. - Completely resetting the server and reinstalling Ubuntu (on version 20 and 21).
- installing version 4.4 of Mongo DB
Interesting to note might be that I once had a Mongo DB running on this server but I had to reset the server after completly deleting the /tmp
and /var/log/
directories (yes I should have researched a little before doing this ). The MongoDB stopped working then but I am pretty sure that my server provider has reset everything of these previous versions of the server after I clicked reset and they reinstalled ubuntu (all of the other things are deleted as well).
I am really stuck here, I hope someone has an idea because MongoDB is essential to the stuff I’m working on atm…