ollama - ✅(Solved) Fix install.sh returns "Install complete" despite sudo timeout / failure (False Positive) [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
ollama/ollama#14998Fetched 2026-04-08 01:12:49
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Timeline (top)
cross-referenced ×2referenced ×2closed ×1commented ×1

Error Message

Instead of exiting with an error code, the script continued to the next steps and printed >>> Install complete. Run "ollama" from the command line., even though the environment was not properly configured (service wasn't created and user wasn't added). The script should check the exit status ($?) of each critical command. If a command fails (especially user creation or service setup), the script should terminate immediately with an error message and a non-zero exit code.

Fix Action

Fixed

PR fix notes

PR #15001: fix: exit on critical sudo failures in install.sh

Description (problem / solution / changelog)

Summary

  • Fixes the install.sh script silently reporting "Install complete" even when critical sudo commands fail (e.g., sudo timeout, wrong password)
  • Adds explicit || error "..." checks after each critical sudo command in configure_systemd(): useradd, usermod, tee (service file), systemctl daemon-reload, systemctl enable, and systemctl restart
  • Makes the install_success EXIT trap check the exit code ($?) so it does not print a false success message when the script exits due to a prior failure

Fixes #14998

Test plan

  • Run install.sh normally on a Linux system with systemd — verify it completes successfully and prints "Install complete"
  • Run install.sh and let the sudo password prompt time out — verify the script exits with an error message instead of "Install complete"
  • Run install.sh on a system without systemd — verify it still works (the configure_systemd path is skipped)
  • Run sh -n scripts/install.sh to confirm no syntax errors

🤖 Generated with Claude Code

Changed files

  • scripts/install.sh (modified, +26/-8)

Code Example

Steps to Reproduce:
Run the official install command: curl -fsSL https://ollama.com/install.sh | sh

When prompted for a password, wait for the sudo timeout (or enter an incorrect password).

Observe that the script ignores the failure of the sudo command and concludes with a success message.

Expected Behavior:
The script should check the exit status ($?) of each critical command. If a command fails (especially user creation or service setup), the script should terminate immediately with an error message and a non-zero exit code.

Actual Behavior:
The script suppresses or ignores failures during the sudo execution block and reports a successful installation.
RAW_BUFFERClick to expand / collapse

What is the issue?

While installing Ollama on Ubuntu 24.04 (using sudo-rs), the installation script's sudo authentication timed out during the "Creating ollama user" stage.

Instead of exiting with an error code, the script continued to the next steps and printed >>> Install complete. Run "ollama" from the command line., even though the environment was not properly configured (service wasn't created and user wasn't added).

Relevant log output

Steps to Reproduce:
Run the official install command: curl -fsSL https://ollama.com/install.sh | sh

When prompted for a password, wait for the sudo timeout (or enter an incorrect password).

Observe that the script ignores the failure of the sudo command and concludes with a success message.

Expected Behavior:
The script should check the exit status ($?) of each critical command. If a command fails (especially user creation or service setup), the script should terminate immediately with an error message and a non-zero exit code.

Actual Behavior:
The script suppresses or ignores failures during the sudo execution block and reports a successful installation.

OS

Linux

GPU

Nvidia

CPU

Intel, AMD

Ollama version

0.18.2

extent analysis

Fix Plan

To address the issue, we need to modify the installation script to check the exit status of critical commands, especially those related to user creation and service setup.

Here are the steps:

  • Modify the install.sh script to check the exit status ($?) after each critical command.
  • If a command fails, terminate the script immediately with an error message and a non-zero exit code.

Example code snippet:

# Create ollama user
sudo useradd -m ollama
if [ $? -ne 0 ]; then
  echo "Failed to create ollama user"
  exit 1
fi

# Create service
sudo systemctl start ollama.service
if [ $? -ne 0 ]; then
  echo "Failed to start ollama service"
  exit 1
fi

Alternatively, you can use set -e at the beginning of the script to exit immediately if any command fails:

set -e
sudo useradd -m ollama
sudo systemctl start ollama.service

Verification

To verify the fix, run the modified installation script and intentionally cause a command to fail (e.g., by entering an incorrect password). The script should terminate with an error message and a non-zero exit code.

Extra Tips

  • Always check the exit status of critical commands in scripts to ensure that errors are properly handled.
  • Use set -e to simplify error handling in scripts.
  • Test scripts thoroughly to catch any potential issues before releasing them to production.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING