[GH-ISSUE #10672] Error: mkdir /path/to/models: permission denied #32777

Closed
opened 2026-04-22 14:36:42 -05:00 by GiteaMirror · 8 comments
Owner

Originally created by @Dunravin on GitHub (May 12, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/10672

What is the issue?

Hi, last month I was able to move the models directory successfully to a new location. After a clean install of Arch and after many attempts I am unable to change the models directory.

I notice this issue was reported as a bug before and was addressed here #898

Has the bug crept back in?

I installed ollama from the Arch repo via pacman.
Everything worked in the default setup.

After creating a directory /home/ollama_models and running sudo chown -R ollama:ollama ollama_models/ from the /home directory the ollama service environment variable was set with

sudo systemctl edit ollama.service

[Service]
Environment="OLLAMA_MODELS=/home/ollama_models"

sudo systemctl daemon-reload
sudo systemctl start ollama.service
sudo systemctl status ollama.service

Relevant log output

ollama.service - Ollama Service
     Loaded: loaded (/usr/lib/systemd/system/ollama.service; disabled; preset: disabled)
    Drop-In: /etc/systemd/system/ollama.service.d
             └─override.conf
     Active: failed (Result: exit-code) since Mon 2025-05-12 13:26:47 BST; 10s ago
   Duration: 144ms
 Invocation: 1e68487c3aa74528b110314ffa23610e
    Process: 8641 ExecStart=/usr/bin/ollama serve (code=exited, status=1/FAILURE)
   Main PID: 8641 (code=exited, status=1/FAILURE)
   Mem peak: 13.8M
        CPU: 99ms

May 12 13:26:47 chugg systemd[1]: Started Ollama Service.
May 12 13:26:47 chugg ollama[8641]: 2025/05/12 13:26:47 routes.go:1233: INFO server config >
May 12 13:26:47 chugg ollama[8641]: Error: mkdir /home/ollama_models: permission denied
May 12 13:26:47 chugg systemd[1]: ollama.service: Main process exited, code=exited, status=>
May 12 13:26:47 chugg systemd[1]: ollama.service: Failed with result 'exit-code'.

OS

Linux

GPU

Nvidia

CPU

Intel

Ollama version

0.6.8

Originally created by @Dunravin on GitHub (May 12, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/10672 ### What is the issue? Hi, last month I was able to move the models directory successfully to a new location. After a clean install of Arch and after many attempts I am unable to change the models directory. I notice this issue was reported as a bug before and was addressed here [#898](https://github.com/ollama/ollama/pull/898) Has the bug crept back in? I installed ollama from the Arch repo via pacman. Everything worked in the default setup. After creating a directory `/home/ollama_models` and running `sudo chown -R ollama:ollama ollama_models/` from the `/home` directory the ollama service environment variable was set with `sudo systemctl edit ollama.service` `[Service]` `Environment="OLLAMA_MODELS=/home/ollama_models"` `sudo systemctl daemon-reload` `sudo systemctl start ollama.service` `sudo systemctl status ollama.service` ### Relevant log output ```shell ollama.service - Ollama Service Loaded: loaded (/usr/lib/systemd/system/ollama.service; disabled; preset: disabled) Drop-In: /etc/systemd/system/ollama.service.d └─override.conf Active: failed (Result: exit-code) since Mon 2025-05-12 13:26:47 BST; 10s ago Duration: 144ms Invocation: 1e68487c3aa74528b110314ffa23610e Process: 8641 ExecStart=/usr/bin/ollama serve (code=exited, status=1/FAILURE) Main PID: 8641 (code=exited, status=1/FAILURE) Mem peak: 13.8M CPU: 99ms May 12 13:26:47 chugg systemd[1]: Started Ollama Service. May 12 13:26:47 chugg ollama[8641]: 2025/05/12 13:26:47 routes.go:1233: INFO server config > May 12 13:26:47 chugg ollama[8641]: Error: mkdir /home/ollama_models: permission denied May 12 13:26:47 chugg systemd[1]: ollama.service: Main process exited, code=exited, status=> May 12 13:26:47 chugg systemd[1]: ollama.service: Failed with result 'exit-code'. ``` ### OS Linux ### GPU Nvidia ### CPU Intel ### Ollama version 0.6.8
GiteaMirror added the bug label 2026-04-22 14:36:42 -05:00
Author
Owner

@Dunravin commented on GitHub (May 12, 2025):

Reverting back to default environment variables and everything works again, the service starts and ollama behaves as expected.

<!-- gh-comment-id:2872438412 --> @Dunravin commented on GitHub (May 12, 2025): Reverting back to default environment variables and everything works again, the service starts and ollama behaves as expected.
Author
Owner

@rick-github commented on GitHub (May 12, 2025):

What's the output of

p="/home/ollama_models/models"; ls -ld / $(while [ "$p" != "/" ]; do echo "$p"; p=$(dirname "$p"); done | tac)
<!-- gh-comment-id:2872519722 --> @rick-github commented on GitHub (May 12, 2025): What's the output of ``` p="/home/ollama_models/models"; ls -ld / $(while [ "$p" != "/" ]; do echo "$p"; p=$(dirname "$p"); done | tac) ```
Author
Owner

@Dunravin commented on GitHub (May 12, 2025):

ls: cannot access '/home/ollama_models/models': No such file or directory
drwxr-xr-x 17 root root 4096 May 10 17:34 /
drwxr-xr-x 4 root root 4096 May 12 13:23 /home
drwxrwxr-x 2 ollama ollama 4096 May 12 13:23 /home/ollama_models

I added group write manually to ollama_models in a fix attempt, the ollama_models/models subdirectory was never specified or created.

<!-- gh-comment-id:2872601858 --> @Dunravin commented on GitHub (May 12, 2025): ls: cannot access '/home/ollama_models/models': No such file or directory drwxr-xr-x 17 root root 4096 May 10 17:34 / drwxr-xr-x 4 root root 4096 May 12 13:23 /home drwxrwxr-x 2 ollama ollama 4096 May 12 13:23 /home/ollama_models I added group write manually to ollama_models in a fix attempt, the ollama_models/models subdirectory was never specified or created.
Author
Owner

@Dunravin commented on GitHub (May 12, 2025):

Weird, I don't know if this is related but the default model directory is not present /usr/share/ollama/.ollama/models

instead models appear to be located in usr/share/ollama/blobs which is simlinked to /var/lib/ollama/blobs

which is not a problem for me as it works as is, but it differs from the FAQ entry which is confusing.

I hang on to hear back from you @rick-github but I may end up removing the arch package and trying with the curl install method.

<!-- gh-comment-id:2872677148 --> @Dunravin commented on GitHub (May 12, 2025): Weird, I don't know if this is related but the default model directory is not present `/usr/share/ollama/.ollama/models` instead models appear to be located in `usr/share/ollama/blobs` which is simlinked to `/var/lib/ollama/blobs` which is not a problem for me as it works as is, but it differs from the FAQ entry which is confusing. I hang on to hear back from you @rick-github but I may end up removing the arch package and trying with the curl install method.
Author
Owner

@rick-github commented on GitHub (May 12, 2025):

If you are using the standard ollama package from Arch, the service file has ProtectHome=yes which prevents the process from accessing /home.

<!-- gh-comment-id:2872688708 --> @rick-github commented on GitHub (May 12, 2025): If you are using the standard ollama package from Arch, the [service file](https://gitlab.archlinux.org/archlinux/packaging/packages/ollama/-/blob/main/ollama.service?ref_type=heads) has `ProtectHome=yes` which [prevents](https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#ProtectHome=) the process from accessing `/home`.
Author
Owner

@Dunravin commented on GitHub (May 12, 2025):

If you are using the standard ollama package from Arch, the service file has ProtectHome=yes which prevents the process from accessing /home.

Ah ok, that makes sense. I have edited the override.conf with ProtectHome=no and the service starts and the models are saved!

Thanks @rick-github closing the issue.

<!-- gh-comment-id:2872711407 --> @Dunravin commented on GitHub (May 12, 2025): > If you are using the standard ollama package from Arch, the [service file](https://gitlab.archlinux.org/archlinux/packaging/packages/ollama/-/blob/main/ollama.service?ref_type=heads) has `ProtectHome=yes` which [prevents](https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#:~:text=in%20version%20214.-,ProtectHome,-%3D%C2%B6) the process from accessing `/home`. Ah ok, that makes sense. I have edited the override.conf with `ProtectHome=no` and the service starts and the models are saved! Thanks @rick-github closing the issue.
Author
Owner

@Chiramisudo commented on GitHub (Sep 5, 2025):

@Dunravin Which variables are you defining, because this isn't working for me on version 0.11.8. I've only defined Environment and ProtectHome just above the line that says ### Edits below this comment will be discarded and the service continues to fail to start, with the error that mkdir... permission denied.

Why is this even a test? I've spent several hours tweaking permissions and many other things trying to get this to work and can't. For mine, I just used the already defined /home/user/.ollama/models but even that doesn't work, and I followed the documentation exactly.

Oddly, I can run it manually with ollama serve and then see the models in another tab with ollama list similar to the OP in #3438, but the service never runs properly. Despite that issues age and an abundance of closed issues (like this one) related to this issue, it has yet to be resolved.

<!-- gh-comment-id:3260085187 --> @Chiramisudo commented on GitHub (Sep 5, 2025): @Dunravin Which variables are you defining, because this isn't working for me on version 0.11.8. I've only defined `Environment` and `ProtectHome` just above the line that says `### Edits below this comment will be discarded` and the service continues to fail to start, with the error that `mkdir... permission denied`. Why is this even a test? I've spent several hours tweaking permissions and many other things trying to get this to work and can't. For mine, I just used the already defined `/home/user/.ollama/models` but even that doesn't work, and I followed the documentation exactly. Oddly, I can run it manually with `ollama serve` and then see the models in another tab with `ollama list` similar to the OP in #3438, but the service never runs properly. Despite that issues age and an abundance of closed issues (like this one) related to this issue, it has yet to be resolved.
Author
Owner

@rick-github commented on GitHub (Sep 6, 2025):

What's the output of

p="/home/user/.ollama/models"; ls -ld / $(while [ "$p" != "/" ]; do echo "$p"; p=$(dirname "$p"); done | tac)

What's the output of

systemctl cat ollama

Oddly, I can run it manually with ollama serve

The models are stored in $HOME/.ollama/models, so running it manually changes where the models are stored.

<!-- gh-comment-id:3260158799 --> @rick-github commented on GitHub (Sep 6, 2025): What's the output of ``` p="/home/user/.ollama/models"; ls -ld / $(while [ "$p" != "/" ]; do echo "$p"; p=$(dirname "$p"); done | tac) ``` What's the output of ``` systemctl cat ollama ``` > Oddly, I can run it manually with ollama serve The models are stored in $HOME/.ollama/models, so running it manually changes where the models are stored.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#32777