[GH-ISSUE #9648] OLLAMA_NOHISTORY=1 not working as environment variable #6295

Closed
opened 2026-04-12 17:44:27 -05:00 by GiteaMirror · 12 comments
Owner

Originally created by @flyinRyan00 on GitHub (Mar 11, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/9648

What is the issue?

Ollama is running as a system process with systemctrl and I edit the file ollama.service file to add the line Environment="OLLAMA_NOHISTORY=1". I reload the systemctl daemon and restart ollama. However, the user's input history is still saved at 'home/usr/.ollama/history'.

`[Unit]
Description=Ollama Service
After=network-online.target

[Service]
ExecStart=/usr/local/bin/ollama serve
User=ollama
Group=ollama
Restart=always
RestartSec=3
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:>
Environment="OLLAMA_HOST=0.0.0.0"
Environment="OLLAMA_NOHISTORY=1"

[Install]
WantedBy=default.target`

Relevant log output


OS

Linux

GPU

No response

CPU

AMD

Ollama version

0.5.13

Originally created by @flyinRyan00 on GitHub (Mar 11, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/9648 ### What is the issue? Ollama is running as a system process with systemctrl and I edit the file ollama.service file to add the line Environment="OLLAMA_NOHISTORY=1". I reload the systemctl daemon and restart ollama. However, the user's input history is still saved at 'home/usr/.ollama/history'. `[Unit] Description=Ollama Service After=network-online.target [Service] ExecStart=/usr/local/bin/ollama serve User=ollama Group=ollama Restart=always RestartSec=3 Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:> Environment="OLLAMA_HOST=0.0.0.0" Environment="OLLAMA_NOHISTORY=1" [Install] WantedBy=default.target` ### Relevant log output ```shell ``` ### OS Linux ### GPU _No response_ ### CPU AMD ### Ollama version 0.5.13
GiteaMirror added the bug label 2026-04-12 17:44:27 -05:00
Author
Owner

@rick-github commented on GitHub (Mar 11, 2025):

You need to set it in the environment of the client.

OLLAMA_NOHISTORY=1 ollama run model

or

echo export OLLAMA_NOHISTORY=1 >> ~/.bashrc
<!-- gh-comment-id:2713991026 --> @rick-github commented on GitHub (Mar 11, 2025): You need to set it in the environment of the client. ```sh OLLAMA_NOHISTORY=1 ollama run model ``` or ```sh echo export OLLAMA_NOHISTORY=1 >> ~/.bashrc ```
Author
Owner

@flyinRyan00 commented on GitHub (Mar 11, 2025):

That worked! Nice job on Ollama by the way which is awesome - thank you for your hard work!

<!-- gh-comment-id:2714187708 --> @flyinRyan00 commented on GitHub (Mar 11, 2025): That worked! Nice job on Ollama by the way which is awesome - thank you for your hard work!
Author
Owner

@tzelalouzeir commented on GitHub (Oct 6, 2025):

where did you find the env parameters? @rick-github

<!-- gh-comment-id:3371536270 --> @tzelalouzeir commented on GitHub (Oct 6, 2025): where did you find the env parameters? @rick-github
Author
Owner

@rick-github commented on GitHub (Oct 6, 2025):

292767afb4/envconfig/config.go (L272)

<!-- gh-comment-id:3371563151 --> @rick-github commented on GitHub (Oct 6, 2025): https://github.com/ollama/ollama/blob/292767afb48fe4c3acc3233e88a45e5a3f93ffec/envconfig/config.go#L272
Author
Owner

@tzelalouzeir commented on GitHub (Oct 7, 2025):

ollama/envconfig/config.go

Line 272 in 292767a

"OLLAMA_DEBUG": {"OLLAMA_DEBUG", LogLevel(), "Show additional debug information (e.g. OLLAMA_DEBUG=1)"},

Thank you so much.

<!-- gh-comment-id:3375278095 --> @tzelalouzeir commented on GitHub (Oct 7, 2025): > [ollama/envconfig/config.go](https://github.com/ollama/ollama/blob/292767afb48fe4c3acc3233e88a45e5a3f93ffec/envconfig/config.go#L272) > > Line 272 in [292767a](/ollama/ollama/commit/292767afb48fe4c3acc3233e88a45e5a3f93ffec) > > "OLLAMA_DEBUG": {"OLLAMA_DEBUG", LogLevel(), "Show additional debug information (e.g. OLLAMA_DEBUG=1)"}, Thank you so much.
Author
Owner

@steveepreston commented on GitHub (Mar 20, 2026):

will this work?

OLLAMA_NOHISTORY=1 ollama serve

because this logged during serve:

time=2026-03-10T15:01:08.074Z level=INFO source=routes.go:1658 msg="server config" env="... OLLAMA_NOHISTORY:true ..."
<!-- gh-comment-id:4096850705 --> @steveepreston commented on GitHub (Mar 20, 2026): will this work? ```shell OLLAMA_NOHISTORY=1 ollama serve ``` because this logged during serve: ``` time=2026-03-10T15:01:08.074Z level=INFO source=routes.go:1658 msg="server config" env="... OLLAMA_NOHISTORY:true ..." ```
Author
Owner

@steveepreston commented on GitHub (Mar 20, 2026):

OLLAMA_NOHISTORY Should respected from ollama serve too.

Imagine this:

  • You Start ollama serve
  • You run model via Tools like Cline/Roo/Kilo
  • There is no place in Tools to set envs. so, the running instance should respect OLLAMA_NOHISTORY of ollama serve
<!-- gh-comment-id:4096866852 --> @steveepreston commented on GitHub (Mar 20, 2026): `OLLAMA_NOHISTORY` Should respected from `ollama serve` too. Imagine this: - You Start `ollama serve` - You run model via Tools like Cline/Roo/Kilo - There is no place in Tools to set envs. so, the running instance should respect `OLLAMA_NOHISTORY` of `ollama serve`
Author
Owner

@rick-github commented on GitHub (Mar 20, 2026):

No, because it's the client that saves the history.

<!-- gh-comment-id:4096869712 --> @rick-github commented on GitHub (Mar 20, 2026): No, because it's the client that saves the history.
Author
Owner

@rick-github commented on GitHub (Mar 20, 2026):

If you are using Cline/Roo/Kilo, the history file is not updated.

<!-- gh-comment-id:4096874140 --> @rick-github commented on GitHub (Mar 20, 2026): If you are using Cline/Roo/Kilo, the history file is not updated.
Author
Owner

@steveepreston commented on GitHub (Mar 20, 2026):

@rick-github Thanks for note.

1- Can you tell please when Ollama updates history file?
2- Imagine you serve ollama on a server, and clients call models by tools like Cline/Roo/Kilo.
Does Ollama on the server records any of input-prompt/model-output on the server? in Ollama history file or in log files?

<!-- gh-comment-id:4100146159 --> @steveepreston commented on GitHub (Mar 20, 2026): @rick-github Thanks for note. 1- Can you tell please when Ollama updates history file? 2- Imagine you serve ollama on a server, and clients call models by tools like Cline/Roo/Kilo. Does Ollama on the server records any of input-prompt/model-output on the server? in Ollama history file or in log files?
Author
Owner

@rick-github commented on GitHub (Mar 20, 2026):

  1. The ollama client (CLI) updates the history file when the user presses the enter key.
  2. The ollama server will log prompts and generated tokens if OLLAMA_DEBUG=2.
<!-- gh-comment-id:4100208160 --> @rick-github commented on GitHub (Mar 20, 2026): 1. The ollama client (CLI) updates the history file when the user presses the enter key. 2. The ollama server will log prompts and generated tokens if `OLLAMA_DEBUG=2`.
Author
Owner

@steveepreston commented on GitHub (Mar 20, 2026):

@rick-github Thanks for explain

<!-- gh-comment-id:4100724758 --> @steveepreston commented on GitHub (Mar 20, 2026): @rick-github Thanks for explain
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#6295