Skip to content

fix(setup_host): make the script work on ubuntu 26.04 - #174

Merged
blooop merged 1 commit into
mainfrom
fix/setup-host-ubuntu-2604
Sep 12, 2026
Merged

blooop merged 1 commit into
mainfrom
fix/setup-host-ubuntu-2604

Conversation

@blooop

@blooop blooop commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Why

scripts/setup_host.sh aborted partway through on a fresh host regardless of Ubuntu version, leaving pixi, uv and the docker group setup uninstalled. Verified on a clean Ubuntu 26.04.1 (resolute, kernel 7.0.0-31) machine.

Bugs fixed

  • docker run hello-world ran before usermod -aG docker, so it hit permission denied on the socket and set -e killed the script. Group setup now happens right after the docker install, and the smoke tests run under sudo.
  • sudo groupadd docker always failed, since docker-ce already creates the group — another set -e abort. Now guarded with getent.
  • newgrp docker at the end would have spawned an interactive subshell. Ubuntu 26.04 ships neither sg nor newgrp (login is now really util-linux 2.41.3, and shadow's passwd 4.17.4 dropped them), so this is gone in favour of a "log out and back in" message.
  • The conflicting-package removal was a loop without -y, which prompted mid-script. Now a single apt-get remove -y.

Ubuntu 26.04 specifics

  • download.docker.com does publish a resolute suite (docker-ce 29.8.0, containerd.io 2.3.5), so $VERSION_CODENAME still resolves. The script now also falls back to noble if the host's codename has not been published yet.
  • nvidia-docker2 is dropped — deprecated, frozen at 2.14.0 and no longer in NVIDIA's docs. nvidia-container-toolkit alone (1.20.0) is what nvidia-ctk runtime configure needs.

Other

  • The NVIDIA half is skipped unless nvidia-smi -L succeeds, with a hint to install a driver first, rather than installing a toolkit that every GPU container then fails against.
  • gpg --dearmor gains --yes so re-runs do not prompt, and the pixi completion line is only appended to .bashrc once.
  • Added a GPU smoke test using ubuntu:$VERSION_ID. A plain ubuntu image avoids pinning a CUDA version: the toolkit injects nvidia-smi and the driver libraries from the host. nvidia/cuda only publishes ubuntu26.04 tags for CUDA >= 13.3, which sets NVIDIA_REQUIRE_CUDA=cuda>=13.3 and would refuse to start on the 580 driver branch (CUDA 13.0).
  • README.md: the script no longer claims to assume ubuntu 22.04.

Testing

Run end to end on Ubuntu 26.04.1 with an NVIDIA Quadro M2000M and driver 580.178.04. Docker 29.8.0, compose v5.5.1, buildx 0.37.1, nvidia-container-toolkit 1.20.0 and the nvidia runtime in /etc/docker/daemon.json all install cleanly, and the docker group membership is applied.

🤖 Generated with Claude Code

Summary by Sourcery

Make host setup complete reliably across supported Ubuntu releases, including Ubuntu 26.04, with current Docker and NVIDIA container tooling.

New Features:

  • Add NVIDIA-aware GPU container smoke testing and skip toolkit setup when no working NVIDIA driver is detected.
  • Support Docker repository suite fallback for Ubuntu releases not yet published by Docker.

Bug Fixes:

  • Fix host setup aborts caused by Docker group initialization, premature smoke tests, interactive group switching, and prompted package removal.
  • Make Docker, NVIDIA Container Toolkit, pixi, and uv setup complete reliably on supported Ubuntu releases.

Enhancements:

  • Replace deprecated nvidia-docker2 installation with the NVIDIA Container Toolkit.
  • Make setup reruns non-interactive and avoid duplicate pixi shell completion entries.
  • Require non-root execution and provide clear post-installation instructions for applying group membership and PATH changes.

Documentation:

  • Update setup documentation to describe NVIDIA Container Toolkit support and Ubuntu 22.04, 24.04, and 26.04 compatibility.

Tests:

  • Add Docker and optional GPU container smoke tests using the host Ubuntu release image.

The script aborted partway through on a fresh host regardless of Ubuntu
version, leaving pixi, uv and the docker group setup uninstalled:

- docker run hello-world ran before usermod -aG docker, so it hit a
  permission denied on the socket and set -e killed the script. The group
  setup now happens right after the docker install, and the smoke tests
  run under sudo.
- sudo groupadd docker always failed, since docker-ce already creates the
  group. It is now guarded with getent.
- newgrp docker at the end would have spawned an interactive subshell.
  Ubuntu 26.04 ships neither sg nor newgrp, so this is gone in favour of a
  "log out and back in" message.

Ubuntu 26.04 specifics:

- download.docker.com does publish a resolute suite, so $VERSION_CODENAME
  still resolves, but the script now falls back to noble if the host's
  codename has not been published yet.
- nvidia-docker2 is dropped. It is deprecated, frozen at 2.14.0 and no
  longer in NVIDIA's docs; nvidia-container-toolkit alone is what
  nvidia-ctk runtime configure needs.

Other fixes:

- The NVIDIA half is skipped unless nvidia-smi -L succeeds, with a hint to
  install a driver first, rather than installing a toolkit that every GPU
  container then fails against.
- The conflicting-package removal is a single apt-get remove -y instead of
  a loop without -y that prompted mid-script.
- gpg --dearmor gains --yes so re-runs do not prompt, and the pixi
  completion line is only appended to .bashrc once.
- Added a GPU smoke test using ubuntu:$VERSION_ID. A plain ubuntu image
  avoids pinning a CUDA version, since the toolkit injects nvidia-smi and
  the driver libraries from the host.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @blooop, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 1 day and 23 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Sep 12, 2026

Copy link
Copy Markdown

Reviewer's Guide

Updates host provisioning for reliable, non-interactive execution on Ubuntu 22.04–26.04, including Docker repository fallback and group handling, conditional modern NVIDIA Toolkit setup with smoke tests, and idempotent pixi/uv installation guidance.

Sequence diagram for Docker setup and smoke testing

sequenceDiagram
    participant User
    participant Setup as setup_host.sh
    participant Apt
    participant Docker
    participant System

    User->>Setup: Run as non-root user
    Setup->>System: sudo -v
    Setup->>Apt: apt-get remove -y conflicting packages
    Setup->>Apt: Resolve published Docker suite
    Setup->>Apt: apt-get install -y docker-ce and plugins
    Setup->>System: getent group docker
    alt docker group missing
        Setup->>System: groupadd docker
    end
    Setup->>System: usermod -aG docker USER
    Setup->>Docker: sudo docker run --rm hello-world
    Setup->>User: Log out and back in to apply group membership
Loading

Sequence diagram for conditional NVIDIA Container Toolkit setup

sequenceDiagram
    participant Setup as setup_host.sh
    participant Driver
    participant Apt
    participant Docker

    Setup->>Driver: nvidia-smi -L
    alt NVIDIA driver works
        Setup->>Apt: Install nvidia-container-toolkit
        Setup->>Docker: nvidia-ctk runtime configure
        Setup->>Docker: Restart Docker
        Setup->>Docker: sudo docker run --rm --gpus all ubuntu:VERSION_ID nvidia-smi
    else Driver unavailable
        Setup->>Setup: Skip NVIDIA setup
        Setup->>Setup: Print driver installation hint
    end
Loading

Flow diagram for resilient Ubuntu host setup

flowchart TD
    A[Start as non-root user] --> B[sudo -v]
    B --> C[Remove conflicting packages]
    C --> D[Resolve Docker apt suite]
    D --> E[Install Docker]
    E --> F[Ensure docker group]
    F --> G[Add current user to docker group]
    G --> H{nvidia-smi succeeds?}
    H -->|Yes| I[Install NVIDIA Container Toolkit]
    I --> J[Configure NVIDIA Docker runtime]
    J --> K[Restart Docker]
    H -->|No| L[Skip NVIDIA setup and show driver hint]
    K --> M[Run Docker smoke tests]
    L --> M
    M --> N[Install pixi and uv]
    N --> O[Log out and back in]
Loading

File-Level Changes

Change Details Files
Make host setup fail-safe and non-interactive across supported Ubuntu releases.
  • Reject root execution and use strict shell options with a refreshed sudo credential.
  • Replace the per-package removal loop with one non-interactive apt removal.
  • Add Docker repository suite detection with a noble fallback and use consistent apt-get commands.
scripts/setup_host.sh
Correct Docker group setup and validation ordering.
  • Create the docker group only when absent and add the invoking user immediately after Docker installation.
  • Run Docker smoke tests through sudo because group membership is not active in the current shell.
  • Replace the interactive newgrp behavior with post-install logout/reboot guidance.
scripts/setup_host.sh
Modernize and conditionally configure NVIDIA container support.
  • Install only nvidia-container-toolkit instead of deprecated nvidia-docker2.
  • Skip NVIDIA repository/configuration when nvidia-smi cannot validate a working driver.
  • Add an Ubuntu-version-matched GPU smoke test and make key re-generation idempotent.
scripts/setup_host.sh
Improve repeatability and complete developer-tool setup.
  • Make pixi completion insertion idempotent.
  • Retain pixi and uv installation while clearly explaining PATH and group-membership refresh requirements.
scripts/setup_host.sh
Update documentation to reflect supported Ubuntu versions and the current NVIDIA tooling.
  • Remove the Ubuntu 22.04-only implication and document testing on Ubuntu 22.04, 24.04, and 26.04.
README.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@blooop
blooop merged commit dd0602c into main Sep 12, 2026
7 checks passed
@blooop
blooop deleted the fix/setup-host-ubuntu-2604 branch September 12, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant