[GH-ISSUE #1066] Error: mkdir permission denied #47036

Closed
opened 2026-04-28 02:49:20 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @pepsiamir on GitHub (Nov 10, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/1066

Originally assigned to: @mxyng on GitHub.

After installing Mistral and Sqlcoder models I got this error.

verifying sha256 digest
writing manifest
Error: mkdir /usr/share/ollama/.ollama/models/manifests/registry.ollama.ai/library/mistral: permission denied

I had to make the directory manually which then succeeded.

sudo mkdir /usr/share/ollama/.ollama/models/manifests/registry.ollama.ai/library/mistral
Originally created by @pepsiamir on GitHub (Nov 10, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/1066 Originally assigned to: @mxyng on GitHub. After installing Mistral and Sqlcoder models I got this error. ``` verifying sha256 digest writing manifest Error: mkdir /usr/share/ollama/.ollama/models/manifests/registry.ollama.ai/library/mistral: permission denied ``` I had to make the directory manually which then succeeded. ``` sudo mkdir /usr/share/ollama/.ollama/models/manifests/registry.ollama.ai/library/mistral ```
GiteaMirror added the bug label 2026-04-28 02:49:20 -05:00
Author
Owner

@BruceMacD commented on GitHub (Nov 10, 2023):

Thanks for opening the issue, we have been having some issues with how we run the ollama runs as service on linux in relation to file access. The fix should be in soon in #898

<!-- gh-comment-id:1806377997 --> @BruceMacD commented on GitHub (Nov 10, 2023): Thanks for opening the issue, we have been having some issues with how we run the ollama runs as service on linux in relation to file access. The fix should be in soon in #898
Author
Owner

@Luminous-seed commented on GitHub (Mar 27, 2024):

Ubuntu22.04 拉取模型,多次遇到permission denied问题.

拉取模型的命令:
ollama pull nomic-embed-text

返回和报错:
pulling manifest
pulling 970aa74c0a90... 100% ▕████████████████▏ 274 MB
pulling c71d239df917... 100% ▕████████████████▏ 11 KB
pulling ce4a164fc046... 100% ▕████████████████▏ 17 B
pulling 31df23ea7daa... 100% ▕████████████████▏ 420 B
verifying sha256 digest
writing manifest
Error: mkdir /usr/share/ollama/.ollama/models/manifests/registry.ollama.ai/library/nomic-embed-text: permission denied

按照本问答方法自己手动生成路径
sudo mkdir /usr/share/ollama/.ollama/models/manifests/registry.ollama.ai/library/nomic-embed-text

重新拉取模型
ollama pull nomic-embed-text
返回和报错:
pulling manifest
pulling 970aa74c0a90... 100% ▕████████████████▏ 274 MB
pulling c71d239df917... 100% ▕████████████████▏ 11 KB
pulling ce4a164fc046... 100% ▕████████████████▏ 17 B
pulling 31df23ea7daa... 100% ▕████████████████▏ 420 B
verifying sha256 digest
writing manifest
Error: open /usr/share/ollama/.ollama/models/manifests/registry.ollama.ai/library/nomic-embed-text/latest: permission denied

担心是因为权限不足,使用sudo再次拉取模型
sudo ollama pull nomic-embed-text
报错:
pulling manifest
pulling 970aa74c0a90... 100% ▕█▏ 274 MB
pulling c71d239df917... 100% █▏ 11 KB
pulling ce4a164fc046... 100% ▕██▏ 17 B
pulling 31df23ea7daa... 100% ▕█▏ 420 B
verifying sha256 digest
writing manifest
Error: open /usr/share/ollama/.ollama/models/manifests/registry.ollama.ai/library/nomic-embed-text/latest: permission denied

求助了,不知道怎么个事...

<!-- gh-comment-id:2022073237 --> @Luminous-seed commented on GitHub (Mar 27, 2024): Ubuntu22.04 拉取模型,多次遇到permission denied问题. 拉取模型的命令: ```ollama pull nomic-embed-text``` 返回和报错: pulling manifest pulling 970aa74c0a90... 100% ▕████████████████▏ 274 MB pulling c71d239df917... 100% ▕████████████████▏ 11 KB pulling ce4a164fc046... 100% ▕████████████████▏ 17 B pulling 31df23ea7daa... 100% ▕████████████████▏ 420 B verifying sha256 digest writing manifest Error: mkdir /usr/share/ollama/.ollama/models/manifests/registry.ollama.ai/library/nomic-embed-text: permission denied 按照本问答方法自己手动生成路径 ```sudo mkdir /usr/share/ollama/.ollama/models/manifests/registry.ollama.ai/library/nomic-embed-text``` 重新拉取模型 ```ollama pull nomic-embed-text``` 返回和报错: pulling manifest pulling 970aa74c0a90... 100% ▕████████████████▏ 274 MB pulling c71d239df917... 100% ▕████████████████▏ 11 KB pulling ce4a164fc046... 100% ▕████████████████▏ 17 B pulling 31df23ea7daa... 100% ▕████████████████▏ 420 B verifying sha256 digest writing manifest Error: open /usr/share/ollama/.ollama/models/manifests/registry.ollama.ai/library/nomic-embed-text/latest: permission denied 担心是因为权限不足,使用sudo再次拉取模型 ```sudo ollama pull nomic-embed-text``` 报错: pulling manifest pulling 970aa74c0a90... 100% ▕█▏ 274 MB pulling c71d239df917... 100% █▏ 11 KB pulling ce4a164fc046... 100% ▕██▏ 17 B pulling 31df23ea7daa... 100% ▕█▏ 420 B verifying sha256 digest writing manifest Error: open /usr/share/ollama/.ollama/models/manifests/registry.ollama.ai/library/nomic-embed-text/latest: permission denied 求助了,不知道怎么个事...
Author
Owner

@kkglow commented on GitHub (Feb 21, 2025):

try change the owner or group of the file directory from root to ollama

sudo find /usr/share/ollama/.ollama/models/ -type f -exec chown ollama:ollama {} ;
sudo find /usr/share/ollama/.ollama/models/ -type d -exec chown ollama:ollama {} ;
sudo find /usr/share/ollama/.ollama/models/ -type f -exec chmod 644 {} ;
sudo find /usr/share/ollama/.ollama/models/ -type d -exec chmod 755 {} ;

hope this is helpful

<!-- gh-comment-id:2673524885 --> @kkglow commented on GitHub (Feb 21, 2025): try change the owner or group of the file directory from root to ollama sudo find /usr/share/ollama/.ollama/models/ -type f -exec chown ollama:ollama {} \; sudo find /usr/share/ollama/.ollama/models/ -type d -exec chown ollama:ollama {} \; sudo find /usr/share/ollama/.ollama/models/ -type f -exec chmod 644 {} \; sudo find /usr/share/ollama/.ollama/models/ -type d -exec chmod 755 {} \; hope this is helpful
Author
Owner

@slamj1 commented on GitHub (Mar 4, 2025):

Small nitpick, for bash need ; at the end of each command.

<!-- gh-comment-id:2695951698 --> @slamj1 commented on GitHub (Mar 4, 2025): Small nitpick, for bash need \; at the end of each command.
Author
Owner

@slamj1 commented on GitHub (Mar 4, 2025):

sorry backslashes don't come through, should be:

sudo find /usr/share/ollama/.ollama/models/ -type f -exec chown ollama:ollama {} \;

<!-- gh-comment-id:2696045403 --> @slamj1 commented on GitHub (Mar 4, 2025): sorry backslashes don't come through, should be: `sudo find /usr/share/ollama/.ollama/models/ -type f -exec chown ollama:ollama {} \;`
Author
Owner

@dangarciahe commented on GitHub (Aug 12, 2025):

I'm still getting this issue. The error I got in systemd logs was

Error: could not create directory mkdir /var/lib/ollama: permission denied

My workaround was to give the ollama's systemd entry permissions to its /var/lib/ folder, modifying etc/systemd/system/ollama.service by adding the following lines:

StateDirectory=ollama
WorkingDirectory=/var/lib/ollama

After that simply restart the systemd config and module:

sudo systemctl daemon-reload && sudo systemctl restart ollama.service

This worked in my Manjaro install

<!-- gh-comment-id:3177611511 --> @dangarciahe commented on GitHub (Aug 12, 2025): I'm still getting this issue. The error I got in systemd logs was `Error: could not create directory mkdir /var/lib/ollama: permission denied ` My workaround was to give the ollama's systemd entry permissions to its /var/lib/ folder, modifying `etc/systemd/system/ollama.service` by adding the following lines: ``` StateDirectory=ollama WorkingDirectory=/var/lib/ollama ``` After that simply restart the systemd config and module: `sudo systemctl daemon-reload && sudo systemctl restart ollama.service` This worked in my Manjaro install
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#47036