[GH-ISSUE #8512] "mkdir: permission denied" preventing startup when home folder parents do not have permission #5486

Closed
opened 2026-04-12 16:42:48 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @lyjia on GitHub (Jan 21, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/8512

What is the issue?

Hello,

In a previous version of ollama, I had an installation set up where the home folder for the ollama account was set to /storage/shared/data/ml/ollama. This folder had both user and group ownerships set to the ollama account, along with all children. The parent paths of this folder are inaccessible to this account with the expectation that ollama should not be referencing those folders for any reason. I run this setup because I wanted ollama's data on a drive with lots of storage.

I recently updated to 0.5.7 and ollama now fails to start, with Error: mkdir /storage/shared/data: permission denied

In troubleshooting this, I moved the home folder to /home/ollama (and set permissions accordingly) and then symlinked /home/ollama/.ollama/models to /storage/shared/data/ml/ollama-models, after moving ollama's models folder contents (blobs and manifests) to that new path.

Now, ollama fails to start with Error: mkdir /home/ollama/.ollama/models: file exists. Presumably because it is expecting a folder but encountering a symlink file instead.

I am trying to keep ollama's files at a path that its user account has permissions for, but not any parent directories. I'm not sure why ollama is calling mkdir on these parent paths but mkdir not seeing what it wants and then throwing errors seems to have broken my install.

I could be wrong but it appears that the MkDirAll call at GetBlobsPath and GetManifestPath at 7bb356c680/server/modelpath.go (L117) is responsible for this behavior? Is there some way to set this so that it doesn't freak out if it doesn't see what it expects but still has permission at the final path?

I don't want to give ollama user access to more than is necessary.

Thanks!

Tom

OS

Linux

GPU

No response

CPU

Intel

Ollama version

0.5.7

Originally created by @lyjia on GitHub (Jan 21, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/8512 ### What is the issue? Hello, In a previous version of ollama, I had an installation set up where the home folder for the ollama account was set to `/storage/shared/data/ml/ollama`. This folder had both user and group ownerships set to the ollama account, along with all children. The parent paths of this folder are inaccessible to this account with the expectation that ollama should not be referencing those folders for any reason. I run this setup because I wanted ollama's data on a drive with lots of storage. I recently updated to 0.5.7 and ollama now fails to start, with `Error: mkdir /storage/shared/data: permission denied` In troubleshooting this, I moved the home folder to `/home/ollama` (and set permissions accordingly) and then symlinked `/home/ollama/.ollama/models` to `/storage/shared/data/ml/ollama-models`, after moving ollama's models folder contents (`blobs` and `manifests`) to that new path. Now, ollama fails to start with `Error: mkdir /home/ollama/.ollama/models: file exists`. Presumably because it is expecting a folder but encountering a symlink file instead. I am trying to keep ollama's files at a path that its user account has permissions for, but not any parent directories. I'm not sure why ollama is calling mkdir on these parent paths but mkdir not seeing what it wants and then throwing errors seems to have broken my install. I could be wrong but it appears that the `MkDirAll` call at `GetBlobsPath` and `GetManifestPath` at https://github.com/ollama/ollama/blob/7bb356c6807c8dd2f06a28645cfac307e1e19a50/server/modelpath.go#L117 is responsible for this behavior? Is there some way to set this so that it doesn't freak out if it doesn't see what it expects but still has permission at the final path? I don't want to give ollama user access to more than is necessary. Thanks! Tom ### OS Linux ### GPU _No response_ ### CPU Intel ### Ollama version 0.5.7
GiteaMirror added the bug label 2026-04-12 16:42:48 -05:00
Author
Owner

@rick-github commented on GitHub (Jan 21, 2025):

Add BindPaths to the system config file.

[Service]
BindPaths=/storage/shared/data/ml/ollama-models:/home/ollama/.ollama/models

If you're not using systemd, add a bind mount to /etc/fstab:

/storage/shared/data/ml/ollama-models /home/ollama/.ollama/models none defaults,bind 0 0
<!-- gh-comment-id:2605177997 --> @rick-github commented on GitHub (Jan 21, 2025): Add `BindPaths` to the system config file. ``` [Service] BindPaths=/storage/shared/data/ml/ollama-models:/home/ollama/.ollama/models ``` If you're not using systemd, add a bind mount to /etc/fstab: ``` /storage/shared/data/ml/ollama-models /home/ollama/.ollama/models none defaults,bind 0 0 ```
Author
Owner

@lyjia commented on GitHub (Jan 21, 2025):

Ah, that is a good workaround, thank you!

Also for the record I encountered the same issue setting OLLAMA_MODELS to the path I wanted.

<!-- gh-comment-id:2605196899 --> @lyjia commented on GitHub (Jan 21, 2025): Ah, that is a good workaround, thank you! Also for the record I encountered the same issue setting `OLLAMA_MODELS` to the path I wanted.
Author
Owner

@AlienTux commented on GitHub (Feb 26, 2025):

Add BindPaths to the system config file.

[Service]
BindPaths=/storage/shared/data/ml/ollama-models:/home/ollama/.ollama/models

Please excuse my ignorane. Is this the ollama.service file or do I have to edit a different config file?

<!-- gh-comment-id:2685891594 --> @AlienTux commented on GitHub (Feb 26, 2025): > Add `BindPaths` to the system config file. > > ``` > [Service] > BindPaths=/storage/shared/data/ml/ollama-models:/home/ollama/.ollama/models > ``` Please excuse my ignorane. Is this the ollama.service file or do I have to edit a different config file?
Author
Owner

@rick-github commented on GitHub (Feb 26, 2025):

ollama service file.

sudo systemctl edit ollama
<!-- gh-comment-id:2685895002 --> @rick-github commented on GitHub (Feb 26, 2025): ollama service file. ``` sudo systemctl edit ollama ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#5486