'how to install MongoDb on Debian 11
I followed the description of how to install MongoDB to Debian 11 that can be found in severall places. Since all describe the same, I selected one of them. Every input works as expected. Even the attempt to start the service with
sudo systemctl start mongod
does not create any error. When I check the status with
sudo systemctl status mongod
I receive:
mongod.service - MongoDB Database Server Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled) Active: failed (Result: signal) since Sat 2022-04-30 19:31:40 CEST; 3s ago Docs: https://docs.mongodb.org/manual Process: 506851 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=killed, signal=ILL) Main PID: 506851 (code=killed, signal=ILL) CPU: 12ms
and if I try to call mongo, I receive the message in German:
"Ungültiger Maschinenbefehl"
I deinstalled and reistalled a few times, but the result is always the same. Does anybody has any idea?
Solution 1:[1]
"Ungültiger Maschinenbefehl"
that looks very much like an "illegal instruction" (which is also hinted at by the (code=killed, signal=ILL)
printout of systemd: according to man 7 signal
, the meaning of SIGILL
is indeed illegal instruction
.
An "illegal instruction" happens, when the machine code of your binary contains instructions that your CPU does not understand.
Now, there are a couple of safeguards that prevent you to run binaries that are totally incompatible (e.g. trying to run an amd64
binary on a RaspberryPi), but even for a given architecture (e.g. amd64
) there are many CPU variants, with different (additional) instruction sets.
So in your case most likely MongoDB was compiled for the latest and greatest CPU (or your architecture) using all the nifty SIMD and whatnot accelerations available. Unfortunately your CPU appears to be older (not supporting these nifty and whatnot instructions), and as soon as the execution reaches such an instruction, the program terminates.
Now official Debian packages go to great lengths to support a minimal baseline CPU, that has an instruction set that is available on virtually all CPUs of the given architecture (with the drawback, that it is not the most optimized CPU). However, you are using packages by some 3rd party, who seem to not care for compatibility with older CPUs (or who are just not aware of the problem).
How to solve the issue:
- recompile your software specifically for your CPU
- ask the providers of the binaries to also provide a binary for legacy CPUs (probably using a baseline CPU like Debian itself)
- upgrade your CPU
Solution 2:[2]
I asked NetCup, my Provider of the V-Server. The system does support die AVX instruction set. Therefore MongoDB 5.0 cannot be installed and that is the reason for the instruction error. I had to install MongoDB 4.4. That did work.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | umläute |
Solution 2 | MrSpock |