Wednesday, March 13, 2024

Error starting mongodb

[unica@unicademo mongodb]$ sudo systemctl status mongod ● mongod.service - MongoDB Database Server Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled) Active: failed (Result: core-dump) since Thu 2024-03-14 14:49:28 +08; 12s ago Docs: https://docs.mongodb.org/manual Process: 176103 ExecStart=/usr/bin/mongod $OPTIONS (code=dumped, signal=ILL) Main PID: 176103 (code=dumped, signal=ILL) Mar 14 14:49:20 unicademo.localdomain systemd[1]: Started MongoDB Database Server. Mar 14 14:49:28 unicademo.localdomain systemd[1]: mongod.service: Main process exited, code=dumped, status=4/ILL Mar 14 14:49:28 unicademo.localdomain systemd[1]: mongod.service: Failed with result 'core-dump'. The reason is :https://superuser.com/questions/1814515/mongodb-error-failed-with-result-core-dump The "signal=ILL" part of the systemctl output means that MongoDB failed to start because of an illegal instruction. This is caused by MongoDB 5 and later requiring AVX to run. You can check if your CPU supports AVX by doing: cat /proc/cpuinfo | grep avx If you get any kind of output your CPU should support AVX, if not its either too old or if you are running Linux inside a VM and your hypervisor isn't passing through your physical CPU flags. For a list of CPUs that support AVX see: https://en.wikipedia.org/wiki/Advanced_Vector_Extensions (basically CPUs started supporting AVX at around 2011) If your physical CPU is indeed too old your options are: Downgrade to MongoDB 4 which still runs without AVX but will be end of life next year Compile your own version of MongoDB without AVX or look around for community made version without AVX (there are some unoffical containers out there for example) If you are using virtualization make sure your hypervisor isn't hiding your physical CPU flags for compability or other reasons If your hardware is indeed too old to support AVX upgrade to a newer CPU