Setting up MongoDB v5.0 on Ubuntu 20: "core-dump: STATUS 4/ILL"

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 sshing onto the server).

I followed the setup tutorial and did the following steps:

  1. curl -fsSL https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
  2. 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
  3. sudo apt-get update
  4. sudo apt-get -y install mongodb-org
  5. 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:

  1. Restart the service with systemctl
  2. Uninstalling MongoDB with sudo apt-get purge mongodb-org*, deleting all /var/log/mongodb, /var/lib/mongodb directories and all other files containing the name mongo, as well as the user and usergroup mongodb.
  3. Completely resetting the server and reinstalling Ubuntu (on version 20 and 21).
  4. 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 :wink:). 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…

2 Likes

Welcome to the MongoDB Community Forums @Philipp_Kolbe !

The likely reason for encountering an illegal instruction is that your CPU does not meet the x86_64 microarchitecture requirements for MongoDB 5.0.

Can you please:

  • Provide the output of /proc/cpuinfo
  • Confirm if your Ubuntu is running in a VM and if so, the host O/S and VM software versions

Related discussion for someone trying to run MongoDB 5.0 on VirtualBox: Could not start MongoDB 5.0 running Oracle Linux on VirtualBox.

Thanks,
Stennie

Here is the output of /proc/cpuinfo:

processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 6
model name : Common KVM processor
stepping : 1
microcode : 0x1
cpu MHz : 2693.508
cache size : 16384 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 sys>bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips : 5387.01
clflush size : 64
cache_alignment : 128
address sizes : 40 bits physical, 48 bits virtual
power management:

(sorry if I didn’t format this correctly again :grimacing:, how can I edit my posts and how can I create these Code-Boxes?)

Here are the requirements given by the server host:

  • CPU Cores: 1 Core Intel Xeon
  • RAM: 3GB ECC RAM
  • Memory: 20GB SSD

I reinstalled a different version of Ubuntu (18.04) but it didn’t work either…

As I said, the DB was already working for months on this server so I don’t understand what would change after reinstalling Ubuntu.

I am still waiting for further information of my server host, I hope you can already read something from this… I am quite sure that it is a VM though.

Best regards,
Philipp

Hi @Philipp_Kolbe,

Thanks for the further info. This is apparently a KVM environment with some host CPU features masked via the “Common KVM processor” virtualised CPU exposed to the VM.

The host Xeon CPU may have the required features, but the VM’s CPU does not support instructions required by MongoDB 5.0 (such as AVX and SSE) which should be listed in the CPU flags:

flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr

Some options to consider are:

  • try installing the MongoDB 4.4 server packages (they target older CPU microarchitectures)

  • upgrade your VM or hosting to support the required server extensions

  • compile MongoDB 5.0 from source using older architecture tags (this may be tricky given your virtual CPU seems to have limited instruction support)

Regards,
Stennie

3 Likes

Thanks alot! Installing MongoDB version 4.4.8 worked on Ubuntu 18.

One more question… is it possible that the 4.4 version does not have a mongosh? When I’m running the command it tells me that it can’t find the mongosh command. Now I’m using mongo which is working. Is there a difference between the two?

Nevermind… I independetly installed sudo apt-get install mongodb-mongosh, now that’s working too.

Again, thanks for the quick help…

1 Like

Hi @Philipp_Kolbe ,

mongosh is a modern replacement for the legacy mongo shell, and the recommended shell as of the MongoDB 5.0 release.

For more information and feature highlights, see:

Regards,
Stennie

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