Skip to content

Commit f2ce225

Browse files
committed
[ai] endpoint -> Ollama; firstboot retries instead of premature sentinel
Two bugs that left `mios hello` returning 500s on a fresh install: 1. mios.toml [ai].endpoint pointed at LocalAI (:8080/v1) but [ai].model used Ollama's name:tag format (qwen2.5-coder:7b), which LocalAI does not understand. LocalAI v2.20.0 also chokes on aichat's multimodal content-list request shape with: interface conversion: interface {} is []interface {}, not string The intended chat surface for `mios <prompt>` was always Ollama (the dashboard's `AI http://localhost:8080/v1 qwen2.5-coder:7b` line is the leftover misalignment; that endpoint will route to Ollama once mios-dashboard reads the new value). LocalAI stays in the stack for sidecar surfaces (embeddings, image gen, STT/TTS) -- it just isn't the chat backend. 2. usr/libexec/mios/ollama-firstboot.sh wrote the sentinel /var/lib/mios/.ollama-firstboot-done even when the ollama container was unreachable after the 50-second poll. Symptom 2026-05-11: during the operator's install the ollama container crash-looped on the UID-818 typo (commit 9702d43 fix). firstboot ran during that crash window, timed out polling for the container, wrote the sentinel as if it had succeeded, and the unit's ConditionPathExists=!sentinel permanently blocked any future retry. Result: zero models pulled, /v1/chat/completions served by an empty model list, 500s forever. Exit non-zero on container-unreachable and DO NOT write the sentinel. systemd's Restart= behavior (and the next boot's ConditionPathExists check) then retries until the container actually responds.
1 parent 9702d43 commit f2ce225

2 files changed

Lines changed: 23 additions & 5 deletions

File tree

usr/libexec/mios/ollama-firstboot.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,18 @@ for attempt in 1 2 3 4 5 6 7 8 9 10; do
8484
sleep 5
8585
done
8686
if ! podman exec "$CONTAINER" ollama list >/dev/null 2>&1; then
87-
_log "WARN: $CONTAINER not reachable after 50 s; skipping pull check"
88-
install -d -m 0755 "$(dirname "$SENTINEL")"
89-
touch "$SENTINEL"
90-
exit 0
87+
# Do NOT touch the sentinel here. Earlier revisions did; symptom
88+
# 2026-05-11: if the ollama container crash-looped during first
89+
# boot (e.g. UID mismatch with /var/lib/ollama bind-mount), this
90+
# script gave up after 50 s, wrote the sentinel as if successful,
91+
# and the unit's ConditionPathExists permanently blocked any
92+
# retry. The operator's `mios hello` then hit a chat-completions
93+
# endpoint with zero models loaded and got 500s forever. Exit
94+
# non-zero so systemd's Restart= (or the next boot's
95+
# ConditionPathExists=!sentinel) retries until the container is
96+
# actually reachable.
97+
_log "WARN: $CONTAINER not reachable after 50 s -- exiting non-zero to retry on next start (sentinel NOT written)"
98+
exit 1
9199
fi
92100

93101
failures=0

usr/share/mios/mios.toml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,17 @@ endpoint = "http://localhost:3030/"
392392
enable = true
393393

394394
[ai]
395-
endpoint = "http://localhost:8080/v1"
395+
# Point at Ollama's OpenAI-compatible /v1, NOT LocalAI's. The `model`
396+
# below uses Ollama's name:tag format which Ollama natively understands.
397+
# LocalAI uses different model names and (on 2.20.0) chokes on aichat's
398+
# multimodal content-list format with
399+
# InternalServerError: interface conversion:
400+
# interface {} is []interface {}, not string
401+
# LocalAI stays in the stack for sidecar surfaces (embeddings,
402+
# image gen, STT/TTS); the chat surface `mios <prompt>` drives is
403+
# Ollama. Operator-flagged 2026-05-11 (`mios hello` -> 500 from
404+
# LocalAI before this fix).
405+
endpoint = "http://localhost:11434/v1"
396406
model = "qwen2.5-coder:7b"
397407
embed_model = "nomic-embed-text"
398408
api_key = "" # empty for localhost; cloud needs a key

0 commit comments

Comments
 (0)