TL;DR
Quick diagnostic commands for the most common Ollama problems:
# Check if Ollama is running
systemctl status ollama
curl http://localhost:11434/api/version
# Check GPU detection
ollama ps
nvidia-smi # NVIDIA
rocm-smi # AMD
# Check disk space for model downloads
df -h ~/.ollama
# Check memory available
free -h
# View Ollama logs
journalctl -u ollama -n 50 --no-pager
# Force CPU-only mode if GPU is broken
OLLAMA_NUM_GPU=0 ollama serve
If you are running into an issue not covered here, the Ollama logs are almost always the fastest path to a diagnosis. Start there.
Error: Model Requires More System Memory
This is the single most common Ollama error. It means the model you are trying to load exceeds available RAM or VRAM.
Symptoms
Error: model requires more system memory (X GiB) than is available (Y GiB)
Root Cause
Large language models must fit entirely in memory during inference. A 7B parameter model at Q4 quantization needs roughly 4-5 GB. A 70B model needs 35-40 GB. If your system does not have enough combined RAM and VRAM, Ollama refuses to load the model.
Fixes
| Approach | Command | When to Use |
|---|---|---|
| Use a smaller model | ollama run llama3.2:3b | Under 8 GB RAM |
| Use higher quantization compression | ollama run llama3.1:8b-q2_K | Tight on memory |
| Force CPU-only (frees VRAM) | OLLAMA_NUM_GPU=0 ollama run llama3.1:8b | GPU VRAM too small |
| Close other applications | – | Free up system RAM |
| Add swap space | sudo fallocate -l 8G /swapfile | Last resort, slow |
Check what is consuming memory before blaming the model:
free -h
# Look at the "available" column, not "free"
# Check GPU VRAM usage
nvidia-smi --query-gpu=memory.used,memory.total --format=csv
Caution: Running models from swap is technically possible but results in extremely slow inference. It is not a practical solution for interactive use.
Model Size Reference
| Model | Parameters | Q4_K_M Size | Minimum RAM |
|---|---|---|---|
| Phi-3 Mini | 3.8B | ~2.2 GB | 4 GB |
| Llama 3.2 | 3B | ~2.0 GB | 4 GB |
| Llama 3.1 | 8B | ~4.7 GB | 8 GB |
| Mistral | 7B | ~4.1 GB | 8 GB |
| Llama 3.1 | 70B | ~40 GB | 48 GB |
| Llama 3.1 | 405B | ~230 GB | 256 GB |
Connection Refused on Port 11434
Symptoms
Error: could not connect to ollama app, is it running?
dial tcp 127.0.0.1:11434: connect: connection refused
Root Cause
The Ollama server process is not running, or it is bound to a different address.
Fixes
Step 1: Start the service.
# If installed via the official install script
sudo systemctl start ollama
sudo systemctl enable ollama # persist across reboots
# If running manually
ollama serve
Step 2: Check the service status.
systemctl status ollama
# Look for "Active: active (running)"
Step 3: Verify the listen address.
By default, Ollama binds to 127.0.0.1:11434. If you need it accessible from other machines (such as for Open WebUI on another host), set the OLLAMA_HOST environment variable:
# Edit the systemd service override
sudo systemctl edit ollama
# Add these lines:
[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"
Then reload and restart:
sudo systemctl daemon-reload
sudo systemctl restart ollama
Security note: Binding to 0.0.0.0 exposes Ollama to your entire network. The Ollama API has no authentication. Only do this on trusted networks or behind a reverse proxy with authentication.
Step 4: Check for port conflicts.
sudo ss -tlnp | grep 11434
If another process is using the port, either stop it or change the Ollama port via OLLAMA_HOST=127.0.0.1:11435.
Slow Inference
Symptoms
You are getting responses, but at 1-3 tokens per second instead of the expected 20-60+ tokens per second.
Root Cause
Ollama has fallen back to CPU inference, or the model is too large for your GPU VRAM and is being partially offloaded.
Diagnostic Steps
# Check if the model is using GPU layers
ollama ps
# Look at the "processor" column -- it should show "gpu" or a percentage
# Check GPU utilization during inference
watch -n 1 nvidia-smi # NVIDIA
watch -n 1 rocm-smi # AMD
# Check Ollama logs for GPU layer offloading
journalctl -u ollama -n 100 --no-pager | grep -i "gpu\|cuda\|layer"
Fixes
GPU not being used at all:
# Verify CUDA toolkit is installed (NVIDIA)
nvcc --version
nvidia-smi
# Verify ROCm is installed (AMD)
rocm-smi
rocminfo | grep "Name:" | head -5
If nvidia-smi shows your GPU but Ollama is not using it, reinstall Ollama. The install script detects GPU drivers at install time:
curl -fsSL https://ollama.com/install.sh | sh
Partial GPU offload (model too big for VRAM):
When a model exceeds VRAM, Ollama splits layers between GPU and CPU. This is slower than full GPU but faster than pure CPU. You can control this:
# Force all layers to GPU (will fail if VRAM is insufficient)
OLLAMA_NUM_GPU=999 ollama run llama3.1:8b
# Force CPU only (useful for debugging)
OLLAMA_NUM_GPU=0 ollama run llama3.1:8b
Disk I/O bottleneck:
Models are memory-mapped from disk on first load. If your models are on a spinning HDD, initial load and cold inference will be slow.
# Check where models are stored
ls -la ~/.ollama/models/
# Check disk type
lsblk -d -o NAME,ROTA
# ROTA=1 means rotational (HDD), ROTA=0 means SSD/NVMe
Move your model storage to an NVMe drive if possible:
# Move models to faster storage
sudo systemctl stop ollama
mv ~/.ollama /fast-nvme-drive/ollama
ln -s /fast-nvme-drive/ollama ~/.ollama
sudo systemctl start ollama
Model Download Failures
Symptoms
Error: pull model manifest: Get "https://registry.ollama.com/...": dial tcp: lookup registry.ollama.com: no such host
Error: unexpected EOF
Fixes
Network issues:
# Test connectivity to the Ollama registry
curl -I https://registry.ollama.com/v2/
# Check DNS resolution
nslookup registry.ollama.com
Disk space:
# Model downloads go to ~/.ollama
df -h ~/.ollama
# Check current model storage usage
du -sh ~/.ollama/models/
Models require roughly 2x their final size during download (compressed download plus extracted files). A 4.7 GB model may need 10 GB of free space.
Partial downloads and cache corruption:
If a download was interrupted, Ollama may leave partial files. Clear the cache and retry:
# Remove incomplete downloads
rm -rf ~/.ollama/models/blobs/sha256-*-partial
# Or remove a specific model entirely and re-pull
ollama rm llama3.1:8b
ollama pull llama3.1:8b
Proxy/firewall issues:
# If behind a proxy
export HTTPS_PROXY=http://proxy.corp:8080
export HTTP_PROXY=http://proxy.corp:8080
# For the systemd service
sudo systemctl edit ollama
# Add:
[Service]
Environment="HTTPS_PROXY=http://proxy.corp:8080"
Context Length Exceeded
Symptoms
Error: context length exceeded
Or the model silently truncates input and produces nonsensical output.
Root Cause
Every model has a maximum context window. If your prompt plus conversation history exceeds this limit, inference fails or degrades.
Fixes
Increase the context size at runtime:
# Set context length to 8192 tokens
ollama run llama3.1:8b --num-ctx 8192
# Via API
curl http://localhost:11434/api/generate -d '{
"model": "llama3.1:8b",
"prompt": "your prompt here",
"options": { "num_ctx": 8192 }
}'
Caution: Larger context windows consume more memory. Doubling num_ctx roughly doubles the KV cache memory requirement. On a GPU with 8 GB VRAM, setting num_ctx to 32768 on a 7B model may push you into CPU offloading territory.
| Model | Default Context | Max Context | VRAM at Max Context |
|---|---|---|---|
| Llama 3.1 8B | 2048 | 131072 | ~50 GB |
| Mistral 7B | 2048 | 32768 | ~12 GB |
| Phi-3 Mini | 2048 | 128000 | ~45 GB |
Create a Modelfile for persistent configuration:
FROM llama3.1:8b
PARAMETER num_ctx 16384
ollama create llama3.1-16k -f Modelfile
ollama run llama3.1-16k
GPU Not Detected
Symptoms
Ollama runs but uses CPU only. ollama ps shows no GPU layers.
Diagnostic Commands
# NVIDIA: verify driver is loaded
nvidia-smi
cat /proc/driver/nvidia/version
# AMD: verify ROCm
rocm-smi
rocminfo
# Check if Ollama sees the GPU
journalctl -u ollama | grep -i "gpu\|cuda\|rocm\|metal"
Fixes for NVIDIA
# Install/update NVIDIA drivers
sudo apt update
sudo apt install nvidia-driver-550 # or latest available
# Verify CUDA compatibility
nvidia-smi # shows CUDA version supported by driver
# If running in Docker, install NVIDIA Container Toolkit
sudo apt install nvidia-container-toolkit
sudo systemctl restart docker
After installing drivers, reinstall Ollama so it detects the GPU at install time:
curl -fsSL https://ollama.com/install.sh | sh
sudo systemctl restart ollama
Fixes for AMD
# Install ROCm (Debian/Ubuntu)
sudo apt install rocm-hip-runtime rocm-opencl-runtime
# Add user to required groups
sudo usermod -aG video $USER
sudo usermod -aG render $USER
# Log out and back in
# Verify
rocm-smi
Permission Errors
Symptoms
Error: listen tcp 127.0.0.1:11434: bind: permission denied
Error: open /home/user/.ollama/models: permission denied
Fixes
Socket/port permissions:
Ports below 1024 require root. Ollama’s default port (11434) does not require root, but if another process has locked the port or the user lacks permissions:
# Check who owns the Ollama data directory
ls -la ~/.ollama/
# Fix ownership if wrong
sudo chown -R $USER:$USER ~/.ollama/
# If running as systemd service, check the service user
grep -i "user" /etc/systemd/system/ollama.service
Systemd service user:
The default Ollama systemd service runs as the ollama user. If you installed models as your own user, there may be a permissions mismatch:
# Option 1: Fix permissions for the ollama user
sudo chown -R ollama:ollama /usr/share/ollama/.ollama/
# Option 2: Change the service to run as your user
sudo systemctl edit ollama
# Add:
[Service]
User=your-username
Group membership (GPU access):
# NVIDIA
sudo usermod -aG video $USER
# AMD ROCm
sudo usermod -aG video $USER
sudo usermod -aG render $USER
# Apply without logout
newgrp video
Models Loading Slowly
Symptoms
The first prompt after starting Ollama or switching models takes 30+ seconds before any tokens appear.
Root Cause
Ollama memory-maps model files from disk. On the first load, the OS reads the model into memory. Subsequent loads use the page cache and are faster.
Fixes
# Check your disk speed
sudo hdparm -t /dev/sda # HDD/SSD
sudo hdparm -t /dev/nvme0n1 # NVMe
# Typical speeds:
# HDD: ~150 MB/s (30s to load a 4.7 GB model)
# SATA SSD: ~550 MB/s (9s)
# NVMe: ~3500 MB/s (1.3s)
Keep models loaded in memory:
# Set keep-alive to prevent model unloading (default is 5 minutes)
curl http://localhost:11434/api/generate -d '{
"model": "llama3.1:8b",
"keep_alive": -1
}'
Setting keep_alive to -1 keeps the model in memory indefinitely. This eliminates reload latency but means that memory is not freed for other models.
Preload a model at boot:
# Add to a startup script or cron @reboot
curl -s http://localhost:11434/api/generate -d '{"model":"llama3.1:8b","keep_alive":-1}' > /dev/null
General Diagnostic Workflow
When none of the above sections match your issue, follow this sequence:
# 1. Check service status
systemctl status ollama
# 2. Read recent logs
journalctl -u ollama -n 100 --no-pager
# 3. Check system resources
free -h
df -h ~/.ollama
nvidia-smi # if NVIDIA GPU
# 4. Test the API directly
curl http://localhost:11434/api/version
curl http://localhost:11434/api/tags
# 5. Try a minimal model to isolate the issue
ollama run tinyllama "hello"
# 6. Check Ollama version (update if outdated)
ollama --version
curl -fsSL https://ollama.com/install.sh | sh # update to latest
Most Ollama issues fall into three buckets: insufficient resources (memory/disk), missing drivers (GPU), or service configuration (systemd/networking). Start with the logs, check your resources, and work from there.
