[GH-ISSUE #11517] ollama.service fails to start on boot (inactive/dead) but starts fine manually #54118

Closed
opened 2026-04-29 05:14:37 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @Geoknyda on GitHub (Jul 25, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/11517

What is the issue?

Describe the bug:
On a Debian-based system using GPU acceleration (AMDGPU stack), the ollama.service unit fails to start during system boot. The service is marked as enabled, but after boot:

$ systemctl status ollama
● ollama.service - Ollama Service
     Loaded: loaded (/etc/systemd/system/ollama.service; enabled; preset: enabled)
     Active: inactive (dead)

However, after logging in, manually running:

sudo systemctl restart ollama

...starts the service successfully, and all models are accessible via ollama ls and integrated apps (e.g. OpenWebUI). There are no error logs in journalctl -u ollama.service -b after boot, which makes diagnosing the cause difficult.

Environment:
OS: Debian 13 Trixie (unstable/sid)
Kernel: 6.16.0-rc7
GPU Stack: AMDGPU, with /dev/dri/card0 and /dev/kfd available
Ollama install location: /usr/local/bin/ollama
Ollama service user: ollama
Systemd target: multi-user.target

Service File:

[Unit]
Description=Ollama Service
After=network-online.target

[Service]
ExecStart=/usr/local/bin/ollama serve
ExecStartPre=/bin/sleep 15
User=ollama
Group=ollama
Restart=always
RestartSec=3
Environment="PATH=/home/debian/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"

[Install]
WantedBy=multi-user.target

Workaround:
Creating a systemd timer that calls systemctl restart ollama ~60 seconds after boot successfully works around the issue. This suggests that the problem may stem from timing dependencies (e.g. GPU, user session state, device readiness) not being satisfied at boot time.

Expected behavior:
Ollama should start automatically on boot without requiring manual intervention or delayed restart.

Additional notes:
It’s unclear if the problem lies in the timing of GPU device availability or if ollama serve lacks robust handling of early boot conditions.
If ollama serve fails silently when the environment is incomplete, better logging could help diagnose this.
Let me know if logs or traces from a debug version of ollama would help — happy to assist.

Relevant log output


OS

Linux

GPU

AMD

CPU

AMD

Ollama version

0.9.6

Originally created by @Geoknyda on GitHub (Jul 25, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/11517 ### What is the issue? Describe the bug: On a Debian-based system using GPU acceleration (AMDGPU stack), the `ollama.service` unit fails to start during system boot. The service is marked as `enabled`, but after boot: ``` $ systemctl status ollama ● ollama.service - Ollama Service Loaded: loaded (/etc/systemd/system/ollama.service; enabled; preset: enabled) Active: inactive (dead) ``` However, after logging in, manually running: `sudo systemctl restart ollama` ...starts the service successfully, and all models are accessible via `ollama ls` and integrated apps (e.g. OpenWebUI). There are no error logs in `journalctl -u ollama.service -b` after boot, which makes diagnosing the cause difficult. Environment: OS: Debian 13 Trixie (unstable/sid) Kernel: 6.16.0-rc7 GPU Stack: AMDGPU, with /dev/dri/card0 and /dev/kfd available Ollama install location: /usr/local/bin/ollama Ollama service user: ollama Systemd target: multi-user.target Service File: ``` [Unit] Description=Ollama Service After=network-online.target [Service] ExecStart=/usr/local/bin/ollama serve ExecStartPre=/bin/sleep 15 User=ollama Group=ollama Restart=always RestartSec=3 Environment="PATH=/home/debian/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games" [Install] WantedBy=multi-user.target ``` Workaround: Creating a `systemd` timer that calls `systemctl restart ollama` ~60 seconds after boot successfully works around the issue. This suggests that the problem may stem from timing dependencies (e.g. GPU, user session state, device readiness) not being satisfied at boot time. Expected behavior: Ollama should start automatically on boot without requiring manual intervention or delayed restart. Additional notes: It’s unclear if the problem lies in the timing of GPU device availability or if ollama serve lacks robust handling of early boot conditions. If ollama serve fails silently when the environment is incomplete, better logging could help diagnose this. Let me know if logs or traces from a debug version of ollama would help — happy to assist. ### Relevant log output ```shell ``` ### OS Linux ### GPU AMD ### CPU AMD ### Ollama version 0.9.6
GiteaMirror added the buglinux labels 2026-04-29 05:14:37 -05:00
Author
Owner

@dhiltgen commented on GitHub (Jul 31, 2025):

Can you share the server logs from early boot where it crashes/exits?

<!-- gh-comment-id:3141549060 --> @dhiltgen commented on GitHub (Jul 31, 2025): Can you share the server logs from early boot where it crashes/exits?
Author
Owner

@Geoknyda commented on GitHub (Aug 1, 2025):

Update: Resolved — Delayed startup was due to a systemd networking dependency, not Ollama itself.

Turns out the root cause was systemd-networkd-wait-online.service failing at boot. This service is responsible for delaying other units (like Docker and Ollama) until the network is fully configured. Because it failed, several dependent services were stuck in a "waiting" state — including Ollama.

systemctl status systemd-networkd-wait-online.service

Showed a failure to complete, which caused:

  • Docker to hang at startup
  • Ollama to wait on Docker (I use OpenwebUI docker)
  • Boot process to be delayed

Once the network setup issue was resolved (or the .service dependency removed/disabled), Ollama ad Docker launched instantly.

So the issue was environmental, not with Ollama. Thanks again!

<!-- gh-comment-id:3141935487 --> @Geoknyda commented on GitHub (Aug 1, 2025): **Update: Resolved — Delayed startup was due to a systemd networking dependency, not Ollama itself.** Turns out the root cause was `systemd-networkd-wait-online.service` failing at boot. This service is responsible for delaying other units (like Docker and Ollama) until the network is fully configured. Because it failed, several dependent services were stuck in a "waiting" state — including Ollama. `systemctl status systemd-networkd-wait-online.service` Showed a failure to complete, which caused: - Docker to hang at startup - Ollama to wait on Docker (I use OpenwebUI docker) - Boot process to be delayed Once the network setup issue was resolved (or the `.service` dependency removed/disabled), Ollama ad Docker launched instantly. **So the issue was environmental, not with Ollama.** Thanks again!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#54118