Ollama: "Error: could not connect to ollama server, run 'ollama serve' to start it"

By MV2 of Munim, Inc., with AI agents. Checked on 5 November 2026 against Ollama's source at release v0.40.14 (3 November 2026) and its Linux install script. For your own machines only.

Short answer: ollama list, ollama pull or ollama run tried the server at OLLAMA_HOST (by default 127.0.0.1:11434) and the connection was refused: nothing is listening there. On macOS and Windows the command then tries to open the Ollama app. On Linux, and so in WSL, it doesn't start anything. It prints this message instead. Find out why the server isn't running, rather than leaving ollama serve open in a terminal forever.

Quick test: curl http://127.0.0.1:11434 prints Ollama is running when a server is up.

1. The systemd service is stopped or keeps failing

The install script sets Ollama up as a service called ollama:

systemctl status ollama
sudo systemctl start ollama
journalctl -u ollama -n 50 --no-pager

The log says why it stopped. If it shows bind: address already in use, another program holds the port: see port 11434 already in use. If the service is disabled, sudo systemctl enable --now ollama starts it now and at every boot.

2. There is no systemd (WSL, containers, a manual install)

If systemctl says the system wasn't booted with systemd, the install script couldn't set up a service, so nothing starts Ollama for you. Either start it yourself in a second terminal (ollama serve), or, in WSL, turn systemd on. Put this in /etc/wsl.conf:

[boot]
systemd=true

Run wsl --shutdown from Windows, open WSL again, and run the Ollama install script once more so it can create and start the service. If Ollama for Windows is also installed, the WSL copy and the Windows copy are two servers that each want port 11434; use one of them.

3. OLLAMA_HOST points somewhere the server isn't

The ollama command uses the same OLLAMA_HOST variable to find the server. Check it with echo $OLLAMA_HOST. If you moved the server to another address or port (a Tailscale IP, say, or 11435), the client needs the same value: OLLAMA_HOST=100.101.102.103:11434 ollama list. If a stale value in ~/.bashrc points at a machine that is off, remove it.

4. Ollama runs in Docker

A host ollama command can reach a container only through a published port. The simplest fix is to run the command inside the container: docker exec -it ollama ollama list. If you do publish the port, publish it to localhost only, -p 127.0.0.1:11434:11434. A plain -p 11434:11434 opens it on every interface, and on Linux Docker's port rules skip ufw (details).

While fixing this, don't set OLLAMA_HOST=0.0.0.0 on the server unless you mean to share it. That opens Ollama's API, which has no login, to every network the machine is on. For access from other devices, see Use Ollama remotely.

Why the message looks like this

In Ollama v0.40.14, commands such as list, pull and run first run checkServerHeartbeat in cmd/cmd.go. If the heartbeat fails with a refused connection, it calls startApp. On anything other than Windows and macOS, startApp lives in cmd/start_default.go and only returns this error. Cobra's CheckErr in main.go prints it with Error: in front.

Check the result

The free local-ai-checkup script shows whether Ollama is running, which address it listens on, and whether other machines can reach it. It's read-only and sends nothing off the machine. Then check the version with the CVE checker.

Want it checked for you?

MV2 of Munim, Inc. does a $49 local AI health check for one machine, or a $199 small-office check for up to 5 machines or one shared Ollama or Open WebUI server. You get a written report of what's exposed, risky or slow and what to fix first, with exact commands for your OS. See a sample report. Pay $49 or pay $199 on Stripe, then email mv2@munimtech.com the output of python3 local_ai_checkup.py --json, your OS, and what you use it for. MV2 never asks for passwords, keys or remote access.