[PR #13797] [MERGED] imagegen: respect OLLAMA_MODELS for manifests and blobs #45642

Closed
opened 2026-04-25 01:18:06 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/13797
Author: @next-n
Created: 1/20/2026
Status: Merged
Merged: 1/20/2026
Merged by: @jmorganca

Base: mainHead: fix-imagegen-ollama-models


📝 Commits (1)

  • 5c97789 imagegen: respect OLLAMA_MODELS for manifests and blobs

📊 Changes

2 files changed (+33 additions, -22 deletions)

View changed files

📝 x/imagegen/manifest.go (+7 -22)
x/imagegen/manifest_test.go (+26 -0)

📄 Description

Image generation previously resolved manifests and blobs using a hard-coded
path based on $HOME (e.g., $HOME/.ollama/models). When OLLAMA_MODELS is
overridden (for example under systemd with a custom models dir), the image
runner would still fall back to the default path, leading to failures
like:

open /usr/share/ollama/.ollama/models/manifests/...: no such file

This change updates imagegen to use envconfig.Models(), aligning it with
classic model behavior so that OLLAMA_MODELS is correctly respected
for both manifests and blobs.

A regression test is included that simulates a packaged/systemd
environment (HOME=/usr/share/ollama) and asserts the correct paths.

Fixes: #13795


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/13797 **Author:** [@next-n](https://github.com/next-n) **Created:** 1/20/2026 **Status:** ✅ Merged **Merged:** 1/20/2026 **Merged by:** [@jmorganca](https://github.com/jmorganca) **Base:** `main` ← **Head:** `fix-imagegen-ollama-models` --- ### 📝 Commits (1) - [`5c97789`](https://github.com/ollama/ollama/commit/5c97789a4c21b984853cf258e55034515ea84ad1) imagegen: respect OLLAMA_MODELS for manifests and blobs ### 📊 Changes **2 files changed** (+33 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `x/imagegen/manifest.go` (+7 -22) ➕ `x/imagegen/manifest_test.go` (+26 -0) </details> ### 📄 Description Image generation previously resolved manifests and blobs using a hard-coded path based on $HOME (e.g., $HOME/.ollama/models). When OLLAMA_MODELS is overridden (for example under systemd with a custom models dir), the image runner would still fall back to the default path, leading to failures like: open /usr/share/ollama/.ollama/models/manifests/...: no such file This change updates imagegen to use envconfig.Models(), aligning it with classic model behavior so that OLLAMA_MODELS is correctly respected for both manifests and blobs. A regression test is included that simulates a packaged/systemd environment (HOME=/usr/share/ollama) and asserts the correct paths. Fixes: #13795 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-25 01:18:06 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#45642