Skip to content

fix(validator): say why host driver validation failed - #3086

Open
fjvbn2003 wants to merge 2 commits into
NVIDIA:mainfrom
fjvbn2003:validator-driver-failure-reason
Open

fjvbn2003 wants to merge 2 commits into
NVIDIA:mainfrom
fjvbn2003:validator-driver-failure-reason

Conversation

@fjvbn2003

@fjvbn2003 fjvbn2003 commented Oct 16, 2026 •

Copy link
Copy Markdown

Description

When a node has a pre-installed driver (driver.enabled=false) and nvidia-smi on the host cannot talk to the driver, for example after the driver packages were upgraded without a reboot, the driver-validation init container logs the following. This output is from the reproduction described under Testing, not from a real node: the fake host nvidia-smi exits with 18, which I picked because it is NVML_ERROR_LIB_RM_VERSION_MISMATCH in nvml.h. I later measured a real mismatch: on a host with kernel module 580.95.05, the 610.43.03 nvidia-smi and libnvidia-ml (extracted from the installer, not installed) print Failed to initialize NVML: Driver/library version mismatch and exit 18 in 10 of 10 runs, so the reproduction matches. The validator logs whatever exit status nvidia-smi returns.

Attempting to validate a pre-installed driver on the host
Failed to initialize NVML: Driver/library version mismatch
No pre-installed driver detected on the host: exit status 18
Validating containerized driver installation
Attempting to validate a driver container installation
failed to validate the driver, retrying after 5 seconds\n
failed to validate the driver, retrying after 5 seconds\n
...

and stays in Init forever. Both log lines point away from the problem. A driver is installed on the host, and the retry warning never says what failed (it also prints a literal \n). #1276 and #1687 show users stuck on the same retry line without a reason.

This PR:

  • validateHostDriver: when nvidia-smi was found on the host but failed, return found '<path>' on the host, but running it failed: <err>.
  • runValidation: log No usable pre-installed driver detected on the host: ... instead of No pre-installed driver detected ....
  • validateDriverContainer: include the error in the retry warning and drop the trailing \n.

Control flow does not change. Validation still falls through to the driver container path, which is still needed when the host has a stray nvidia-smi but the driver comes from the driver container.

This overlaps with #3034 on the retry warning line. If #3034 merges first, I will rebase and move the error into the warning in waitForDriver.

Checklist

  • No secrets, sensitive information, or unrelated changes
  • Lint checks passing (make lint) (golangci-lint not available locally; gofmt -s and go vet with GOOS=linux are clean)
  • Generated assets in-sync (make validate-generated-assets) (no generated files changed)
  • Go mod artifacts in-sync (make validate-modules) (no module changes)
  • Test cases are added for new code paths (log/error text only; validateHostDriver chroots into /host, so it is not unit-testable without a refactor)

Testing

  • go test ./cmd/nvidia-validator/ passes.
  • On a cluster running GPU Operator v26.3.3, I ran the validator on a GPU node in a temporary pod with the nvidia-operator-validator service account. /host was a fake root whose /usr/bin/nvidia-smi prints Failed to initialize NVML: Driver/library version mismatch and exits with 18. The run used WITH_WAIT=true, --component driver, and a 12s timeout, and I ran it once with the main binary and once with the patched binary, both built from the same commit (CGO_ENABLED=0 GOOS=linux).

Before (main):

level=info msg="No pre-installed driver detected on the host: exit status 18"
level=warning msg="failed to validate the driver, retrying after 5 seconds\n"

After:

level=info msg="No usable pre-installed driver detected on the host: found '/usr/bin/nvidia-smi' on the host, but running it failed: exit status 18"
level=warning msg="failed to validate the driver, retrying after 5 seconds: failed to locate driver libraries: error locating \"libnvidia-ml.so.1\""

Prepared with help from Claude (AI), including the local checks described above.

Fixes #3085

🤖 Generated with Claude Code

@copy-pr-bot

copy-pr-bot Bot commented Oct 16, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@fjvbn2003
fjvbn2003 requested a review from a team as a code owner October 16, 2026 15:51
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

📝 Walkthrough

Host driver validation errors now identify the resolved nvidia-smi path and wrap the command error. Driver-container retry warnings include the validation error. The fallback log refers to the absence of a usable pre-installed driver.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: 🔵 Low · up to f68b4

Operator-validation retry warnings omit why host nvidia-smi failed, although that error is logged earlier. Include both errors to make the retry diagnostic actionable.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

🟡 Other comments: 1
cmd/nvidia-validator/main.go: 1

803-803: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Carry the host validation error into the retry warning.

With WITH_WAIT=true, this warning formats the separate container-validation error. Driver.runValidation has the host nvidia-smi execution error, but the retry path does not receive it. This omits the underlying host error required by issue #3085. Pass the host error into the container retry path and include both errors in the warning.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/gpu-operator/.coderabbit.yaml
  • Review profile: QUIET
  • Plan: Enterprise
  • Run ID: 36d15131-7599-43d7-a71c-706a25d4eff3
📥 Commits

Reviewing files that changed from the base of the PR and between dbb11e8 and f68b443.

📒 Files selected for processing: 1
  • cmd/nvidia-validator/main.go

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

@fjvbn2003

Copy link
Copy Markdown
Author

@coderabbitai Thanks. The host error is not lost: runValidation logs it once, right before it falls back to the containerized check, so with this change the log reads

