Skip to content

Instantly share code, notes, and snippets.

@davidystephenson
Last active June 16, 2026 18:50
Show Gist options
  • Select an option

  • Save davidystephenson/93164892a87e5373f77e1422eb43e8b9 to your computer and use it in GitHub Desktop.

Select an option

Save davidystephenson/93164892a87e5373f77e1422eb43e8b9 to your computer and use it in GitHub Desktop.
Fix: Ollama crashing Cosmic compositor (VRAM exhaustion) - Framework Desktop

Fix: Ollama crashing Cosmic compositor (VRAM exhaustion)

Machine: Framework Desktop, Ryzen AI Max+ 395, 128 GB, CachyOS + Cosmic

What happened

Ollama (llama-server) consumed nearly all 96 GB of iGPU VRAM, leaving nothing for cosmic-comp, Chrome, and VS Code. The kernel logged:

amdgpu: [drm] *ERROR* Not enough memory for command submission!

cosmic-comp segfaulted, Cosmic died, and the framebuffer TTY (black screen, white monospace text) appeared showing the last cosmic-session log lines — which happened to contain SSH_AUTH_SOCK in the process environment strings. That string is not the cause; it is just part of the process launch logs.


Fix 1 — Immediate (no reboot needed)

Reserve 6 GB of VRAM that Ollama will never touch, leaving headroom for the compositor and other GPU clients.

Edit /etc/systemd/system/ollama.service.d/override.conf and add one line:

Environment="OLLAMA_GPU_OVERHEAD=6442450944"

Full file after the change:

[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"
Environment="OLLAMA_KEEP_ALIVE=-1"
Environment="OLLAMA_IGPU_ENABLE=1"
Environment="OLLAMA_FLASH_ATTENTION=1"
Environment="HIP_VISIBLE_DEVICES=-1"
Environment="OLLAMA_GPU_OVERHEAD=6442450944"

6442450944 = 6 GB in bytes (6 × 1024³).

Then reload and restart Ollama:

sudo systemctl daemon-reload && sudo systemctl restart ollama

This fixes the crash for models that fit within ~90 GB (96 GB carveout minus 6 GB overhead). For qwen3.5:122b (~81 GB weights + ~12 GB KV cache at 8192 context = ~93 GB), Fix 2 is also needed.


Fix 2 — BIOS: increase the iGPU VRAM carveout to 112 GB

Needed for qwen3.5:122b or any model that requires more than ~90 GB.

Current split: 96 GB GPU / 32 GB CPU. Target split: 112 GB GPU / 16 GB CPU.

The OS and running apps comfortably fit in 16 GB CPU RAM. The GPU gets more headroom. Fix 1 (OLLAMA_GPU_OVERHEAD) must still be set after this change.

Steps

  1. Shut down the machine (full power off, not suspend).
  2. Press the power button, then tap F2 repeatedly until the BIOS Setup launches.
  3. Navigate to Advanced, then look for a submenu named one of: AMD CBS, GFX Configuration, UMA, Graphics Memory, or Dedicated VRAM. The exact path is not publicly documented for Insyde 03.05 — navigate Advanced until you find a GPU/UMA-related entry.
  4. Find UMA Frame Buffer Size (or similar label) and change it to 112 GB or the closest available option.
  5. Press F10 to save and exit. The machine will reboot.
  6. After reboot, verify in Linux:
cat /sys/class/drm/card1/device/mem_info_vram_total

Expected: ~120259084288 bytes (~112 GB).

Note: Fix 1 (OLLAMA_GPU_OVERHEAD=6442450944) must still be applied after the BIOS change to keep a safety margin for the compositor.


Summary

Action Required for Requires reboot
Fix 1: OLLAMA_GPU_OVERHEAD=6442450944 All models (stops starvation) No
Fix 2: BIOS UMA carveout → 112 GB Models needing >90 GB (e.g. qwen3.5:122b) Yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment