mongo: Mongo 5.0.0 crashes but 4.4.6 works

EDIT: conclusion here https://github.com/docker-library/mongo/issues/485#issuecomment-891991814


Already tried too many things and 5.0.0 (or latest) won’t work on my Debian distro but it works fine on WSL2 (also Debian) for some reason. If I specify the 4.4.6 version it works great.

The latest version wont go up and will go on a restart loop. Docker logs are empty as well so I couldn’t see what was happening.

image

My docker-compose.yml:

version: "3.8"
services:
 mongodb:
  image : mongo:latest
  container_name: mongodb
  environment:
  - PUID=1000
  - PGID=1000
  volumes:
  - /home/roadside/mongodb/database:/data/db
  ports:
  - 27017:27017
  restart: unless-stopped

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 26 (5 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks @martadinata666 for the link.

Summary:

For Intel x86_64, MongoDB requires Sandy Bridge or later. For AMD x86_64, MongoDB requires Bulldozer or later.

Starting in MongoDB 5.0, mongod, mongos, and the legacy mongo shell no longer support x86_64 platforms which do not meet this minimum microarchitecture requirement.

-https://docs.mongodb.com/manual/administration/production-notes/#x86_64

the underling requirement for the MongoDB 5.0 binary server packages is CPUs with AVX instructions. These are broadly Sandy Bridge or newer Intel CPUs, but there is a caveat:

Not all CPUs from the listed families support AVX. Generally, CPUs with the commercial denomination Core i3/i5/i7/i9 support them, whereas Pentium and Celeron CPUs do not.

- https://www.mongodb.com/community/forums/t/mongodb-5-0-cpu-intel-g4650-compatibility/116610/2


What does this mean for the mongo image? We currently consume the apt packages and windows downloads as provided by upstream and have no plans to compile them from source.

Can also attest that mongo:latest no longer works and had to downgrade to 4.4.6 for the image to work on Raspberry Pi 4 (running Ubuntu Server 21.04).

@martadinata666 Thanks for this info - verified on my three boxes:

Ubuntu 20.04. on Intel P8600: no avx - mongo:5 is not able to run. Windows 10 with Docker running in HyperV on Intel Core i5-4310M: checked from within a docker-container: avx2 available - mongo:5 is running Debian 10 on AMD Ryzen Threadripper 1920X: avx2 available - mongo:5 is running

Here the complete list of flags supported by my CPUs:

status: mongo:5 not working model name : Intel® Core™2 Duo CPU P8600 @ 2.40GHz flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts nopl cpuid aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm pti tpr_shadow vnmi flexpriority dtherm ida

status: mongo:5 working model name : AMD Ryzen Threadripper 1920X 12-Core Processor flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl tsc_reliable nonstop_tsc cpuid extd_apicid pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xsaves clzero arat overflow_recov succor

status: mongo:5 working model name : Intel® Core™ i5-4310M CPU @ 2.70GHz flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm invpcid_single ssbd ibrs ibpb stibp fsgsbase bmi1 avx2 smep bmi2 erms invpcid xsaveopt flush_l1d arch_capabilities

seems avx cpu feature needed to run mongo5, can somebody can confirm this? cat /proc/cpuinfo | grep --color avx

is running through Proxmox

Set the cpu type to host in the hardware settings of the vm. That gives avx into the processor flags and mongodb will start.

For anyone else trying to get mongodb working on older CPUs, I went down this rabbit hole earlier today.

My approach was to build from source, as mentioned at https://www.mongodb.com/community/forums/t/mongodb-5-0-cpu-intel-g4650-compatibility/116610/2

I wasn’t sure of creating a clean build environment, so I used the scripts and docker image from https://github.com/meteor/mongodb-builder with two small adjustments:

  • Add ‘CCFLAGS=-march=nehalem’ to build.sh
  • Adjust # CPUs in build.sh to match my machine (I used ‘-j 6’) and adjust the --memory value in run-builder.sh similarly (I used ‘28g’)
  • Specify a version of mongodb in run-builder.sh (I used ‘5.0.17’ - values found from https://www.mongodb.com/try/download/community )

My test run took about 1h30 on my desktop machine, and I ended up with a .tgz file that looks promising:

drwxr-xr-x myuser/users         0 2023-04-26 22:52 mongodb-linux-x86_64-5.0.17/
drwxr-xr-x myuser/users         0 2023-04-26 22:58 mongodb-linux-x86_64-5.0.17/bin/
-rwxr-xr-x root/root     62211216 2023-04-26 22:52 mongodb-linux-x86_64-5.0.17/bin/mongos
-rwxr-xr-x root/root     86620528 2023-04-26 22:52 mongodb-linux-x86_64-5.0.17/bin/mongod

Edit: I added the two lines below to my docker-compose.yml file that I use for mongodb, to use my binaries rather than the ones in the docker image, and the image now seems to start up correctly (as far as I can tell):

 mongodb:
    image: "mongo:5.0"
    volumes:
      - "/data/docker/mongodb_data:/data/db"
      - /data/docker/mongodb-linux-x86_64-5.0.17/bin/mongos:/bin/mongos:ro
      - /data/docker/mongodb-linux-x86_64-5.0.17/bin/mongod:/bin/mongod:ro

Hi, I also encounter this error.

I notice it happens after Ubuntu upgrade : containerd.io:amd64 (1.4.6-1, 1.4.8-1). I tried to downgrade to 1.4.6 without success.

Ubuuntu 20.04 (happens on 5.4.0-77-generic) : Linux ns******.eu 5.4.0-80-generic #90-Ubuntu SMP Fri Jul 9 22:49:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Packages updated :

Upgrade: containerd.io:amd64 (1.4.6-1, 1.4.8-1), beamium:amd64 (2.0.7-focal, 2.0.8-bionic), libsystemd0:amd64 (245.4-4ubuntu3.7, 245.4-4ubuntu3.10), udev:amd64 (245.4-4ubuntu3.7, 245.4-4ubuntu3.10), libudev1:amd64 (245.4-4ubuntu3.7, 245.4-4ubuntu3.10), systemd-timesyncd:amd64 (245.4-4ubuntu3.7, 245.4-4ubuntu3.10), python3-distupgrade:amd64 (1:20.04.33, 1:20.04.35), ubuntu-release-upgrader-core:amd64 (1:20.04.33, 1:20.04.35), qemu-user-static:amd64 (1:4.2-3ubuntu6.16, 1:4.2-3ubuntu6.17), systemd-sysv:amd64 (245.4-4ubuntu3.7, 245.4-4ubuntu3.10), libpam-systemd:amd64 (245.4-4ubuntu3.7, 245.4-4ubuntu3.10), systemd:amd64 (245.4-4ubuntu3.7, 245.4-4ubuntu3.10), libnss-systemd:amd64 (245.4-4ubuntu3.7, 245.4-4ubuntu3.10), apache2-utils:amd64 (2.4.41-4ubuntu3.3, 2.4.41-4ubuntu3.4)

I can run bash but cannot exec docker entrypoint :

docker run --rm -it mongo:5.0 bash
root@6041c8b2a4f6:/# docker-entrypoint.sh mongod
Illegal instruction

Added datapoint: this also affects the ARM64 builds.

https://docs.mongodb.com/manual/administration/production-notes/#arm64

MongoDB on arm64 requires the ARMv8.2-A or later microarchitecture.