[GH-ISSUE #15940] Install script fails on Ubuntu 24.04 : permission denied on /usr/share/ollama #72210

Open
opened 2026-05-05 03:38:13 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @issamdakir on GitHub (May 3, 2026).
Original GitHub issue: https://github.com/ollama/ollama/issues/15940

## Description
The official install script (`curl -fsSL https://ollama.com/install.sh | sh`) exits successfully but the Ollama service fails to start on Ubuntu 24.04.

## Steps to Reproduce
```bash
curl -fsSL https://ollama.com/install.sh | sh
systemctl status ollama
```

## Actual Result
Service dead with: `Error: could not create directory mkdir /usr/share/ollama: permission denied`

## Expected Result
Service running, API responding on :11434

## Root Cause
`useradd -m -d /usr/share/ollama` creates the home directory but permissions aren't explicitly set. On Ubuntu 24.04/Debian, the ollama user can't write to it during service startup.

## Proposed Fix
Add after user creation in `configure_systemd()`:
```bash
OLLAMA_HOME="/usr/share/ollama"
$SUDO mkdir -p "$OLLAMA_HOME"
$SUDO chown -R ollama:ollama "$OLLAMA_HOME"
$SUDO chmod 755 "$OLLAMA_HOME"
$SUDO mkdir -p "$OLLAMA_HOME/.ollama"
$SUDO chown ollama:ollama "$OLLAMA_HOME/.ollama"
```

Add to service file: `Environment="HOME=/usr/share/ollama"`

And verify service started:
```bash
sleep 2
systemctl is-active --quiet ollama || error "Service failed"
```

## Environment
- OS: Ubuntu 24.04.4 LTS / Debian trixie/sid
- Kernel: 6.8.0
- Arch: amd64
- Systemd: 255
- Ollama: 0.22.1

## Workaround
```bash
sudo mkdir -p /usr/share/ollama
sudo chown ollama:ollama /usr/share/ollama
sudo systemctl restart ollama
```
Originally created by @issamdakir on GitHub (May 3, 2026). Original GitHub issue: https://github.com/ollama/ollama/issues/15940 ``````markdown ## Description The official install script (`curl -fsSL https://ollama.com/install.sh | sh`) exits successfully but the Ollama service fails to start on Ubuntu 24.04. ## Steps to Reproduce ```bash curl -fsSL https://ollama.com/install.sh | sh systemctl status ollama ``` ## Actual Result Service dead with: `Error: could not create directory mkdir /usr/share/ollama: permission denied` ## Expected Result Service running, API responding on :11434 ## Root Cause `useradd -m -d /usr/share/ollama` creates the home directory but permissions aren't explicitly set. On Ubuntu 24.04/Debian, the ollama user can't write to it during service startup. ## Proposed Fix Add after user creation in `configure_systemd()`: ```bash OLLAMA_HOME="/usr/share/ollama" $SUDO mkdir -p "$OLLAMA_HOME" $SUDO chown -R ollama:ollama "$OLLAMA_HOME" $SUDO chmod 755 "$OLLAMA_HOME" $SUDO mkdir -p "$OLLAMA_HOME/.ollama" $SUDO chown ollama:ollama "$OLLAMA_HOME/.ollama" ``` Add to service file: `Environment="HOME=/usr/share/ollama"` And verify service started: ```bash sleep 2 systemctl is-active --quiet ollama || error "Service failed" ``` ## Environment - OS: Ubuntu 24.04.4 LTS / Debian trixie/sid - Kernel: 6.8.0 - Arch: amd64 - Systemd: 255 - Ollama: 0.22.1 ## Workaround ```bash sudo mkdir -p /usr/share/ollama sudo chown ollama:ollama /usr/share/ollama sudo systemctl restart ollama ``` ``````
Author
Owner

@issamdakir commented on GitHub (May 3, 2026):

assisted by deepseek , the problem was solved

ollama_install_fixed.sh

<!-- gh-comment-id:4365331712 --> @issamdakir commented on GitHub (May 3, 2026): assisted by deepseek , the problem was solved [ollama_install_fixed.sh](https://github.com/user-attachments/files/27312015/ollama_install_fixed.sh)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#72210