[GH-ISSUE #1835] Ubuntu desktop freezing for a few minutes #1044

Closed
opened 2026-04-12 10:46:49 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @horiacristescu on GitHub (Jan 7, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/1835

The problem: I am using ollama 0.1.18 on a Linux Box with Ubuntu 18.04 with 2x 2080 Ti and 64GB RAM

I get desktop freezes from time to time, about every 30 minutes, they last for 1-2 minutes during which time the desktop becomes unresponsive. They usually trigger when I change models, not the first time, but the second is almost sure to freeze.

This happens with diverse models, but I mostly have Mistral fine-tunes such as mistral:7b-instruct-v0.2-q5_K_M

Initial errors seem to be related to file ownership. I was hosting my models on a USB external drive, which was NTFS mounted under Ubuntu as root:root

Jan  6 05:09:29 HORSE systemd[1]: ollama.service: Main process exited, code=exited, status=1/FAILURE
Jan  6 05:09:29 HORSE systemd[1]: ollama.service: Failed with result 'exit-code'.
Jan  6 05:09:32 HORSE systemd[1]: ollama.service: Service hold-off time over, scheduling restart.
Jan  6 05:09:32 HORSE systemd[1]: ollama.service: Scheduled restart job, restart counter is at 340167.
Jan  6 05:09:32 HORSE ollama[1566]: Couldn't find '/usr/share/ollama/.ollama/id_ed25519'. Generating new private key.
Jan  6 05:09:32 HORSE ollama[1566]: Error: could not create directory mkdir /usr/share/ollama: permission denied
Jan  6 05:09:32 HORSE systemd[1]: ollama.service: Main process exited, code=exited, status=1/FAILURE
Jan  6 05:09:32 HORSE systemd[1]: ollama.service: Failed with result 'exit-code'.
Jan  6 05:09:35 HORSE systemd[1]: ollama.service: Service hold-off time over, scheduling restart.
Jan  6 05:09:35 HORSE systemd[1]: ollama.service: Scheduled restart job, restart counter is at 340168.
Jan  6 05:09:35 HORSE ollama[1613]: Couldn't find '/usr/share/ollama/.ollama/id_ed25519'. Generating new private key.
Jan  6 05:09:35 HORSE ollama[1613]: Error: could not create directory mkdir /usr/share/ollama: permission denied
Jan  6 05:09:35 HORSE systemd[1]: ollama.service: Main process exited, code=exited, status=1/FAILURE
Jan  6 05:09:35 HORSE systemd[1]: ollama.service: Failed with result 'exit-code'.
Jan  6 05:09:39 HORSE systemd[1]: ollama.service: Service hold-off time over, scheduling restart.
Jan  6 05:09:39 HORSE systemd[1]: ollama.service: Scheduled restart job, restart counter is at 340169.
Jan  6 05:09:39 HORSE ollama[1647]: Couldn't find '/usr/share/ollama/.ollama/id_ed25519'. Generating new private key.
Jan  6 05:09:39 HORSE ollama[1647]: Error: could not create directory mkdir /usr/share/ollama: permission denied

After fixing the file owner on this disk, I don't get this error anymore, but still have issues. Might be related to the USB drive spinning down. It takes about 5-10 seconds to spin up when it is cold.

Jan  7 00:11:22 HORSE kernel: [ 4880.761124] watchdog: BUG: soft lockup - CPU#4 stuck for 22s! [ollama:14930]
Jan  7 00:11:22 HORSE kernel: [ 4880.761178] CPU: 4 PID: 14930 Comm: ollama Tainted: P           OEL    5.4.0-150-generic #167~18.04.1-Ubuntu
Jan  7 00:12:02 HORSE kernel: [ 4920.785050] watchdog: BUG: soft lockup - CPU#15 stuck for 22s! [ollama:14930]
Jan  7 00:12:02 HORSE kernel: [ 4920.785110] CPU: 15 PID: 14930 Comm: ollama Tainted: P           OEL    5.4.0-150-generic #167~18.04.1-Ubuntu
Jan  7 00:12:30 HORSE kernel: [ 4948.785005] watchdog: BUG: soft lockup - CPU#15 stuck for 22s! [ollama:14930]
Jan  7 00:12:30 HORSE kernel: [ 4948.785038] CPU: 15 PID: 14930 Comm: ollama Tainted: P           OEL    5.4.0-150-generic #167~18.04.1-Ubuntu
Jan  7 00:13:02 HORSE kernel: [ 4980.760958] watchdog: BUG: soft lockup - CPU#3 stuck for 22s! [ollama:14930]
Jan  7 00:13:02 HORSE kernel: [ 4980.761001] CPU: 3 PID: 14930 Comm: ollama Tainted: P           OEL    5.4.0-150-generic #167~18.04.1-Ubuntu
Jan  7 00:13:34 HORSE kernel: [ 5012.760922] watchdog: BUG: soft lockup - CPU#3 stuck for 22s! [ollama:14930]
Jan  7 00:13:34 HORSE kernel: [ 5012.760963] CPU: 3 PID: 14930 Comm: ollama Tainted: P           OEL    5.4.0-150-generic #167~18.04.1-Ubuntu
Jan  7 02:06:27 HORSE kernel: [11786.260697] ptrace attach of "/usr/local/bin/ollama serve"[14903] was attempted by "gdb --batch -ex set style enabled on -ex attach 14903 -ex bt -frame-info source-and-location -ex detach -ex quit"[17265]
Jan  7 02:06:54 HORSE kernel: [11812.737913] watchdog: BUG: soft lockup - CPU#4 stuck for 22s! [ollama:14903]
Jan  7 02:06:54 HORSE kernel: [11812.737954] CPU: 4 PID: 14903 Comm: ollama Tainted: P           OEL    5.4.0-150-generic #167~18.04.1-Ubuntu
Jan  7 02:07:22 HORSE kernel: [11840.765849] watchdog: BUG: soft lockup - CPU#16 stuck for 22s! [ollama:14903]
Jan  7 02:07:22 HORSE kernel: [11840.765911] CPU: 16 PID: 14903 Comm: ollama Tainted: P           OEL    5.4.0-150-generic #167~18.04.1-Ubuntu
Jan  7 02:07:50 HORSE kernel: [11868.765784] watchdog: BUG: soft lockup - CPU#16 stuck for 22s! [ollama:14903]
Jan  7 02:07:50 HORSE kernel: [11868.765817] CPU: 16 PID: 14903 Comm: ollama Tainted: P           OEL    5.4.0-150-generic #167~18.04.1-Ubuntu
Jan  7 02:08:22 HORSE kernel: [11900.761709] watchdog: BUG: soft lockup - CPU#15 stuck for 22s! [ollama:14903]
Jan  7 02:08:22 HORSE kernel: [11900.761750] CPU: 15 PID: 14903 Comm: ollama Tainted: P           OEL    5.4.0-150-generic #167~18.04.1-Ubuntu
Jan  7 02:08:54 HORSE kernel: [11932.737634] watchdog: BUG: soft lockup - CPU#4 stuck for 23s! [ollama:14903]
Jan  7 02:08:54 HORSE kernel: [11932.737675] CPU: 4 PID: 14903 Comm: ollama Tainted: P           OEL    5.4.0-150-generic #167~18.04.1-Ubuntu

Tangential:

  1. What is the correct name: OLLAMA_MODEL=/... or OLLAMA_MODELS=/... ? The second doesn't seem to work.
  2. It was hard to find how to set it up correctly under systemd and I just gave up and run it from CLI. I just wanted to set the OLLAMA_HOST, OLLAMA_ORIGINS and OLLAMA_MODEL so I can use it from my other computers as well over the web. But no matter how I set the Environment= clause or even create a separate environment.json in /etc/systemd/system/ollama.service.d they don't seem to work.

Rant: Systemd is like a black box you set something and have no idea why it doesn't work; for example I have no idea with what environment variables it is actually running, and the errors go into obscure places and need arcane commands to be unearthed.

Can we have a systemd setup tutorial for the cases where you need to set a few variables? The Linux setup is so sweet if you don't need to change anything. But it becomes tricky if you want to move the models to another folder, change the IP and origins. Maybe the Linux CLI install script could have some arguments to set these variables right at install time, and protect them when doing upgrades.

Originally created by @horiacristescu on GitHub (Jan 7, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/1835 The problem: I am using `ollama 0.1.18` on a Linux Box with `Ubuntu 18.04` with `2x 2080 Ti` and `64GB RAM` I get desktop freezes from time to time, about every 30 minutes, they last for 1-2 minutes during which time the desktop becomes unresponsive. They usually trigger when I change models, not the first time, but the second is almost sure to freeze. This happens with diverse models, but I mostly have Mistral fine-tunes such as `mistral:7b-instruct-v0.2-q5_K_M` Initial errors seem to be related to file ownership. I was hosting my models on a USB external drive, which was NTFS mounted under Ubuntu as root:root ``` Jan 6 05:09:29 HORSE systemd[1]: ollama.service: Main process exited, code=exited, status=1/FAILURE Jan 6 05:09:29 HORSE systemd[1]: ollama.service: Failed with result 'exit-code'. Jan 6 05:09:32 HORSE systemd[1]: ollama.service: Service hold-off time over, scheduling restart. Jan 6 05:09:32 HORSE systemd[1]: ollama.service: Scheduled restart job, restart counter is at 340167. Jan 6 05:09:32 HORSE ollama[1566]: Couldn't find '/usr/share/ollama/.ollama/id_ed25519'. Generating new private key. Jan 6 05:09:32 HORSE ollama[1566]: Error: could not create directory mkdir /usr/share/ollama: permission denied Jan 6 05:09:32 HORSE systemd[1]: ollama.service: Main process exited, code=exited, status=1/FAILURE Jan 6 05:09:32 HORSE systemd[1]: ollama.service: Failed with result 'exit-code'. Jan 6 05:09:35 HORSE systemd[1]: ollama.service: Service hold-off time over, scheduling restart. Jan 6 05:09:35 HORSE systemd[1]: ollama.service: Scheduled restart job, restart counter is at 340168. Jan 6 05:09:35 HORSE ollama[1613]: Couldn't find '/usr/share/ollama/.ollama/id_ed25519'. Generating new private key. Jan 6 05:09:35 HORSE ollama[1613]: Error: could not create directory mkdir /usr/share/ollama: permission denied Jan 6 05:09:35 HORSE systemd[1]: ollama.service: Main process exited, code=exited, status=1/FAILURE Jan 6 05:09:35 HORSE systemd[1]: ollama.service: Failed with result 'exit-code'. Jan 6 05:09:39 HORSE systemd[1]: ollama.service: Service hold-off time over, scheduling restart. Jan 6 05:09:39 HORSE systemd[1]: ollama.service: Scheduled restart job, restart counter is at 340169. Jan 6 05:09:39 HORSE ollama[1647]: Couldn't find '/usr/share/ollama/.ollama/id_ed25519'. Generating new private key. Jan 6 05:09:39 HORSE ollama[1647]: Error: could not create directory mkdir /usr/share/ollama: permission denied ``` After fixing the file owner on this disk, I don't get this error anymore, but still have issues. Might be related to the USB drive spinning down. It takes about 5-10 seconds to spin up when it is cold. ``` Jan 7 00:11:22 HORSE kernel: [ 4880.761124] watchdog: BUG: soft lockup - CPU#4 stuck for 22s! [ollama:14930] Jan 7 00:11:22 HORSE kernel: [ 4880.761178] CPU: 4 PID: 14930 Comm: ollama Tainted: P OEL 5.4.0-150-generic #167~18.04.1-Ubuntu Jan 7 00:12:02 HORSE kernel: [ 4920.785050] watchdog: BUG: soft lockup - CPU#15 stuck for 22s! [ollama:14930] Jan 7 00:12:02 HORSE kernel: [ 4920.785110] CPU: 15 PID: 14930 Comm: ollama Tainted: P OEL 5.4.0-150-generic #167~18.04.1-Ubuntu Jan 7 00:12:30 HORSE kernel: [ 4948.785005] watchdog: BUG: soft lockup - CPU#15 stuck for 22s! [ollama:14930] Jan 7 00:12:30 HORSE kernel: [ 4948.785038] CPU: 15 PID: 14930 Comm: ollama Tainted: P OEL 5.4.0-150-generic #167~18.04.1-Ubuntu Jan 7 00:13:02 HORSE kernel: [ 4980.760958] watchdog: BUG: soft lockup - CPU#3 stuck for 22s! [ollama:14930] Jan 7 00:13:02 HORSE kernel: [ 4980.761001] CPU: 3 PID: 14930 Comm: ollama Tainted: P OEL 5.4.0-150-generic #167~18.04.1-Ubuntu Jan 7 00:13:34 HORSE kernel: [ 5012.760922] watchdog: BUG: soft lockup - CPU#3 stuck for 22s! [ollama:14930] Jan 7 00:13:34 HORSE kernel: [ 5012.760963] CPU: 3 PID: 14930 Comm: ollama Tainted: P OEL 5.4.0-150-generic #167~18.04.1-Ubuntu Jan 7 02:06:27 HORSE kernel: [11786.260697] ptrace attach of "/usr/local/bin/ollama serve"[14903] was attempted by "gdb --batch -ex set style enabled on -ex attach 14903 -ex bt -frame-info source-and-location -ex detach -ex quit"[17265] Jan 7 02:06:54 HORSE kernel: [11812.737913] watchdog: BUG: soft lockup - CPU#4 stuck for 22s! [ollama:14903] Jan 7 02:06:54 HORSE kernel: [11812.737954] CPU: 4 PID: 14903 Comm: ollama Tainted: P OEL 5.4.0-150-generic #167~18.04.1-Ubuntu Jan 7 02:07:22 HORSE kernel: [11840.765849] watchdog: BUG: soft lockup - CPU#16 stuck for 22s! [ollama:14903] Jan 7 02:07:22 HORSE kernel: [11840.765911] CPU: 16 PID: 14903 Comm: ollama Tainted: P OEL 5.4.0-150-generic #167~18.04.1-Ubuntu Jan 7 02:07:50 HORSE kernel: [11868.765784] watchdog: BUG: soft lockup - CPU#16 stuck for 22s! [ollama:14903] Jan 7 02:07:50 HORSE kernel: [11868.765817] CPU: 16 PID: 14903 Comm: ollama Tainted: P OEL 5.4.0-150-generic #167~18.04.1-Ubuntu Jan 7 02:08:22 HORSE kernel: [11900.761709] watchdog: BUG: soft lockup - CPU#15 stuck for 22s! [ollama:14903] Jan 7 02:08:22 HORSE kernel: [11900.761750] CPU: 15 PID: 14903 Comm: ollama Tainted: P OEL 5.4.0-150-generic #167~18.04.1-Ubuntu Jan 7 02:08:54 HORSE kernel: [11932.737634] watchdog: BUG: soft lockup - CPU#4 stuck for 23s! [ollama:14903] Jan 7 02:08:54 HORSE kernel: [11932.737675] CPU: 4 PID: 14903 Comm: ollama Tainted: P OEL 5.4.0-150-generic #167~18.04.1-Ubuntu ``` Tangential: 1. What is the correct name: `OLLAMA_MODEL=/...` or `OLLAMA_MODELS=/...` ? The second doesn't seem to work. 2. It was hard to find how to set it up correctly under systemd and I just gave up and run it from CLI. I just wanted to set the `OLLAMA_HOST`, `OLLAMA_ORIGINS` and `OLLAMA_MODEL` so I can use it from my other computers as well over the web. But no matter how I set the Environment= clause or even create a separate environment.json in `/etc/systemd/system/ollama.service.d` they don't seem to work. Rant: Systemd is like a black box you set something and have no idea why it doesn't work; for example I have no idea with what environment variables it is actually running, and the errors go into obscure places and need arcane commands to be unearthed. Can we have a systemd setup tutorial for the cases where you need to set a few variables? The Linux setup is so sweet if you don't need to change anything. But it becomes tricky if you want to move the models to another folder, change the IP and origins. Maybe the Linux CLI install script could have some arguments to set these variables right at install time, and protect them when doing upgrades.
GiteaMirror added the question label 2026-04-12 10:46:49 -05:00
Author
Owner

@pdevine commented on GitHub (Mar 11, 2024):

Hey @horiacristescu , sorry for the really slow response on this.

Are you still seeing the system freezes? I'm wondering if you are deep into swap on your machine? You also would definitely see performance issues if you're pulling the models off of a USB connected drive. The models by default will unload after 5 minutes and then you will have to reload them, so your machine could be under a lot of IO pressure over the USB bus. You will also have some problems with file names on NTFS since the Linux version of Ollama uses : characters in file names for the blobs which are not supported on NTFS. That's something we're looking to address in the future.

For the tangential questions:

  1. OLLAMA_MODELS is the correct environment variable
  2. There is some documentation in the FAQ which explains how to use systemctl to change the variables.

I'm definitely not a huge fan of systemd either.

<!-- gh-comment-id:1989434566 --> @pdevine commented on GitHub (Mar 11, 2024): Hey @horiacristescu , sorry for the really slow response on this. Are you still seeing the system freezes? I'm wondering if you are deep into swap on your machine? You also would definitely see performance issues if you're pulling the models off of a USB connected drive. The models by default will unload after 5 minutes and then you will have to reload them, so your machine could be under a lot of IO pressure over the USB bus. You will also have some problems with file names on NTFS since the Linux version of Ollama uses `:` characters in file names for the blobs which are not supported on NTFS. That's something we're looking to address in the future. For the tangential questions: 1. `OLLAMA_MODELS` is the correct environment variable 2. There is some documentation in the [FAQ](https://github.com/ollama/ollama/blob/main/docs/faq.md#setting-environment-variables-on-linux) which explains how to use `systemctl` to change the variables. I'm definitely not a huge fan of systemd either.
Author
Owner

@pdevine commented on GitHub (Mar 11, 2024):

LMK if this answers each of your questions and if we can close out the issue.

<!-- gh-comment-id:1989435710 --> @pdevine commented on GitHub (Mar 11, 2024): LMK if this answers each of your questions and if we can close out the issue.
Author
Owner

@dhiltgen commented on GitHub (Jun 1, 2024):

If you're still having problems, please upgrade to the latest version of Ollama. You didn't mention if you're GPU or CPU based, but if GPU, make sure you're running the latest version of the driver (although Nvidia 555 seems to have some rough edges, so maybe aim for ~550). If none of that clears it up, checking the output of something like iostat -dmx 5 will help you see if disk I/O is the bottleneck.

<!-- gh-comment-id:2143565844 --> @dhiltgen commented on GitHub (Jun 1, 2024): If you're still having problems, please upgrade to the latest version of Ollama. You didn't mention if you're GPU or CPU based, but if GPU, make sure you're running the latest version of the driver (although Nvidia 555 seems to have some rough edges, so maybe aim for ~550). If none of that clears it up, checking the output of something like `iostat -dmx 5` will help you see if disk I/O is the bottleneck.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#1044