[GH-ISSUE #13230] ollama serve causes ollama ps to always return empty results #34507

Closed
opened 2026-04-22 18:07:51 -05:00 by GiteaMirror · 8 comments
Owner

Originally created by @anderscui on GitHub (Nov 24, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/13230

What is the issue?

When ollama serve is running, the command ollama ps always returns an empty list, regardless of whether OLLAMA_KEEP_ALIVE is set. After stopping ollama serve, ollama ps immediately shows the expected running model instances again.

Issue 1: Without serve → model appears; With serve → model disappears

Steps to reproduce

  1. Do NOT run ollama serve.

  2. Run a generation request:

curl http://localhost:11434/api/generate -d '{
  "model": "deepseek-r1:1.5b",
  "prompt": "hello world"
}'
  1. ollama ps shows:
NAME                ID              SIZE      PROCESSOR    CONTEXT    UNTIL
deepseek-r1:1.5b    e0979632db5a    2.8 GB    100% GPU     32768      4 minutes from now
  1. Then run:
export OLLAMA_KEEP_ALIVE=30m
ollama serve
  1. Run ollama ps again → returns empty result

  2. Stop ollama serve → run ollama ps → the record reappears

Issue 2: With serve running, requests produce no visible instances.

Steps to reproduce

Similar to Issue 1: first run ollama serve, then run the above curl command, ollama ps shows empty result. Stop ollama serve → run ollama ps → the record appears.

Relevant log output


OS

macOS

GPU

Intel

CPU

Apple

Ollama version

0.13.0

Originally created by @anderscui on GitHub (Nov 24, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/13230 ### What is the issue? When `ollama serve` is running, the command `ollama ps` always returns an empty list, regardless of whether `OLLAMA_KEEP_ALIVE` is set. After stopping `ollama serve`, `ollama ps` immediately shows the expected running model instances again. ### Issue 1: Without serve → model appears; With serve → model disappears **Steps to reproduce** 1. Do NOT run `ollama serve`. 2. Run a generation request: ```bash curl http://localhost:11434/api/generate -d '{ "model": "deepseek-r1:1.5b", "prompt": "hello world" }' ``` 3. `ollama ps` shows: ```bash NAME ID SIZE PROCESSOR CONTEXT UNTIL deepseek-r1:1.5b e0979632db5a 2.8 GB 100% GPU 32768 4 minutes from now ``` 4. Then run: ```bash export OLLAMA_KEEP_ALIVE=30m ollama serve ``` 5. Run ollama ps again → returns empty result 6. Stop ollama serve → run ollama ps → the record reappears ### Issue 2: With serve running, requests produce no visible instances. **Steps to reproduce** Similar to Issue 1: first run `ollama serve`, then run the above curl command, `ollama ps` shows empty result. Stop ollama serve → run ollama ps → the record appears. ### Relevant log output ```shell ``` ### OS macOS ### GPU Intel ### CPU Apple ### Ollama version 0.13.0
GiteaMirror added the bug label 2026-04-22 18:07:51 -05:00
Author
Owner

@rick-github commented on GitHub (Nov 24, 2025):

What's the output of ps ax | grep -i [o]llama at the different steps of your test?

<!-- gh-comment-id:3571937955 --> @rick-github commented on GitHub (Nov 24, 2025): What's the output of `ps ax | grep -i [o]llama` at the different steps of your test?
Author
Owner

@anderscui commented on GitHub (Nov 24, 2025):

@rick-github

Before ollama serve:

 1840   ??  S      0:04.48 /Applications/Ollama.app/Contents/MacOS/Ollama hidden
12681   ??  S      0:00.89 /Applications/Ollama.app/Contents/Resources/ollama runner --model ~/.ollama/models/blobs/sha256-aabd4debf0c8f08881923f2c25fc0fdeed24435271c2b3e92c4af36704040dbc --port 50593
92012   ??  S      0:03.27 /Applications/Ollama.app/Contents/Resources/ollama serve

After:

 1840   ??  S      0:04.49 /Applications/Ollama.app/Contents/MacOS/Ollama hidden
12681   ??  S      0:00.89 /Applications/Ollama.app/Contents/Resources/ollama runner --model ~/.ollama/models/blobs/sha256-aabd4debf0c8f08881923f2c25fc0fdeed24435271c2b3e92c4af36704040dbc --port 50593
92012   ??  S      0:03.27 /Applications/Ollama.app/Contents/Resources/ollama serve
13142 s004  S+     0:00.04 ollama serve
<!-- gh-comment-id:3571997218 --> @anderscui commented on GitHub (Nov 24, 2025): @rick-github Before `ollama serve`: ```bash 1840 ?? S 0:04.48 /Applications/Ollama.app/Contents/MacOS/Ollama hidden 12681 ?? S 0:00.89 /Applications/Ollama.app/Contents/Resources/ollama runner --model ~/.ollama/models/blobs/sha256-aabd4debf0c8f08881923f2c25fc0fdeed24435271c2b3e92c4af36704040dbc --port 50593 92012 ?? S 0:03.27 /Applications/Ollama.app/Contents/Resources/ollama serve ``` After: ```bash 1840 ?? S 0:04.49 /Applications/Ollama.app/Contents/MacOS/Ollama hidden 12681 ?? S 0:00.89 /Applications/Ollama.app/Contents/Resources/ollama runner --model ~/.ollama/models/blobs/sha256-aabd4debf0c8f08881923f2c25fc0fdeed24435271c2b3e92c4af36704040dbc --port 50593 92012 ?? S 0:03.27 /Applications/Ollama.app/Contents/Resources/ollama serve 13142 s004 S+ 0:00.04 ollama serve ```
Author
Owner

@rick-github commented on GitHub (Nov 24, 2025):

You are running multiple servers. When you start a new one, it becomes the one that the client connects to. Since it's not running a model, ollama ps returns no results. When you stop it, ollama ps is connecting to the previously started server which has a loaded model and so ollama ps shows that model running.

<!-- gh-comment-id:3572157834 --> @rick-github commented on GitHub (Nov 24, 2025): You are running multiple servers. When you start a new one, it becomes the one that the client connects to. Since it's not running a model, `ollama ps` returns no results. When you stop it, `ollama ps` is connecting to the previously started server which has a loaded model and so `ollama ps` shows that model running.
Author
Owner

@pdevine commented on GitHub (Nov 25, 2025):

I'll go ahead and close the issue as answered (ty @rick-github !).

<!-- gh-comment-id:3573405722 --> @pdevine commented on GitHub (Nov 25, 2025): I'll go ahead and close the issue as answered (ty @rick-github !).
Author
Owner

@anderscui commented on GitHub (Nov 25, 2025):

@rick-github So how to set a global OLLAMA_KEEP_ALIVE, and how to use ollama serve correctly? The first serve is started automatically.

<!-- gh-comment-id:3573427799 --> @anderscui commented on GitHub (Nov 25, 2025): @rick-github So how to set a global OLLAMA_KEEP_ALIVE, and how to use `ollama serve` correctly? The first `serve` is started automatically.
Author
Owner

@anderscui commented on GitHub (Nov 25, 2025):

@rick-github , maybe we can use the following methods:

Method 1:

stop all ollama related processes, including ollama GUI app, then

export OLLAMA_KEEP_ALIVE=60m
ollama ps

This will start the GUI app and a new /Applications/Ollama.app/Contents/Resources/ollama serve process, and its keep_alive value is also set, but ollama serve is not usable, as this issue says.

Method 2:

stop all ollama related processes, including ollama GUI app, then

export OLLAMA_KEEP_ALIVE=60m
ollama serve

This will start ollama serve(which is useful for debugging), and its keep_alive value is also set correctly, but the GUI app is not useable.

Conclusion

Now I understand the design, but it seems not very intuitive.

<!-- gh-comment-id:3575439003 --> @anderscui commented on GitHub (Nov 25, 2025): @rick-github , maybe we can use the following methods: ### Method 1: stop all ollama related processes, including ollama GUI app, then ```bash export OLLAMA_KEEP_ALIVE=60m ollama ps ``` This will start the GUI app and a new `/Applications/Ollama.app/Contents/Resources/ollama serve` process, and its keep_alive value is also set, but `ollama serve` is not usable, as this issue says. ### Method 2: stop all ollama related processes, including ollama GUI app, then ```bash export OLLAMA_KEEP_ALIVE=60m ollama serve ``` This will start `ollama serve`(which is useful for debugging), and its keep_alive value is also set correctly, but the GUI app is not useable. ### Conclusion Now I understand the design, but it seems not very intuitive.
Author
Owner
<!-- gh-comment-id:3575449741 --> @rick-github commented on GitHub (Nov 25, 2025): https://github.com/ollama/ollama/blob/main/docs/faq.mdx#setting-environment-variables-on-mac
Author
Owner

@anderscui commented on GitHub (Nov 25, 2025):

@rick-github Thanks a lot.

<!-- gh-comment-id:3575468771 --> @anderscui commented on GitHub (Nov 25, 2025): @rick-github Thanks a lot.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#34507