"vscode:/vscode.git/clone" did not exist on "c771b3a75a6ebbfbfc398a028a477246b0799cf0"
Commit 0a74cb31 authored by Daniel Hiltgen's avatar Daniel Hiltgen
Browse files

Safeguard for noexec

We may have users that run into problems with our current
payload model, so this gives us an escape valve.
parent 10ed1b62
...@@ -76,3 +76,10 @@ install script which version to install. ...@@ -76,3 +76,10 @@ install script which version to install.
```sh ```sh
curl -fsSL https://ollama.com/install.sh | OLLAMA_VERSION="0.1.29" sh curl -fsSL https://ollama.com/install.sh | OLLAMA_VERSION="0.1.29" sh
``` ```
## Linux tmp noexec
If your system is configured with the "noexec" flag where Ollama stores its
temporary executable files, you can specify an alternate location by setting
OLLAMA_TMPDIR to a location writable by the user ollama runs as. For example
OLLAMA_TMPDIR=/usr/share/ollama/
\ No newline at end of file
...@@ -22,11 +22,20 @@ var ( ...@@ -22,11 +22,20 @@ var (
func PayloadsDir() (string, error) { func PayloadsDir() (string, error) {
lock.Lock() lock.Lock()
defer lock.Unlock() defer lock.Unlock()
var err error
if payloadsDir == "" { if payloadsDir == "" {
cleanupTmpDirs() cleanupTmpDirs()
tmpDir, err := os.MkdirTemp("", "ollama") tmpDir := os.Getenv("OLLAMA_TMPDIR")
if err != nil { if tmpDir == "" {
return "", fmt.Errorf("failed to generate tmp dir: %w", err) tmpDir, err = os.MkdirTemp("", "ollama")
if err != nil {
return "", fmt.Errorf("failed to generate tmp dir: %w", err)
}
} else {
err = os.MkdirAll(tmpDir, 0755)
if err != nil {
return "", fmt.Errorf("failed to generate tmp dir %s: %w", tmpDir, err)
}
} }
// Track our pid so we can clean up orphaned tmpdirs // Track our pid so we can clean up orphaned tmpdirs
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment