[PR #3302] [CLOSED] Fix Execution Error when /tmp is mounted with noexec flag for Issue #2436 #73405

Closed
opened 2026-05-05 05:13:51 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

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

Base: mainHead: main


📝 Commits (2)

  • 600d1c5 Added function to check if system default temp directory is mounted with noexec option
  • 58f40c7 Removed depricated 'syscall' library and used 'golang.orx/x/sys/unix' instead.

📊 Changes

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

View changed files

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

📄 Description

In relation to https://github.com/ollama/ollama/issues/2436, which remains unresolved, this pull request introduces a fix similar to the one in https://github.com/ollama/ollama/pull/2403. The issue arises on Linux systems where the /tmp directory is mounted with the noexec flag, 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 https://github.com/golang/go/issues/8451, 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/, 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/3302 **Author:** [@jshbmllr](https://github.com/jshbmllr) **Created:** 3/22/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (2) - [`600d1c5`](https://github.com/ollama/ollama/commit/600d1c56d79c72bc4558327520cb5831dc6abf61) Added function to check if system default temp directory is mounted with noexec option - [`58f40c7`](https://github.com/ollama/ollama/commit/58f40c7530b2ff478429c3db3ee7babc0cd42363) Removed depricated 'syscall' library and used 'golang.orx/x/sys/unix' instead. ### 📊 Changes **1 file changed** (+29 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `gpu/assets.go` (+29 -1) </details> ### 📄 Description In relation to https://github.com/ollama/ollama/issues/2436, which remains unresolved, this pull request introduces a fix similar to the one in https://github.com/ollama/ollama/pull/2403. The issue arises on Linux systems where the /tmp directory is mounted with the noexec flag, 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 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-05-05 05:13:52 -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#73405