[PR #15225] scripts: fix installer exiting early when nvidia-smi is found #25628

Open
opened 2026-04-19 18:19:13 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15225
Author: @dhirajlochib
Created: 4/2/2026
Status: 🔄 Open

Base: mainHead: scripts/fix-installer-nvidia-smi-early-exit


📝 Commits (3)

  • 1708709 scripts: fix installer exiting early when nvidia-smi is found
  • 417fd38 scripts: initialize HAS_CUDA variable for set -u compatibility
  • 78b7fb1 scripts: use nvidia-smi to detect GPU presence, not just binary existence

📊 Changes

1 file changed (+11 additions, -3 deletions)

View changed files

📝 scripts/install.sh (+11 -3)

📄 Description

Summary

Fixes the Linux install script exiting immediately after detecting nvidia-smi, which prevents AMD ROCm installation.

Problem

The install script calls exit 0 right after finding nvidia-smi:

if check_gpu nvidia-smi; then
    status "NVIDIA GPU installed."
    exit 0  # exits before checking for AMD GPUs
fi

This breaks two scenarios:

  1. Mixed GPU systems — NVIDIA + AMD GPUs present, but ROCm is never installed for the AMD GPU
  2. Orphaned nvidia-sminvidia-smi left over from a previous driver install (no actual NVIDIA hardware), causing the script to skip all GPU detection

Fix

Instead of exiting, set a HAS_CUDA flag and continue to the AMD GPU detection:

  1. If nvidia-smi is found, set HAS_CUDA=true and continue
  2. AMD GPU detection proceeds normally — ROCm is downloaded if AMD hardware is found
  3. After AMD is handled, if HAS_CUDA was true, skip redundant CUDA driver installation and exit
  4. The misleading "No NVIDIA/AMD GPU detected" warning is suppressed when nvidia-smi is present

Fixes #15184


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/15225 **Author:** [@dhirajlochib](https://github.com/dhirajlochib) **Created:** 4/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `scripts/fix-installer-nvidia-smi-early-exit` --- ### 📝 Commits (3) - [`1708709`](https://github.com/ollama/ollama/commit/17087091232e14c464dbc1cb912e3ffa28620b1e) scripts: fix installer exiting early when nvidia-smi is found - [`417fd38`](https://github.com/ollama/ollama/commit/417fd38be7e74f1bbc2640875458f5022363dfc7) scripts: initialize HAS_CUDA variable for set -u compatibility - [`78b7fb1`](https://github.com/ollama/ollama/commit/78b7fb14bde9d338b4ec29692663b77d5b90d861) scripts: use nvidia-smi to detect GPU presence, not just binary existence ### 📊 Changes **1 file changed** (+11 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `scripts/install.sh` (+11 -3) </details> ### 📄 Description ## Summary Fixes the Linux install script exiting immediately after detecting `nvidia-smi`, which prevents AMD ROCm installation. ## Problem The install script calls `exit 0` right after finding `nvidia-smi`: ```bash if check_gpu nvidia-smi; then status "NVIDIA GPU installed." exit 0 # exits before checking for AMD GPUs fi ``` This breaks two scenarios: 1. **Mixed GPU systems** — NVIDIA + AMD GPUs present, but ROCm is never installed for the AMD GPU 2. **Orphaned nvidia-smi** — `nvidia-smi` left over from a previous driver install (no actual NVIDIA hardware), causing the script to skip all GPU detection ## Fix Instead of exiting, set a `HAS_CUDA` flag and continue to the AMD GPU detection: 1. If `nvidia-smi` is found, set `HAS_CUDA=true` and continue 2. AMD GPU detection proceeds normally — ROCm is downloaded if AMD hardware is found 3. After AMD is handled, if `HAS_CUDA` was true, skip redundant CUDA driver installation and exit 4. The misleading "No NVIDIA/AMD GPU detected" warning is suppressed when `nvidia-smi` is present Fixes #15184 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-19 18:19:13 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#25628