[PR #3132] [CLOSED] Fix Execution Error in /tmp with noexec for Issue #2436 #11075

Closed
opened 2026-04-12 23:20:13 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/3132
Author: @jshbmllr
Created: 3/14/2024
Status: Closed

Base: mainHead: main


📝 Commits (1)

  • 600d1c5 Added function to check if system default temp directory is mounted with noexec option

📊 Changes

1 file changed (+27 additions, -1 deletions)

View changed files

📝 gpu/assets.go (+27 -1)

📄 Description

In relation to Issue #2436, which remains unresolved, this pull request introduces a fix similar to the one in PR #2403. The issue arises on Linux systems where the /tmp directory is mounted with the noexec option, preventing the execution of libraries and mirroring the error detailed in the aforementioned issue. Mounting /tmp noexec is a common hardening technique and it's likely that this issue will arise frequently.

For context, a similar issue was litigated by the Golang community here, culminating in this solution.

I've written a function that checks first if the system default temp directory is mounted with the noexec option. If true, it instead writes ollama temp directory to /run/uses/<id>, a directory managed by pam_systemd that will be cleaned when the user signs out. I thought this would be the least intrusive way to address the issue that shouldn't interfere if the user has an alternative $TMPDIR and doesn't require any additional knowledge on the part of the user.

Thank you all for an excellent application. I'm a big fan of Ollama and hope you find this contribution helpful, in line with the spirit with which it is offered.


🔄 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/3132 **Author:** [@jshbmllr](https://github.com/jshbmllr) **Created:** 3/14/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (1) - [`600d1c5`](https://github.com/ollama/ollama/commit/600d1c56d79c72bc4558327520cb5831dc6abf61) Added function to check if system default temp directory is mounted with noexec option ### 📊 Changes **1 file changed** (+27 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `gpu/assets.go` (+27 -1) </details> ### 📄 Description In relation to [Issue #2436](https://github.com/ollama/ollama/issues/2436), which remains unresolved, this pull request introduces a fix similar to the one in [PR #2403](https://github.com/ollama/ollama/pull/2403). The issue arises on Linux systems where the /tmp directory is mounted with the noexec option, preventing the execution of libraries and mirroring the error detailed in the aforementioned issue. Mounting `/tmp` noexec is a [common hardening technique](https://www.stigviewer.com/stig/red_hat_enterprise_linux_8/2022-12-06/finding/V-230513) and it's likely that this issue will arise frequently. For context, a similar issue was litigated by the Golang community [here](https://github.com/golang/go/issues/8451), culminating in [this solution](https://go-review.googlesource.com/c/go/+/75475). I've written a function that checks first if the system default temp directory is mounted with the `noexec` option. If true, it instead writes ollama temp directory to `/run/uses/<id>`, a directory managed by `pam_systemd` that will be [cleaned when the user signs out](https://man7.org/linux/man-pages/man8/pam_systemd.8.html#:~:text=1.%20If%20it,are%0A%20%20%20%20%20%20%20%20%20%20%20removed%2C%20too.). I thought this would be the least intrusive way to address the issue that shouldn't interfere if the user has an alternative `$TMPDIR` and doesn't require any additional knowledge on the part of the user. Thank you all for an excellent application. I'm a big fan of Ollama and hope you find this contribution helpful, in line with the spirit with which it is offered. --- <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-12 23:20:13 -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#11075