[GH-ISSUE #8276] Ollama cannot load model after several hours on some GPUs #67350

Closed
opened 2026-05-04 10:01:19 -05:00 by GiteaMirror · 10 comments
Owner

Originally created by @QichangZheng on GitHub (Dec 31, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/8276

What is the issue?

It works well on L20 GPU.
When I switch to H20 GPU, ollama died after several hours. It cannot load model, when I run 'ollama run gemma2:2b', it takes infinite time (as shown in the screenshot). But 'ollama serve -h' works.
image

OS

Linux

GPU

Nvidia

CPU

Intel

Ollama version

0.5.4

Originally created by @QichangZheng on GitHub (Dec 31, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/8276 ### What is the issue? It works well on L20 GPU. When I switch to H20 GPU, ollama died after several hours. It cannot load model, when I run 'ollama run gemma2:2b', it takes infinite time (as shown in the screenshot). But 'ollama serve -h' works. ![image](https://github.com/user-attachments/assets/a9c97250-5afc-457d-b5ae-d689f17b1fc1) ### OS Linux ### GPU Nvidia ### CPU Intel ### Ollama version 0.5.4
GiteaMirror added the bug label 2026-05-04 10:01:19 -05:00
Author
Owner

@rick-github commented on GitHub (Jan 1, 2025):

Server logs may aid in debugging.

<!-- gh-comment-id:2566767410 --> @rick-github commented on GitHub (Jan 1, 2025): [Server logs](https://github.com/ollama/ollama/blob/main/docs/troubleshooting.md#how-to-troubleshoot-issues) may aid in debugging.
Author
Owner

@QichangZheng commented on GitHub (Jan 1, 2025):

Server logs may aid in debugging.

Thanks a lot for your help. However, "journalctl -u ollama --no-pager" shows nothing. I have been using "screen" and "ollama serve" and the session is lost. Does "OLLAMA_DEBUG="1"" help to save the logs into a file?

<!-- gh-comment-id:2566774124 --> @QichangZheng commented on GitHub (Jan 1, 2025): > [Server logs](https://github.com/ollama/ollama/blob/main/docs/troubleshooting.md#how-to-troubleshoot-issues) may aid in debugging. Thanks a lot for your help. However, "journalctl -u ollama --no-pager" shows nothing. I have been using "screen" and "ollama serve" and the session is lost. Does "OLLAMA_DEBUG="1"" help to save the logs into a file?
Author
Owner

@rick-github commented on GitHub (Jan 1, 2025):

No, OLLAMA_DEBUG adds extra debug info which may have been useful here, but if you've lost the screen session there's nothing to do. Does the model load now?

<!-- gh-comment-id:2566774943 --> @rick-github commented on GitHub (Jan 1, 2025): No, `OLLAMA_DEBUG` adds extra debug info which may have been useful here, but if you've lost the screen session there's nothing to do. Does the model load now?
Author
Owner

@QichangZheng commented on GitHub (Jan 1, 2025):

No, OLLAMA_DEBUG adds extra debug info which may have been useful here, but if you've lost the screen session there's nothing to do. Does the model load now?

It only works after I restart the machine and restart the service. The SSH is not stable, so I use "screen" to keep the session alive after I lost connection. I will try something like "bash start_ollama.sh > output.txt" to get the log for you. Thanks a lot for your help!

<!-- gh-comment-id:2566776088 --> @QichangZheng commented on GitHub (Jan 1, 2025): > No, `OLLAMA_DEBUG` adds extra debug info which may have been useful here, but if you've lost the screen session there's nothing to do. Does the model load now? It only works after I restart the machine and restart the service. The SSH is not stable, so I use "screen" to keep the session alive after I lost connection. I will try something like "bash start_ollama.sh > output.txt" to get the log for you. Thanks a lot for your help!
Author
Owner

@rick-github commented on GitHub (Jan 1, 2025):

Why not run it as a service?

<!-- gh-comment-id:2566776533 --> @rick-github commented on GitHub (Jan 1, 2025): Why not run it as a service?
Author
Owner

@QichangZheng commented on GitHub (Jan 1, 2025):

Why not run it as a service?

Do you mean using "ollama run "? That's because I am using API to call different models from ollama

<!-- gh-comment-id:2566777394 --> @QichangZheng commented on GitHub (Jan 1, 2025): > Why not run it as a service? Do you mean using "ollama run <model>"? That's because I am using API to call different models from ollama
Author
Owner

@rick-github commented on GitHub (Jan 1, 2025):

I mean install ollama as a service:

curl -fsSL https://ollama.com/install.sh | sh

Then the logging works and the service continues to run if you lose your ssh session.

<!-- gh-comment-id:2566778225 --> @rick-github commented on GitHub (Jan 1, 2025): I mean install ollama as a service: ``` curl -fsSL https://ollama.com/install.sh | sh ``` Then the logging works and the service continues to run if you lose your ssh session.
Author
Owner

@QichangZheng commented on GitHub (Jan 1, 2025):

I mean install ollama as a service:

curl -fsSL https://ollama.com/install.sh | sh

Then the logging works and the service continues to run if you lose your ssh session.

Ah yes, I used your command to install Ollama on Linux machine. I didn't remember whether Ollama is on after I ran the command to install ollama, but I am sure that I need to manually start Ollama after I restart the machine. Actually I have the start_ollama.sh: "OLLAMA_HOST=0.0.0.0:11434 OLLAMA_KEEP_ALIVE="120m" OLLAMA_MODELS="/root/autodl-tmp/ollama" OLLAMA_NUM_PARALLEL=4 OLLAMA_DEBUG=1 ollama serve"
I just run:
screen -S ollama
bash start_ollama.sh

<!-- gh-comment-id:2566780264 --> @QichangZheng commented on GitHub (Jan 1, 2025): > I mean install ollama as a service: > > ``` > curl -fsSL https://ollama.com/install.sh | sh > ``` > > Then the logging works and the service continues to run if you lose your ssh session. Ah yes, I used your command to install Ollama on Linux machine. I didn't remember whether Ollama is on after I ran the command to install ollama, but I am sure that I need to manually start Ollama after I restart the machine. Actually I have the start_ollama.sh: "OLLAMA_HOST=0.0.0.0:11434 OLLAMA_KEEP_ALIVE="120m" OLLAMA_MODELS="/root/autodl-tmp/ollama" OLLAMA_NUM_PARALLEL=4 OLLAMA_DEBUG=1 ollama serve" I just run: screen -S ollama bash start_ollama.sh
Author
Owner

@rick-github commented on GitHub (Jan 1, 2025):

If you need to manually start ollama after curl|sh, the installation failed in some manner. I would recommend reinstalling (just do the curl|sh command again), then running sudo systemctl edit ollama and add the variables you have in your startup script.

[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"
Environment="OLLAMA_KEEP_ALIVE=120m"
Environment="OLLAMA_MODELS=/root/autodl-tmp/ollama"
Environment="OLLAMA_NUM_PARALLEL=4"
Environment="OLLAMA_DEBUG=1"

You may need to change the ownership of /root/autodl-tmp/ollama: chown -R ollama:ollama /root/autodl-tmp/ollama, or you could move the existing models to /usr/share/ollama/.ollama/models and remove the OLLAMA_MODELS override.

<!-- gh-comment-id:2566782960 --> @rick-github commented on GitHub (Jan 1, 2025): If you need to manually start ollama after `curl|sh`, the installation failed in some manner. I would recommend reinstalling (just do the `curl|sh` command again), then running `sudo systemctl edit ollama` and add the variables you have in your startup script. ``` [Service] Environment="OLLAMA_HOST=0.0.0.0:11434" Environment="OLLAMA_KEEP_ALIVE=120m" Environment="OLLAMA_MODELS=/root/autodl-tmp/ollama" Environment="OLLAMA_NUM_PARALLEL=4" Environment="OLLAMA_DEBUG=1" ``` You may need to change the ownership of /root/autodl-tmp/ollama: `chown -R ollama:ollama /root/autodl-tmp/ollama`, or you could move the existing models to `/usr/share/ollama/.ollama/models` and remove the `OLLAMA_MODELS` override.
Author
Owner

@QichangZheng commented on GitHub (Jan 1, 2025):

If you need to manually start ollama after curl|sh, the installation failed in some manner. I would recommend reinstalling (just do the curl|sh command again), then running sudo systemctl edit ollama and add the variables you have in your startup script.

[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"
Environment="OLLAMA_KEEP_ALIVE=120m"
Environment="OLLAMA_MODELS=/root/autodl-tmp/ollama"
Environment="OLLAMA_NUM_PARALLEL=4"
Environment="OLLAMA_DEBUG=1"

You may need to change the ownership of /root/autodl-tmp/ollama: chown -R ollama:ollama /root/autodl-tmp/ollama, or you could move the existing models to /usr/share/ollama/.ollama/models and remove the OLLAMA_MODELS override.

I got the error in screenshot when I reinstall ollama. I always got this error when I install ollama, but I can manually start ollama with "ollama serve".
image
My system:
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

But nvm, I will firstly collect and fetch the logs of why ollama cannot load models after several hours. The installing issue is not urgent. Thanks a lot for your help! I will get back to you with the logs soon.

<!-- gh-comment-id:2566791428 --> @QichangZheng commented on GitHub (Jan 1, 2025): > If you need to manually start ollama after `curl|sh`, the installation failed in some manner. I would recommend reinstalling (just do the `curl|sh` command again), then running `sudo systemctl edit ollama` and add the variables you have in your startup script. > > ``` > [Service] > Environment="OLLAMA_HOST=0.0.0.0:11434" > Environment="OLLAMA_KEEP_ALIVE=120m" > Environment="OLLAMA_MODELS=/root/autodl-tmp/ollama" > Environment="OLLAMA_NUM_PARALLEL=4" > Environment="OLLAMA_DEBUG=1" > ``` > > You may need to change the ownership of /root/autodl-tmp/ollama: `chown -R ollama:ollama /root/autodl-tmp/ollama`, or you could move the existing models to `/usr/share/ollama/.ollama/models` and remove the `OLLAMA_MODELS` override. I got the error in screenshot when I reinstall ollama. I always got this error when I install ollama, but I can manually start ollama with "ollama serve". ![image](https://github.com/user-attachments/assets/43618969-f7b5-4892-9a41-be00712f74b5) My system: PRETTY_NAME="Ubuntu 22.04.4 LTS" NAME="Ubuntu" VERSION_ID="22.04" VERSION="22.04.4 LTS (Jammy Jellyfish)" VERSION_CODENAME=jammy ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=jammy But nvm, I will firstly collect and fetch the logs of why ollama cannot load models after several hours. The installing issue is not urgent. Thanks a lot for your help! I will get back to you with the logs soon.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#67350