Hey! No worries — we can get this sorted.
Because “permission problems with Ollama on Arch” can mean a few different things, I’ll give you the common fixes first and then a quick checklist so you can zero-in on whatever is still broken. If you bump into something I didn’t cover, just drop the exact error message and we’ll drill down. 🚀
────────────────────────
1️⃣ Most frequent culprit: model directory owned by root
────────────────────────
If you installed Ollama with sudo (or via an AUR helper that built the package as root), the model cache usually ends up owned by root.
A regular user then gets a “permission denied” when trying to download / update a model.
Default path on Arch packages (ollama-bin / ollama-git):
/var/lib/ollama
Fix:
sudo mkdir -p /var/lib/ollama # just in case it doesn’t exist yet
sudo chown -R $USER:$USER /var/lib/ollama
# If you want every human user to be able to share models:
# sudo chown -R :users /var/lib/ollama
# sudo chmod -R g+rwX /var/lib/ollama
Now try:
ollama run llama2
and it should start downloading instead of erroring out.
────────────────────────
2️⃣ Binary capabilities & execute bit
────────────────────────
The Arch package normally installs /usr/bin/ollama with the proper permissions, but double-check:
ls -l /usr/bin/ollama
# should look something like:
# -rwxr-xr-x root root … /usr/bin/ollama
If it’s missing the execute bit, fix with:
sudo chmod +x /usr/bin/ollama
Some older PKGBUILDs set an unnecessary capability (setcap cap_sys_admin+ep /usr/bin/ollama).
If you see weird “Operation not permitted” messages, just strip it:
sudo setcap -r /usr/bin/ollama
(The binary does NOT need special caps to run.)
────────────────────────
3️⃣ Access to /dev/kvm (only if you compiled with qemu / HV back-ends)
────────────────────────
Most people don’t need this, but if Ollama (or a custom build) is trying to hit KVM you must be in the kvm group:
sudo gpasswd -a $USER kvm
newgrp kvm # or log out / in
Check:
ls -l /dev/kvm # should show … root kvm …
────────────────────────
4️⃣ ulimits & memlock (rare, huge models)
────────────────────────
If you see errors about “mlock” or “cannot allocate memory”:
sudo sh -c 'echo "* soft memlock unlimited" >> /etc/security/limits.conf'
sudo sh -c 'echo "* hard memlock unlimited" >> /etc/security/limits.conf'
…and make sure pam_limits.so is in your PAM stack (default on Arch).
────────────────────────
5️⃣ Firewall / port binding
────────────────────────
Ollama listens on 11434 (unprivileged) so you shouldn’t need root, but if you manually changed it to <1024 you’ll either need sudo or setcap:
sudo setcap 'cap_net_bind_service=+ep' /usr/bin/ollama
────────────────────────
Quick checklist
────────────────────────
ollama --version works?
ollama run llama2 (or any model) starts downloading to /var/lib/ollama?
- No “permission denied” lines in
journalctl -xeu ollama (if you’re running the systemd service)?
id shows you in the right groups (users, maybe kvm)?
If any step still throws an error, paste the exact line here and we’ll pin it down in seconds. 👍
Happy hacking!