---
title: "Ollama in LXC — RAM Requirements and Intel oneAPI Overhead"
aliases: [ollama-lxc, ollama-ram, ollama-proxmox, ollama-cpu-inference]
tags: [ollama, lxc, proxmox, homelab, llm, ram, inference]
sources:
  - "daily/2026-04-21.md"
created: 2026-04-21
updated: 2026-04-21
---

# Ollama in LXC — RAM Requirements and Intel OneAPI Overhead

Ollama running inside a Proxmox LXC container loads the Intel oneAPI toolkit on startup even when doing CPU-only inference, consuming approximately 1.8 GB of RAM as constant overhead before any model is loaded. This makes RAM sizing for Ollama LXC containers non-obvious — the usable headroom is significantly smaller than the raw allocation.

## Key Points

- **Intel oneAPI toolkit consumes ~1.8 GB** at Ollama startup regardless of whether a GPU is present — it's loaded speculatively for hardware detection
- **Minimum practical allocation for a 7B model: 6 GB** — 1.8 GB (oneAPI) + ~1.9 GB (model weights) + KV-cache headroom
- At 6 GB RAM, Ollama 7B runs at approximately **10.3 tok/s on CPU** in LXC (tested on server-grade hardware)
- **4 GB allocation is insufficient** — leaves only ~562 MB free after oneAPI loads, causing OOM errors or severe swapping when loading a 7B model
- GPU passthrough to LXC would eliminate the oneAPI overhead penalty and dramatically increase throughput; requires runtime configuration at the Proxmox level

## Details

### Why oneAPI Loads on CPU-Only Inference

Ollama includes Intel oneAPI libraries for hardware acceleration detection. When Ollama starts, it probes available hardware — including Intel CPU extensions and integrated/discrete GPUs. The oneAPI runtime is initialized during this probe even if no compatible GPU is found and inference ultimately falls back to pure CPU. This is a known overhead, not a bug.

The practical effect: an LXC with 4 GB RAM appears to have plenty of headroom in `free -h` before Ollama launches, but after startup the node is nearly full before any model inference begins.

### RAM Sizing Guide

| Model Size | oneAPI Overhead | Model Weights | Min Allocation | Recommended |
|------------|-----------------|---------------|----------------|-------------|
| 7B (Q4) | ~1.8 GB | ~1.9 GB | 4.5 GB | 6 GB |
| 7B (Q8) | ~1.8 GB | ~3.8 GB | 6.5 GB | 8 GB |
| 13B (Q4) | ~1.8 GB | ~3.5 GB | 6.5 GB | 8 GB |
| 70B (Q4) | ~1.8 GB | ~19 GB | 22 GB | 24 GB |

Add 1–2 GB beyond minimum for KV-cache during active inference (context accumulation).

### Diagnosing RAM Exhaustion

```bash
# Check available RAM before Ollama loads
free -h

# Check after Ollama starts (before any model pull)
systemctl start ollama
sleep 10
free -h
# ~1.8 GB should disappear here

# Check model-loaded footprint
ollama pull llama3
free -h
```

If `ollama pull` hangs or returns OOM errors, the LXC allocation is insufficient even with a model that theoretically fits.

### Releasing RAM from Unused LXC Containers

The recommended approach when RAM is needed: shut down unused containers rather than reducing allocations of running services. On this homelab:

```bash
# Shut down ERPNext (CT100 originally, later renamed) and Monica (CT106)
# to free ~6 GB for Ollama upgrade from 4 GB → 6 GB
ssh pve "pct stop 100 && pct stop 106"
```

Shutting down a container immediately releases its RAM — the host sees full benefit without any config changes to other running containers.

### GPU Passthrough Upgrade Path

CPU inference at ~10 tok/s is adequate for casual use. To significantly increase throughput, pass through a GPU to the LXC container. This requires:
1. Enable IOMMU on the Proxmox host (see `[[wiki/homelab/_index]]`)
2. Add the GPU device to the LXC configuration
3. Install GPU drivers inside the container
4. Ollama will then automatically use the GPU for inference

The Intel oneAPI overhead remains on the host even with GPU passthrough, but model inference itself moves to the GPU.

## Related Concepts

- [[wiki/concepts/proxmox-vm-management-methods]] — approaches for managing Proxmox VMs and LXC containers
- [[wiki/concepts/homarr-proxmox-integration]] — Proxmox LXC management and container resource monitoring
- [[wiki/homelab/_index]] — full homelab infrastructure including Proxmox setup

## Sources

- [[daily/2026-04-21.md]] — Ollama CT100 had only 562 MB free despite 4 GB allocation; root cause identified as Intel oneAPI toolkit; RAM raised to 6 GB by shutting down ERPNext + Monica; Ollama ran at 10.3 tok/s on CPU after fix
