Sitemap

MongoDB “Invalid Opcode” Error on Proxmox: The AVX Trap Explained

2 min readJan 3, 2026

--

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)
  • kvm64
  • qemu64

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 avx

Results:

  • If you see avx or avx2 → 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

  1. Shut down the VM completely (not reboot)

why shutdwon matters: CPU flags are applied only at power-on.

  1. Open the VM settings
  2. Go to Hardware → Processors
  3. Click Edit
  4. Change CPU Type to `host`:
  5. Start the VM again
Press enter or click to view image in full size
Proxmox vm settings

Verify After Boot

Once the VM is back up:

lscpu | grep -i avx

You should now see avx / avx2. Then start MongoDB:

systemctl start mongod
systemctl status mongod

MongoDB 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_64 automatically includes AVX (it doesn’t)
  • MongoDB fails hard instead of failing gracefully

The result: hours of debugging something that isn’t broken at all.

--

--

Khimananda Oli
Khimananda Oli

Written by Khimananda Oli

Lead DevOps Engineer & Cloud Architect | Shipping infrastructure that scales, recovers, and stays up