22 KiB
OpenCode + Ollama Setup Summary
Machine: KingDezigns-AI-001 Originally written: September 14, 2026 Last Updated: September 19, 2026
What changed on 2026-09-19 (fast summary): Ollama was upgraded from v0.17.5 to v0.34.2 (required to pull the
qwen3.6models), which exposed a Vulkan regression on this machine's Radeon 780M, so Ollama is now pinned to v0.32.9. A duplicate context-length setting was fixed (effective context is now 32768, was silently 16384), KV-cache quantization and an iGPU-enable override were added, and a backup/restore script (~/ollama-safe.sh) was created. Kilo Code was evaluated and removed. Full detail in the sections below; the current known-good state is summarized in "Current Known-Good State."
🛟 Quick Reference — Backup and Rollback (read this first)
Before ANY Ollama change (update, downgrade, config edit), take a backup:
~/ollama-safe.sh backup # asks for sudo; takes a minute; ~3.9 GB each
~/ollama-safe.sh list # confirm the new backup appears
Wait for the line Backed up Ollama v<version> to ~/ollama-backups/<timestamp>-v<version> before changing anything.
If something breaks, roll back to a specific backup (recommended):
~/ollama-safe.sh list # find the directory name you want
~/ollama-safe.sh restore ~/ollama-backups/<directory-name> # restore that exact state
Plain ~/ollama-safe.sh restore (no directory) restores the newest
backup by name — usually the state you are trying to get away from — so
always pass the directory when rolling back to an older version.
What restore does: stops Ollama, puts back the saved binary, the bundled libraries (including Vulkan), the service file and all drop-in config files, reloads systemd, restarts Ollama, and prints the version and model list. It does not touch downloaded model files.
After any restore, verify:
ollama --version # expect the version you restored
ollama list # all models still listed
systemctl show ollama -p Environment --no-pager | tr ' ' '\n' | grep -i -E "kv_cache|context|igpu|vulkan"
ollama run gpt-oss:20b "say hi" && ollama ps # expect 100% GPU
Which backup to restore:
| Goal | Restore this |
|---|---|
| Back to the original working setup (Ollama v0.17.5, no qwen3.6 support) | ~/ollama-backups/20260918-233357-v0.17.5 |
| Back to v0.34.2 (has the Vulkan regression for large models — not recommended) | ~/ollama-backups/20260919-204850-v0.34.2 |
| Back to the current working state (v0.32.9) | ~/ollama-backups/20260919-205838-v0.32.9 |
The script lives at ~/ollama-safe.sh. If it is ever lost, it can be
recreated; see "Backup and Restore Script" below for what it backs up.
Hardware
GMKtec NucBox K8 Plus — Linux Mint 22.3 (Cinnamon), kernel 6.8.0-139-generic
| Component | Details |
|---|---|
| CPU/APU | AMD Ryzen 7 8845HS w/ Radeon 780M Graphics (8 cores) |
| GPU | Radeon 780M integrated (RDNA3, gfx1103) — not on AMD's official ROCm support list |
| RAM | 29.6 GB unified (shared CPU/iGPU) |
| GPU memory Ollama can actually use | ~17.1 GiB total / ~16.3 GiB available as reported by Ollama's Vulkan discovery (Vulkan0, AMD Radeon 780M, RADV PHOENIX) |
| Storage | ~1 TB (NVMe, /dev/nvme0n1p5 root, ~768 GB, ~42% used on 2026-09-19) |
The ~16.3 GiB GPU budget is the number that decides which models run fully on the GPU. In practice: models of roughly 15 GB or less load at 100% GPU; models of 17 GB or more need a CPU/GPU split (see "Model Findings").
Original Problem
OpenCode (AI coding agent) + Ollama + qwen3.5:9b would generate tool calls (file creation, shell commands) but only print them as text instead of actually executing them — nothing got created on disk.
Fixes and Build (original, 2026-09-14)
-
Ollama pinned to v0.17.5 — a known bug in other versions causes the "tool calls print but don't execute" symptom with qwen3.5 models.
curl -fsSL https://ollama.com/install.sh | OLLAMA_VERSION=0.17.5 shSuperseded 2026-09-19 — Ollama is now pinned to v0.32.9. See "Ollama Version History and Current Pin." Whether the qwen3.5 tool-calling bug still exists on v0.32.9 has not been retested yet (open item).
-
GPU acceleration switched from ROCm to Vulkan — ROCm's runner crashes on the Radeon 780M (gfx1103 unsupported). Forced Ollama onto its Vulkan backend (Mesa RADV driver) via systemd overrides in
/etc/systemd/system/ollama.service.d/(see "Ollama systemd Configuration" for the current file set). Confirmed working viaollama psshowing100% GPU. -
Model —
qwen3.5:9bpulled and confirmed withtools+thinkingcapabilities. Later testing expanded to many other models (see "Model Findings"). -
OpenCode installed — v1.18.31 via the official install script,
~/.opencode/binadded to PATH. -
Provider config —
~/.config/opencode/opencode.jsonpoints OpenCode at Ollama's OpenAI-compatible endpoint (http://localhost:11434/v1) and explicitly marksqwen3.5:9bas tool-capable. -
Global instructions —
~/.config/opencode/AGENTS.mdsets a standing rule so the agent defaults to creating files under/home/rufusking/Documents/workspace/projectswithout being told every time. -
Web access —
opencode web --port 4096starts a local browser UI showing projects/sessions instead of just a terminal. -
Desktop shortcuts — two
.desktoplauncher icons (Start/Stop OpenCode) backed by shell scripts in~/.local/bin/, tracking the server via a PID file so it can be toggled without a terminal.
Network Access Change (2026-09-14)
Goal: reach the OpenCode web UI from another PC on the LAN, while keeping Ollama and all model inference local to this machine only.
What changed
~/.local/bin/opencode-start.sh — the server launch line was updated to bind on all network interfaces instead of just loopback:
# Before
nohup opencode web --port 4096 > "$LOGFILE" 2>&1 &
# After
nohup opencode web --port 4096 --hostname 0.0.0.0 > "$LOGFILE" 2>&1 &
Ollama itself was not touched — it still listens on 127.0.0.1:11434 only (confirmed again in the v0.34.2 server config log on 2026-09-19), so the remote PC cannot call it directly. All inference stays on this machine; the remote PC only talks to the OpenCode web UI, which relays to Ollama locally.
Firewall
sudo ufw allow 4096/tcp
sudo ufw enable
Result — confirmed working
Local access: http://localhost:4096
Network access: http://192.168.100.50:4096
Network access: http://192.168.100.51:4096
Verified reachable from a second PC on the LAN.
⚠️ Outstanding security item
The server log shows:
! OPENCODE_SERVER_PASSWORD is not set; server is unsecured.
Anyone on the LAN who can reach 192.168.100.50:4096 can currently create files and run shell commands on this machine through the web UI — there's no login. Recommended next step: set OPENCODE_SERVER_PASSWORD (check opencode web --help / docs for the exact env var and how OpenCode expects it to be supplied) before treating this as anything beyond a trusted-home-network convenience. Do not port-forward this port to the public internet. Still open as of 2026-09-19.
Ollama Version History and Current Pin (2026-09-19)
| Step | Version | What happened |
|---|---|---|
| Original | v0.17.5 | Pinned on 2026-09-14 to avoid the qwen3.5 tool-call bug. Worked, but ollama pull qwen3.6:35b-a3b failed with a 412 "requires a newer version of Ollama" error. |
| Upgrade | v0.34.2 | Installed via the plain install script. Existing models were all kept (the update does not touch model files). |
| Problem 1 | v0.34.2 | First model run showed 100% CPU — newer Ollama treats integrated GPUs as opt-in. Fixed with OLLAMA_IGPU_ENABLE=1 (see systemd config). After that, discovery logged library=Vulkan ... AMD Radeon 780M Graphics (RADV PHOENIX). |
| Problem 2 | v0.34.2 | Models of ~17 GB and larger (qwen3-coder:30b, GLM-4.7-Flash, qwen3.6:27b, qwen3.6:35b-a3b) crashed on load with radv/amdgpu: Not enough memory for command submission / vk::Queue::submit: ErrorDeviceLost, at any context size. Both qwen3-coder:30b and GLM-4.7-Flash had loaded fine on v0.17.5. Ruled out the KV-cache setting as the cause by removing it and retesting (still crashed). |
| Downgrade | v0.32.9 | Pinned to the last version reported working in an upstream bug report (below). All models loaded, including the four that crashed on v0.34.2. This is the current pin. |
Upstream bug reports matching this failure
- ollama/ollama #17748 — "AMD Radeon 780M Vulkan regression in Ollama >=0.32.10": larger models fail on a 780M with the same error text; downgrading to 0.32.9 with the same hardware/model/config restores it; small models keep working on the GPU. The reporter's env vars match this machine's (Vulkan, iGPU enable, flash attention, q8_0 KV cache).
- ollama/ollama #18272 — related report on an AMD iGPU with a very large model; says the failure appeared from v0.32.12 and suggests the newer llama.cpp Vulkan backend changed memory allocation on iGPUs.
- ggml-org/llama.cpp #27360 — on a Radeon 680M, a change to the default iGPU model-loading path looks like a possible cause; adding
--load-mode mmapfixed it there. Unconfirmed upstream, and it is not known whether Ollama exposes an equivalent setting. Watch these threads for a fix in a newer Ollama release.
Current pin — how to install/re-install the correct version
curl -fsSL https://ollama.com/install.sh | OLLAMA_VERSION=0.32.9 sh
⚠️ Do NOT re-run the plain
curl ... | shinstall script without theOLLAMA_VERSION=0.32.9prefix — it installs the latest version and brings the Vulkan regression back. The installer also always downloads ROCm libraries and prints "AMD GPU ready"; that message is misleading on this machine (gfx1103 is unsupported by ROCm — Vulkan is what actually runs).
Verify after any install:
ollama --version # expect 0.32.9
ollama list # all models still present
systemctl show ollama -p Environment --no-pager | tr ' ' '\n' | grep -i -E "kv_cache|context|igpu|vulkan"
ollama run gpt-oss:20b "say hi" && ollama ps # expect 100% GPU
Ollama systemd Configuration
Ollama runs as a systemd service. Environment settings live in drop-in files
in /etc/systemd/system/ollama.service.d/. Systemd applies drop-ins in
filename order and a later file overrides an earlier one for the same
variable.
| File | Contents |
|---|---|
context.conf |
OLLAMA_CONTEXT_LENGTH=32768 |
vulkan.conf |
OLLAMA_VULKAN=1, GGML_VK_VISIBLE_DEVICES=0, LD_LIBRARY_PATH=/usr/local/lib/ollama/vulkan:/usr/local/lib/ollama, OLLAMA_FLASH_ATTENTION=1, OLLAMA_KEEP_ALIVE=10m |
override.conf |
OLLAMA_IGPU_ENABLE=1 (added 2026-09-19 — required on newer Ollama, which treats iGPUs as opt-in) |
kvcache.conf |
OLLAMA_KV_CACHE_TYPE=q8_0 (added 2026-09-19 — roughly halves KV-cache memory; requires flash attention, already on) |
Other facts confirmed from the server config log: Ollama listens on
127.0.0.1:11434; models are stored at /usr/share/ollama/.ollama/models;
OLLAMA_NUM_PARALLEL is 1.
Duplicate context-length bug (fixed 2026-09-19)
vulkan.conf originally also contained Environment="OLLAMA_CONTEXT_LENGTH=16384".
Because vulkan.conf loads after context.conf, the effective context was
16384, not 32768 — meaning all earlier model tests ran at 16K, not 32K.
Fixed by deleting that line from vulkan.conf:
sudo sed -i '/OLLAMA_CONTEXT_LENGTH/d' /etc/systemd/system/ollama.service.d/vulkan.conf
sudo systemctl daemon-reload && sudo systemctl restart ollama
Effective value is now confirmed 32768. To check any time:
systemctl show ollama -p Environment --no-pager | tr ' ' '\n' | grep -i context
ollama ps also shows the context per loaded model. Note that the OpenCode
path goes through Ollama's OpenAI-compatible endpoint, so it uses this
global setting — a per-request num_ctx override only works when calling
Ollama's native API directly (used for the tests below).
Reading ollama ps
PROCESSOR shows the GPU/CPU split. 100% GPU = fully on the iGPU. A split
like 15%/85% CPU/GPU means part of the model is in system memory (slower).
Blank output right after a request means the load failed — check
journalctl -u ollama --no-pager --since "10 minutes ago".
Backup and Restore Script — ~/ollama-safe.sh
Created 2026-09-19 so an Ollama update can be undone quickly. It backs up the Ollama binary, bundled libraries (including the Vulkan libs), systemd unit and drop-ins, and the model list — but not the model files themselves (a version change does not touch them, and they are many GB).
~/ollama-safe.sh backup # snapshot the current state (do this BEFORE any update)
~/ollama-safe.sh list # show existing backups
~/ollama-safe.sh restore # restore the NEWEST backup (by name)
~/ollama-safe.sh restore <backup-dir> # restore a specific backup
- Backups go to
~/ollama-backups/<timestamp>-v<version>/. - Each backup is ~3.9 GB (mostly
lib.tgz, the bundled GPU libraries) and asks forsudo. - Gotcha: plain
restoreuses the newest backup, which is usually the state you are trying to get away from. To go back to a specific version, pass its directory explicitly. - The script file needed
sudo chown $USER:$USER ~/ollama-safe.sh+chmod +xafter creation because it was originally created root-owned. - It saves
manifests.tgzonly if models are in a standard location; here the models path did not match its defaults, so that file is absent from backups (harmless — model files are not touched by version changes).
Existing backups (as of 2026-09-19)
| Backup directory | Contains | Use |
|---|---|---|
20260918-233357-v0.17.5 |
Original working state | Full rollback to the original v0.17.5 setup (note: qwen3.6 cannot be pulled/run on it) |
20260919-202238-v0.34.2 |
v0.34.2 with context fix applied | Only needed to return to v0.34.2 |
20260919-204850-v0.34.2 |
v0.34.2 with context fix + KV cache config | Only needed to return to v0.34.2 |
20260919-205838-v0.32.9 |
Current working state — v0.32.9 with all settings (context 32768, KV cache q8_0, iGPU enable, Vulkan) | The one to restore to if a future change breaks things |
The two v0.34.2 backups can be deleted to reclaim ~8 GB once v0.32.9 has
proven itself (rm -rf ~/ollama-backups/20260919-202238-v0.34.2 ~/ollama-backups/20260919-204850-v0.34.2). Keep the v0.17.5 backup as the
original known-good state until the 7-test round is finished.
To return to the original v0.17.5 setup:
~/ollama-safe.sh restore ~/ollama-backups/20260918-233357-v0.17.5
Model Findings
Memory rules of thumb (this machine)
-
Usable GPU memory ≈ 16.3 GiB. Weights plus KV cache must fit.
-
Context size drives KV-cache size. With
OLLAMA_KV_CACHE_TYPE=q8_0the cache is roughly half the size. -
devstral:24b(14 GB weights) measurements on v0.34.2 to find the limit:KV cache Context Result default 8192 15 GB loaded, 100% GPU default 16384 17 GB, 5% CPU / 95% GPU default 24576 crash (out of memory) q8_0 24576 16 GB, 100% GPU q8_0 32768 17 GB, 5% CPU / 95% GPU -
On v0.34.2, models that don't fit crash instead of splitting gracefully. On v0.32.9 the split works (below).
Current results on v0.32.9 (load test, num_ctx=16384, prompt "say hi")
| Model | Loaded size | Processor |
|---|---|---|
qwen3-coder:30b |
19 GB | 15% CPU / 85% GPU |
qwen3.6:35b-a3b |
22 GB | 30% CPU / 70% GPU |
qwen3.6:27b |
18 GB | 17% CPU / 83% GPU |
devstral:24b |
15 GB | 100% GPU |
gpt-oss:20b |
12 GB | 100% GPU |
gpt-oss:20b also loaded at the global 32768 context on v0.34.2 with
100% GPU. Not yet tested on v0.32.9 at 32768 for the larger models — open
item. The qwen3.6 and gpt-oss models return "thinking" output, so replies
take longer than raw token speed suggests.
Original 7-test results (on v0.17.5, effective context 16384)
Only gpt-oss:20b came close to completing all 7 tests. The goal is a
model that codes reliably and completes assigned work.
| Model | Pulled | Size | Time |
|---|---|---|---|
| qwen2.5-coder:7b | Y | 4.7 GB | 0m 2.4s |
| qwen2.5-coder:14b | Y | 9.0 GB | 1m 40s |
| ministral-3:14b | Y | 9.1 GB | 1m 36s |
| gpt-oss:20b | Y | 13 GB | 0m 39.9s |
| devstral:24b | removed at the time | 14 GB | n/a |
| qwen3-coder:30b | Y | 18 GB | 1m 20s |
| GLM-4.7-Flash | Y | 19 GB | 0m 24s |
| qwen2.5-coder:32b | Y | 20 GB | ERROR |
Working theory (not proven): the qwen2.5-coder models are built for
fill-in-the-middle autocomplete rather than the read-file / edit-file tool
loop an agent runs, which is why they struggle in OpenCode.
Models currently pulled
qwen3.6:27b, qwen3.6:35b-a3b, devstral:24b, granite-code:20b-instruct,
qwen2.5-coder:32b, ministral-3:14b, GLM-4.7-Flash, gpt-oss:20b,
qwen2.5-coder:14b, qwen2.5-coder:7b, qwen2.5:7b, qwen3.5:27b,
qwen2.5:14b, qwen3-coder:30b, qwen3.5:9b.
Next round of testing (not yet done)
Run the 7 tests in the OpenCode web UI on v0.32.9, in this order, and record time + pass/fail + what broke:
devstral:24b(only local coder with a published agentic benchmark — 46.8% SWE-Bench Verified per a third-party guide; 100% GPU)qwen3.6:27bqwen3.6:35b-a3b(MoE, ~3B active parameters — expected to tolerate the CPU spill best)gpt-oss:20bas the baseline- One file-creation task with
qwen3.5:9bto check whether the original tool-calling bug (the reason for the v0.17.5 pin) still exists on v0.32.9
Kilo Code Evaluation (2026-09-19) — Tried and Removed
Kilo Code was tried as a more polished alternative to OpenCode's web UI. Summary of what was learned (nothing from Kilo remains installed):
- Kilo's CLI is built on the OpenCode codebase, so its engine is similar.
- Installed via npm after fixing a global-install permission error by giving
npm a user-owned prefix:
npm config set prefix ~/.npm-globalwith~/.npm-global/binadded to PATH in~/.bashrc. That npm prefix change is still in place and is harmless — futurenpm install -gworks without sudo. - Version 7.7.5 had no
kilo webcommand (kilo webwas misread as a project folder). The only browser UI waskilo console, which is marked deprecated ("will be removed in a future release"). The server returned pages correctly (verified withcurl), but the console did not work in the browser (blank page after sign-in), so it was abandoned. - Removed with
kilo daemon stop,kilo uninstall, andnpm uninstall -g @kilocode/cli, then verified withpgrep,which, andss(nothing left). - Options identified but not tried: running the Kilo VS Code extension
inside
code-server(a locally hosted browser IDE), or OpenHands' Agent Canvas. OpenCode's web UI was kept as the daily driver.
Current Known-Good State (2026-09-19)
- Ollama: v0.32.9 (pinned — do not run the plain installer).
- Backend: Vulkan (RADV) on the Radeon 780M, ~16.3 GiB usable.
- Effective settings: context 32768, KV cache q8_0, flash attention on, keep-alive 10 min, iGPU enabled.
- Verified loading:
qwen3-coder:30b,qwen3.6:35b-a3b,qwen3.6:27b,devstral:24b,gpt-oss:20b(at 16384 on v0.32.9). - Agent front end: OpenCode v1.18.31, web UI on port 4096 (still no server password).
- Rollback tool:
~/ollama-safe.sh(see above).
Open Items
- Run the 7 tests on
devstral:24b,qwen3.6:27b,qwen3.6:35b-a3band record results (see "Next round of testing"). - Retest
qwen3.5:9btool calling on v0.32.9 (the original reason for the v0.17.5 pin). - Verify the larger models load at the global 32768 context on v0.32.9 (only tested at 16384); lower the global context if they crash.
- Watch ollama/ollama #17748 and #18272 for a fix before moving past v0.32.9.
- Set
OPENCODE_SERVER_PASSWORDfor the OpenCode web UI (still unset). - Other project docs (
network_index.md,vlan1_infrastructure.md) still describe Ollama as "pinned to v0.17.5" — update to v0.32.9 when convenient.
(Done 2026-09-19: v0.32.9 state backed up as 20260919-205838-v0.32.9.)
🧠 Summary for AI Systems
- KingDezigns-AI-001 is a local AI coding workstation on VLAN 1 (192.168.100.50/.51): Ryzen 7 8845HS, Radeon 780M iGPU (Vulkan, not ROCm), ~29.6 GB unified RAM, of which ~16.3 GiB is usable by the GPU.
- Ollama is pinned to v0.32.9 (was v0.17.5 originally; briefly v0.34.2). v0.32.10+ has a Vulkan regression on 780M-class iGPUs that crashes models above ~16 GB with
radv/amdgpu: Not enough memory for command submission/ErrorDeviceLost(ollama/ollama #17748, #18272). Never run the unpinned installer: usecurl -fsSL https://ollama.com/install.sh | OLLAMA_VERSION=0.32.9 sh. - The installer always fetches ROCm libs and prints "AMD GPU ready" — misleading here; Vulkan is what runs.
- Config lives in
/etc/systemd/system/ollama.service.d/:context.conf(32768),vulkan.conf,override.conf(OLLAMA_IGPU_ENABLE=1),kvcache.conf(OLLAMA_KV_CACHE_TYPE=q8_0). Drop-ins load in filename order and later files win — a duplicateOLLAMA_CONTEXT_LENGTH=16384invulkan.confhad been silently overriding 32768 and was removed. ~/ollama-safe.sh backup|restore|listsnapshots/restores the Ollama binary, libs, and systemd config (not models). Plainrestoreuses the newest backup; pass a directory to target a specific one. Take a backup before any Ollama change.- Models that fit fully on the GPU: ≤ ~15 GB (
gpt-oss:20b,devstral:24b). Larger models (qwen3-coder:30b,qwen3.6:27b,qwen3.6:35b-a3b) run with a CPU/GPU split on v0.32.9. - Only
gpt-oss:20bcame close to passing all 7 agent tests so far (run on v0.17.5 at effective 16K context);devstral:24b,qwen3.6:27b,qwen3.6:35b-a3bare the next candidates and are untested on the 7-test suite. - OpenCode's web UI (port 4096) still has no server password; Ollama stays loopback-only. Kilo Code was trialed and removed — nothing left installed.
- Not to be confused with KingDezigns001, the separate VLAN 20 admin workstation.