Skip to content

Instantly share code, notes, and snippets.

@olragon
Last active March 3, 2026 09:04
Show Gist options
  • Select an option

  • Save olragon/23f94a3a71b8bbb1aaefa3922c9ff0f6 to your computer and use it in GitHub Desktop.

Select an option

Save olragon/23f94a3a71b8bbb1aaefa3922c9ff0f6 to your computer and use it in GitHub Desktop.
Bun segfaults on Proxmox VM — the $6.75 AVX rabbit hole

Bun Segfaults on Proxmox VM — the $6.75 AVX Rabbit Hole

2026-03-03 — debugging war story

The Problem

Deploying a Bun app to a Proxmox VM. Everything works locally. On the VM:

panic(main thread): Segmentation fault at address 0x419E4000000
CPU lacks AVX support. Please consider upgrading to a newer CPU.

RSS: 15.96 GB. Peak: 7.93 GB. Bun's JIT compiler tried to eat the whole VM alive before dying.

What I Tried (the expensive part)

  1. Bundled the app into a single 8MB JS file → same crash, 16GB RSS
  2. Ran from source with bun --smol → hangs, no output, then segfault
  3. Increased VM RAM from 4GB to 8GB → same crash, just took longer
  4. Tried --compile standalone binary → still needs AVX at runtime
  5. Considered rewriting the server to run on Node.js instead of Bun

~15-20 rounds of SSH commands, reading crash logs, trying flags. Claude Opus context window growing fatter each round.

Estimated burn: ~300K input tokens + ~30K output tokens = ~$6.75 USD.

The Fix

# Check host CPU — AVX is there
grep -o 'avx[^ ]*' /proc/cpuinfo | head -2
# avx
# avx2

# Check VM config — no CPU type set (defaults to kvm64, no AVX passthrough)
qm config 102 | grep cpu
# (empty)

# The $6.75 command
qm set 102 --cpu host
qm stop 102 && qm start 102

One command. Proxmox defaults VM CPU to kvm64 which strips out AVX/AVX2/SSE4.2 — doesn't pass through host CPU features. Setting --cpu host passes everything through.

After restart:

$ grep -o 'avx[^ ]*' /proc/cpuinfo | head -2
avx
avx2

$ bun --version
1.3.10

$ systemctl --user status my-app
● Active: active (running)
  Memory: 52.2M

52 MB. Not 16 GB. Works perfectly.

Lesson

When your runtime segfaults on a VM with "CPU lacks AVX support" — don't debug the runtime. Check qm config first.

Proxmox CPU types that pass AVX:

  • host — pass through all host CPU features (easiest, use this for dedicated VMs)
  • x86-64-v3 — guarantees AVX/AVX2 (better for migration between hosts)

Proxmox CPU types that DON'T have AVX:

  • kvm64 (default) — minimal feature set
  • qemu64 — also minimal
  • x86-64-v2 — SSE4.2 yes, AVX no

Runtimes That Need AVX

Runtime AVX Required Notes
Bun Yes JIT compiler uses AVX. Segfaults without it.
Node.js No Works on kvm64. V8 has non-AVX fallbacks.
Deno No V8-based, same as Node.

If you can't change the VM CPU type, use Node.js. If you control the hypervisor, just set --cpu host and move on.


$6.75 in AI tokens to learn one qm set command. At least now you don't have to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment