[GH-ISSUE #7283] Ollama Fails to Start On Ubuntu Server OS (Headless) when using a GPU #66683

Closed
opened 2026-05-04 07:47:41 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @F1zzyD on GitHub (Oct 21, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/7283

What is the issue?

Ollama fails to load using docker-compose on a headless Ubuntu server. I have installed, purged, reinstalled, purged, and re-reinstalled drivers, docker, docker-compose, etc. and nothing allows Ollama to boot. Here is my compose.yml:
services:

  ollama:
    container_name: ollama
    ports:
      - "11434:11434"
    volumes:
      - /home/admin/services/ollama:/root/.ollama
    restart: unless-stopped
    image: ollama/ollama
    deploy:
      resources:
        reservations:
          devices:
            - driver: ${OLLAMA_GPU_DRIVER-nvidia}
              count: all
              capabilities:
                - gpu

When using docker compose up -d I get this output:

Failed to deploy a stack: Network ollamatest_default Creating Network ollamatest_default Created Container ollama Creating Container ollama Created Container ollama Starting Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running hook #0: error running hook: exit status 1, stdout: , stderr: Auto-detected mode as 'legacy' nvidia-container-cli: initialization error: load library failed: libnvidia-ml.so.1: cannot open shared object file: no such file or directory: unknown 

I have used Ollama on the desktop version of Ubuntu with zero issues, but it seems that Ollama does not work on a headless version of Ubuntu, which is rather silly.

OS

Linux

GPU

Nvidia

CPU

AMD

Ollama version

latest

Originally created by @F1zzyD on GitHub (Oct 21, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/7283 ### What is the issue? Ollama fails to load using docker-compose on a headless Ubuntu server. I have installed, purged, reinstalled, purged, and re-reinstalled drivers, docker, docker-compose, etc. and nothing allows Ollama to boot. Here is my compose.yml: services: ``` ollama: container_name: ollama ports: - "11434:11434" volumes: - /home/admin/services/ollama:/root/.ollama restart: unless-stopped image: ollama/ollama deploy: resources: reservations: devices: - driver: ${OLLAMA_GPU_DRIVER-nvidia} count: all capabilities: - gpu ``` When using `docker compose up -d` I get this output: ``` Failed to deploy a stack: Network ollamatest_default Creating Network ollamatest_default Created Container ollama Creating Container ollama Created Container ollama Starting Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running hook #0: error running hook: exit status 1, stdout: , stderr: Auto-detected mode as 'legacy' nvidia-container-cli: initialization error: load library failed: libnvidia-ml.so.1: cannot open shared object file: no such file or directory: unknown ``` I have used Ollama on the desktop version of Ubuntu with zero issues, but it seems that Ollama does not work on a headless version of Ubuntu, which is rather silly. ### OS Linux ### GPU Nvidia ### CPU AMD ### Ollama version latest
GiteaMirror added the bug label 2026-05-04 07:47:41 -05:00
Author
Owner

@rick-github commented on GitHub (Oct 21, 2024):

 nvidia-container-cli: initialization error: load library failed: libnvidia-ml.so.1: 
  cannot open shared object file: no such file or directory: unknown 
$ apt-file search libnvidia-ml.so.1
libnvidia-compute-390: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1
libnvidia-compute-418-server: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1
libnvidia-compute-450-server: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1
libnvidia-compute-470: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1
libnvidia-compute-470-server: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1
libnvidia-compute-510: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1
libnvidia-compute-510-server: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1
libnvidia-compute-535: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1
libnvidia-compute-535-server: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1
libnvidia-compute-545: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1
libnvidia-compute-550: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1
libnvidia-compute-550-server: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1

Headless Ubuntu probably doesn't install nvidia drivers by default because headless. Even though you are using the GPU just for inference, you need to install the drivers to allow ollama to communicate with the GPU.

<!-- gh-comment-id:2427402976 --> @rick-github commented on GitHub (Oct 21, 2024): ``` nvidia-container-cli: initialization error: load library failed: libnvidia-ml.so.1: cannot open shared object file: no such file or directory: unknown ``` ``` $ apt-file search libnvidia-ml.so.1 libnvidia-compute-390: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1 libnvidia-compute-418-server: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1 libnvidia-compute-450-server: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1 libnvidia-compute-470: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1 libnvidia-compute-470-server: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1 libnvidia-compute-510: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1 libnvidia-compute-510-server: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1 libnvidia-compute-535: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1 libnvidia-compute-535-server: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1 libnvidia-compute-545: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1 libnvidia-compute-550: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1 libnvidia-compute-550-server: /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1 ``` Headless Ubuntu probably doesn't install nvidia drivers by default because headless. Even though you are using the GPU just for inference, you need to install the drivers to allow ollama to communicate with the GPU.
Author
Owner

@F1zzyD commented on GitHub (Nov 8, 2024):

I switched back to desktop Ubuntu as I was having too many issues running it in headless for my purposes. However, I wanted to give an update. When I posted this bug, I had already installed NVIDIA drivers. Running 'nvidia-smi' showed my GPU and related stats. Ollama still failed to find an initialize the GPU and refused to start.

Since I've moved back to desktop I'll just chop this up as Ollama not working on headless Ubuntu

<!-- gh-comment-id:2464783854 --> @F1zzyD commented on GitHub (Nov 8, 2024): I switched back to desktop Ubuntu as I was having too many issues running it in headless for my purposes. However, I wanted to give an update. When I posted this bug, I had already installed NVIDIA drivers. Running 'nvidia-smi' showed my GPU and related stats. Ollama still failed to find an initialize the GPU and refused to start. Since I've moved back to desktop I'll just chop this up as Ollama not working on headless Ubuntu
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#66683