docs/Databases/mongodb-avx-qemu.md
Since WeKan 9.96 (issue #6458), WeKan ships a general
cpu-exec helper on every Linux platform — in the Snap ($SNAP/bin/cpu-exec), in every
wekan-<version>-<arch>.zip bundle (bundle/cpu-exec, next to a same-arch qemu-<arch> static
binary), in the Docker image (/build/cpu-exec) and in the Sandstorm .spk. It checks
/proc/cpuinfo for the CPU features a binary needs and, when one is missing, transparently re-runs
the binary through qemu-user (which implements the full modern instruction set):
cpu-exec --features x86_64=avx,aarch64=atomics mongod --dbpath ...
--features (or no entry for the current architecture) it is a plain exec — zero
overhead, safe for every binary.WEKAN_REQUIRED_CPU_FEATURES (same syntax) overrides --features, so any script or user can
declare requirements without editing commands.$WEKAN_QEMU_USER, qemu-<arch> next to cpu-exec (the bundle),
$SNAP/qemu-<arch>, the Snap's migratemongo/avx/qemu-x86_64, then qemu-<arch>/
qemu-<arch>-static on $PATH (install with sudo apt install qemu-user-static).aarch64=atomics (LSE, ARMv8.1) is the practical /proc/cpuinfo proxy for MongoDB's ARMv8.2-A
requirement: Raspberry Pi 3/4 (Cortex-A53/A72) lack it, ARMv8.2-A cores have it.The Snap's mongodb-control and migration-control run every mongod 7 invocation through
cpu-exec, so WeKan's MongoDB works (slower) on CPUs without AVX — including hypervisors/sandboxes
that mask AVX — and the MongoDB → FerretDB migration can read modern MongoDB data there too.
FerretDB (pure Go + SQLite) needs no special CPU features and is the native-speed alternative:
snap run wekan.migrate.
New MongoDB supports newer CPUs only, like:
Old MongoDB 4.4.18 supports old CPUs, like:
Info about requiring newer arm64:
Detecting does x86_64 CPU support AVX:
Error running MongoDB 8 at RasPi4, when not using Qemu:
December 06 11:48:49 rpi4b systemd[1]: Started mongod.service - MongoDB Database Server.
December 06 11:48:53 rpi4b mongod[3749]: /usr/bin/mongod: line 4: 3750 Illegal instruction (core dumped) /usr/bin/mongodreal --co>
December 06 11:48:53 rpi4b systemd[1]: mongod.service: Main process exited, code=exited, status=132/n/a
December 06 11:48:53 rpi4b systemd[1]: mongod.service: Failed with result 'exit-code'.
MongoDB 7.3.4 for RasPi4 and older:
CrossCompiling MongoDB from x86_64 to ARMv8.0 Cortex A53/A55/A72 like RasPi4 and older:
Compiling MongoDB from x86_64 to x86_64 CPUs that does not have AVX instructions:
qemu-user can run single Linux executeable for many architectures. It does not emulate full OS like qemu-system.
Running MongoDB with Qemu on x86_64 CPU that does not support AVX, like Intel Core 2 Duo:
Running MongoDB with Qemu on older arm64, like RasPi4 and older RasPi: