MongoDB “Invalid Opcode” Error on Proxmox: The AVX Trap Explained
If MongoDB crashes immediately after startup on a Proxmox virtual machine, throwing errors like invalid opcode or status=4/ILL, you’re not dealing with a bad configuration or a broken install. You’ve hit a CPU feature mismatch — specifically, missing AVX instructions inside the VM.
This issue is common, confusing, and easy to misdiagnose. Let’s break it down properly.
What the Error Looks Like
Typical symptoms include:
- MongoDB service exiting instantly after start
- Kernel logs showing
trap invalid opcode - systemd reporting
status=4/ILL - Core dumps generated with no helpful MongoDB logs
At first glance, it feels like a MongoDB bug. It isn’t.
The Real Cause: AVX Is Missing in the VM
MongoDB 5.0 and newer require AVX (Advanced Vector Extensions).
If AVX is not available, MongoDB will crash immediately — no warning, no fallback.
On Proxmox, this usually happens because the VM CPU type is set to a compatibility model, such as:
x86-64-v2-AES(default select in Proxmos vm)kvm64qemu64
These CPU models intentionally hide modern instruction sets like AVX to allow VM migration across different hosts. Unfortunately, MongoDB doesn’t work without AVX.
How to Check If AVX Is Available
Inside the VM, run:
lscpu | grep -i avxResults:
- If you see
avxoravx2→ you’re good - If nothing shows up → MongoDB 5+ will not run
Important note:
Your host CPU may support AVX, but the VM won’t see it unless Proxmox exposes it.
The Correct Fix: Use host CPU Type
This is the recommended and clean solution.
Steps in Proxmox
- Shut down the VM completely (not reboot)
why shutdwon matters: CPU flags are applied only at power-on.
- Open the VM settings
- Go to Hardware → Processors
- Click Edit
- Change CPU Type to `host`:
- Start the VM again
Verify After Boot
Once the VM is back up:
lscpu | grep -i avxYou should now see avx / avx2. Then start MongoDB:
systemctl start mongod
systemctl status mongodMongoDB should run normally.
What If You Can’t Use host CPU?
If the physical CPU truly does not support AVX (older hardware), your only real option is:
- MongoDB 4.4 — the last version that does not require AVX
Anything newer will fail, regardless of configuration.
Why This Is So Common
- Proxmox defaults prioritize compatibility over performance
- Many people assume
x86_64automatically includes AVX (it doesn’t) - MongoDB fails hard instead of failing gracefully
The result: hours of debugging something that isn’t broken at all.