No usable pre-installed driver detected on the host: found '/usr/bin/nvidia-smi' on the host, but running it failed: exit status 18
Validating containerized driver installation
failed to validate the driver, retrying after 5 seconds: failed to locate driver libraries: error locating "libnvidia-ml.so.1"

(measured with a fake nvidia-smi that exits 18, WITH_WAIT=true). Repeating the host error on every 5-second retry would add the same line forever, so I kept it in the one-time message. Happy to carry it into the retry warning as well if the maintainers prefer that.

This reply was drafted with AI assistance and reviewed by me.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@fjvbn2003 The supplied log shows that runValidation preserves the host error in the one-time fallback message. The retry warning then reports the containerized validation error. Repeating the host error on every retry is unnecessary. I withdraw the concern.


✏️ Learnings added
Learnt from: fjvbn2003
URL: https://github.com/NVIDIA/gpu-operator/pull/3086

Timestamp: 2026-10-16T15:57:40.487Z
Learning: In NVIDIA/gpu-operator, cmd/nvidia-validator/main.go uses Driver.runValidation to log the host-driver validation error once before falling back to containerized driver validation. Retry warnings report the containerized validation error. Do not require the host error to be repeated in every retry warning; the one-time fallback message retains that diagnostic.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

You are interacting with an AI system.

Comment thread cmd/nvidia-validator/main.go Outdated
args := append([]string{"/host", nvidiaSMIPath}, nvidiaSMIArgs()...)

return runCommand(command, args, silent)
if err := runCommand(command, args, silent); err != nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is it being assumed that the error code was 18?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good question. The code doesn't assume 18: it wraps whatever runCommand returns. With a stub host nvidia-smi exiting 9, 12, 18 and 255, the log shows each status as is, and the new tests check 9 and 18 (below).

The 18 in the description first came from my reproduction (a stub nvidia-smi that prints the mismatch message and exits 18, picked because it is NVML_ERROR_LIB_RM_VERSION_MISMATCH), and the description didn't say so. You were right to ask. I then measured a real mismatch: on a host with kernel module 580.95.05, the 610.43.03 nvidia-smi and libnvidia-ml (extracted from the installer, not installed) print Failed to initialize NVML: Driver/library version mismatch and exit 18 in 10 of 10 runs; the unmodified host gives 0. I updated the description and the commit message to say which output is measured and which is reproduced.

I also reworded the code comment so it doesn't guess the cause.

(Measured and written with help from Claude (AI).)

devin-ai-integration[bot]

This comment was marked as resolved.

When the host has nvidia-smi but the user-space driver libraries and the
loaded kernel module differ, for example after the driver packages were
upgraded without a reboot, nvidia-smi cannot initialize NVML. Measured
on a host with kernel module 580.95.05 and the 610.43.03 nvidia-smi and
libnvidia-ml (extracted from the installer, not installed): nvidia-smi
prints "Failed to initialize NVML: Driver/library version mismatch" and
exits 18, in 10 of 10 runs.

With a stub host nvidia-smi that prints the same message and exits 18,
the driver-validation init container logs:

  No pre-installed driver detected on the host: exit status 18
  ...
  failed to validate the driver, retrying after 5 seconds\n

and then retries the driver container path forever. Both lines point
away from the real problem: a driver is installed on the host, and the
retry warning never says what failed (it also prints a literal "\n").

- validateHostDriver: when nvidia-smi was found on the host but failed
  to run, return an error that says so and names the binary. The error
  keeps nvidia-smi's own exit status; the comment does not guess the
  cause. Checked with the stub exiting 9, 12, 18 and 255.
- runValidation: log "No usable pre-installed driver detected" instead
  of "No pre-installed driver detected".
- validateDriverContainer: include the error in the retry warning and
  drop the trailing "\n".

No change in control flow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: YoungjuKim <[email protected]>
@fjvbn2003
fjvbn2003 force-pushed the validator-driver-failure-reason branch from d6e2be4 to beeb9ff Compare November 3, 2026 06:07
Add regression tests for the error reporting changed in the previous
commit.

- validateHostDriver now delegates to validateHostDriverInRoot, which
  takes the host root and the command runner as arguments. Production
  still passes "/host" and runCommand, so behavior is unchanged.
- TestValidateHostDriverReportsHostNvidiaSMIFailure (linux only, since
  resolveHostNvidiaSMI is linux only) puts an executable nvidia-smi in
  a fake host root and makes the runner fail with a real
  *exec.ExitError (status 9 and 18) or a plain error. It asserts that
  chroot is called with the resolved host path, that the error names
  '/usr/bin/nvidia-smi' and keeps the original error text, and that
  errors.Is/errors.As still reach the original error and exit status.
- TestValidateDriverContainerRetryWarningIncludesError runs
  validateDriverContainer with a fake nvidia-smi that exits 18 once and
  then succeeds, and asserts that the single retry warning contains
  "exit status 18" and does not end with "\n".

With the previous validateHostDriver body (return the runner error
as is) and the previous retry warning, all four cases fail. Wrapping
with %v instead of %w also fails the errors.Is/errors.As checks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: YoungjuKim <[email protected]>

This branch has not been deployed

No deployments
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.

[Bug]: driver-validation hides why a pre-installed driver failed and loops without a reason

2 participants