Skip to content

Ollama

  • Proxmox
  • NVIDIA GPU

Install the NVIDIA drivers on the Proxmox host. The Proxmox forum guide by bialykostek was used as a reference.

  1. Create a blacklist file:

    Terminal window
    nano /etc/modprobe.d/blacklist-nouveau.conf
  2. Add the following, then save and close the file:

    blacklist nouveau
    options nouveau modeset=0
  3. Update the initramfs:

    Terminal window
    update-initramfs -u
  4. Check whether the Nouveau module is loaded:

    Terminal window
    lsmod | grep nouveau
  5. If it is loaded, unload it and check again:

    Terminal window
    rmmod nouveau
    lsmod | grep nouveau
  6. Confirm that the GPU is visible:

    Terminal window
    lspci | grep NVIDIA
  7. Install the build dependencies and matching headers:

    Terminal window
    apt update
    apt install -y build-essential dkms wget ca-certificates
    apt install -y "proxmox-headers-$(uname -r)"
  8. Download and install a compatible NVIDIA driver. Select a driver version appropriate for your GPU and Proxmox kernel:

    Terminal window
    cd /root
    wget https://download.nvidia.com/XFree86/Linux-x86_64/580.178.04/NVIDIA-Linux-x86_64-580.178.04.run
    chmod +x NVIDIA-Linux-x86_64-580.178.04.run
    ./NVIDIA-Linux-x86_64-580.178.04.run -m=kernel --dkms --no-questions

    Follow the installer prompts. On a headless Proxmox host, decline any X configuration options.

  9. Verify the installation:

    Terminal window
    nvidia-smi
  10. Optionally enable persistence mode:

    Terminal window
    nvidia-smi --persistence-mode=1
    nvidia-persistenced

Use the Ollama Proxmox helper script to create the LXC. After installation:

  1. Stop the LXC. In the PVE shell, set ownership for the models dataset if the container is unprivileged, then add a mount point to the LXC configuration:

    Terminal window
    chown -R UID:GID /poolname/datasetname
    echo "mp0: /poolname/datasetname,mp=/mnt/ollama-models" >> /etc/pve/lxc/104.conf
  2. Start the LXC. In its shell, edit the Ollama service configuration:

    Terminal window
    systemctl edit ollama

    Add the following settings. If OLLAMA_HOST already exists, update its value:

    [Service]
    Environment="OLLAMA_HOST=0.0.0.0:11434"
    Environment="OLLAMA_MODELS=/mnt/ollama-models"

    Save and close the editor.

    Binding to 0.0.0.0 makes Ollama reachable on all network interfaces. Restrict access to trusted clients using your firewall and network configuration.

  3. Reload systemd and restart Ollama:

    Terminal window
    systemctl daemon-reload
    systemctl restart ollama
  4. Verify the GPU and bind mount:

    Terminal window
    nvidia-smi
    findmnt /mnt/ollama-models
  5. Download and run a model:

    Terminal window
    ollama run qwen3:8b

Container fails to start after the host boots

Section titled “Container fails to start after the host boots”

TASK ERROR: Device /dev/nvidia0 does not exist

Section titled “TASK ERROR: Device /dev/nvidia0 does not exist”

This can indicate that the NVIDIA kernel modules are not loaded on the host.

  1. Check whether the modules are loaded:

    Terminal window
    lsmod | grep nvidia
  2. If they are not loaded, load the required modules and verify the device files:

    Terminal window
    modprobe nvidia
    modprobe nvidia-uvm
    modprobe nvidia-drm
    ls -l /dev/nvidia*

    If the container configuration includes nvidia-modeset as a device resource, remove that entry for this headless Ollama setup.