From 7c44475a37406e7fee804ffe545d7aba8e36da43 Mon Sep 17 00:00:00 2001 From: Ji-Eun Lee Date: Mon, 30 Mar 2026 08:53:22 -0700 Subject: [PATCH] fix(onboard): skip OLLAMA_HOST=0.0.0.0 on WSL2 to fix Docker routing Ollama's Go runtime creates a dual-stack (AF_INET6) socket when given OLLAMA_HOST=0.0.0.0, but WSL2's port relay only forwards IPv4 sockets to the Windows host. Docker's host-gateway cannot reach the dual-stack socket, causing inference requests to fail with connection refused. On WSL2, let Ollama bind to the default 127.0.0.1 instead, which creates an IPv4-only socket that the WSL2 relay forwards correctly. --- bin/lib/onboard.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/lib/onboard.js b/bin/lib/onboard.js index 4d2290ea80a..81aaf07bd33 100644 --- a/bin/lib/onboard.js +++ b/bin/lib/onboard.js @@ -30,6 +30,7 @@ const { const { inferContainerRuntime, isUnsupportedMacosRuntime, + isWsl, shouldPatchCoredns, } = require("./platform"); const { resolveOpenshell } = require("./resolve-openshell"); @@ -2192,7 +2193,11 @@ async function setupNim(gpu) { } else if (selected.key === "ollama") { if (!ollamaRunning) { console.log(" Starting Ollama..."); - run("OLLAMA_HOST=0.0.0.0:11434 ollama serve > /dev/null 2>&1 &", { ignoreError: true }); + // On WSL2, binding to 0.0.0.0 creates a dual-stack socket that Docker + // cannot reach via host-gateway. The default 127.0.0.1 binding works + // because WSL2 relays IPv4-only sockets to the Windows host. + const ollamaEnv = isWsl() ? "" : "OLLAMA_HOST=0.0.0.0:11434 "; + run(`${ollamaEnv}ollama serve > /dev/null 2>&1 &`, { ignoreError: true }); sleep(2); } console.log(" ✓ Using Ollama on localhost:11434"); @@ -2230,6 +2235,7 @@ async function setupNim(gpu) { } break; } else if (selected.key === "install-ollama") { + // macOS only — this option is gated by process.platform === "darwin" above console.log(" Installing Ollama via Homebrew..."); run("brew install ollama", { ignoreError: true }); console.log(" Starting Ollama...");