Skip to content

nvidia: split patchelf invocations - #576397

Merged
SomeoneSerge merged 1 commit into
NixOS:masterfrom
TPi-Home:fix-nvidia-patchelf-invocations
Oct 21, 2026
Merged

SomeoneSerge merged 1 commit into
NixOS:masterfrom
TPi-Home:fix-nvidia-patchelf-invocations

Conversation

@TPi-Home

Copy link
Copy Markdown
Contributor

In local testing, applying --set-rpath and --interpreter together in a single patchelf invocation consistently produced an nvidia-smi binary that segfaulted. Applying the same changes in separate invocations, with the RPATH set first and the interpreter second, produced a working binary. Applying either change individually also worked.

These results strongly suggest an interaction between the two operations when performed in a single invocation. The underlying cause within patchelf has not yet been identified.

@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 12.first-time contribution This PR is the author's first one; please be gentle! 9.needs: reviewer This PR currently has no reviewers requested and needs attention. 7.no default reviewers This PR targets a package or module with no existing maintainers; roving reviewers, take pity! 6.topic: nvidia Nvidia-specific issues and fixes labels Oct 20, 2026
@dramforever

Copy link
Copy Markdown
Contributor

links: workaround for #576412 and NixOS/patchelf#674

@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 1 This PR was reviewed and approved by one person. and removed 9.needs: reviewer This PR currently has no reviewers requested and needs attention. labels Oct 20, 2026
@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 2 This PR was reviewed and approved by two persons. and removed 12.approvals: 1 This PR was reviewed and approved by one person. labels Oct 20, 2026
@TPi-Home

Copy link
Copy Markdown
Contributor Author

Update: I tested this against upstream Patchelf master at 3e996db, which includes [PR #672](NixOS/patchelf#672).

Both tests used the same original nvidia-smi binary, interpreter, and RPATH, applied in a single Patchelf invocation.

=== old: patch exit 0 ===
Segmentation fault (core dumped)
Run exit: 139

=== new: patch exit 0 ===
GPU 0: NVIDIA GeForce RTX 3080
Run exit: 0

So it looks like the upstream fix resolves this particular issue. Given the rebuild concerns around updating Patchelf, the change in this PR could still serve as a temporary workaround for Nvidia until the updated Patchelf can be brought into NixOS.

@niklaskorz

Copy link
Copy Markdown
Member

Squash the second commit into the first to solve the CI error

basnijholt added a commit to basnijholt/dotfiles that referenced this pull request Oct 20, 2026
nixpkgs 09063bd (current nixos-unstable) ships patchelf 0.19.2, which
aborts in shiftFile while patching CUDA redists (cuda_sanitizer_api
fails on pc) and produces segfaulting nvidia-smi/nvidia-powerd
binaries, breaking pc's nvidia-undervolt service.

Fixes are NixOS/nixpkgs#575979 (merged to master, not yet in
nixos-unstable) and NixOS/nixpkgs#576397 (open). Update again once
both reach nixos-unstable.
basnijholt added a commit to basnijholt/dotfiles that referenced this pull request Oct 20, 2026
Re-apply the flake input update held back in the previous commit
(nixpkgs 09063bd) and fix what it breaks on pc:

- patchelf 0.19.2 aborts in shiftFile while patching CUDA redists and
  writes segfaulting nvidia-smi/nvidia-powerd binaries. Pin CUDA redists
  (via _cuda.extensions) and the NVIDIA driver to patchelf 0.15.2, like
  NixOS/nixpkgs#575979; NixOS/nixpkgs#576397 is still open. Each pin
  disables itself with a warning once its upstream fix is in nixpkgs.
- Build CUDA kernels for sm_86 only (cudaCapabilities = [ "8.6" ]); the
  CUDA 12.9 -> 13.4 default bump otherwise compiles opencv and friends
  for ten architectures locally.
- llama-cpp b11756 already contains the patch nixpkgs backports, and its
  new test-llama-context-model pulls in the network-only
  test-download-model fixture, so drop the patch and disable the test.
- whisper-cpp now links llama-cpp's ggml; our llama-cpp drops
  GGML_BACKEND_DL so that link needs libcuda.so.1. Use the cached CPU
  whisper-cpp on stock llama-cpp (only ffmpeg-full uses it).
- Drop HandBrake's A15 pgssubdec ffmpeg patch, which no longer applies
  to ffmpeg 8.1.3 (NixOS/nixpkgs#576333, fix in NixOS/nixpkgs#576407).
auto-merge was automatically disabled October 21, 2026 03:52

Head branch was pushed to by a user without write access

@TPi-Home
TPi-Home force-pushed the fix-nvidia-patchelf-invocations branch from 4d2ebf3 to 70ec044 Compare October 21, 2026 03:52
@TPi-Home

Copy link
Copy Markdown
Contributor Author

Squashed the commits as requested!

@SomeoneSerge
SomeoneSerge added this pull request to the merge queue Oct 21, 2026
Merged via the queue into NixOS:master with commit ae9ba0c Oct 21, 2026
27 checks passed
cramt added a commit to cramt/nixconf that referenced this pull request Oct 23, 2026
patchelf 0.19.2 maps .dynamic read-only when --interpreter and --set-rpath
run in one call; ld.so faults writing DT_DEBUG. Backports NixOS/nixpkgs#576397
until our nixpkgs carries it.
iedame added a commit to iedame/nixos-configs that referenced this pull request Oct 27, 2026
nixpkgs now calls patchelf twice in the NVIDIA builder, setting the
rpath before the interpreter (NixOS/nixpkgs#576397), which fixes the
nvidia-smi crash of NixOS/nixpkgs#576412. The override's
--replace-fail pattern no longer matches, so it has to go with this
update.

Assisted-by: Claude Code (Claude Opus 5.5)
iedame added a commit to iedame/nixos-configs that referenced this pull request Oct 27, 2026
* chore: flake update - 2026-10-27

* claude-code: build mcp-nixos against mcp 1.x, for now

nixpkgs moved python3Packages.mcp to 2.x, and marked fastmcp-slim
broken because fastmcp doesn't support it yet, so mcp-nixos no longer
evaluates and the hosts with Claude Code (Kawagoe, Aurora, Akihabara)
fail. Override its Python scope with mcp_1, as nixpkgs did for ha-mcp
(NixOS/nixpkgs#578535), until mcp-nixos evaluates again.

Assisted-by: Claude Code (Claude Opus 5.5)

* aurora: drop the NVIDIA patchelf override

nixpkgs now calls patchelf twice in the NVIDIA builder, setting the
rpath before the interpreter (NixOS/nixpkgs#576397), which fixes the
nvidia-smi crash of NixOS/nixpkgs#576412. The override's
--replace-fail pattern no longer matches, so it has to go with this
update.

Assisted-by: Claude Code (Claude Opus 5.5)

---------

Co-authored-by: nixos-configs-bot[bot] <340610392+nixos-configs-bot[bot]@users.noreply.github.com>
Co-authored-by: Rafael Ieda <[email protected]>
Ramblurr added a commit to Ramblurr/nixcfg that referenced this pull request Oct 28, 2026
The unstable pin already splits the patchelf RPATH and interpreter edits
from NixOS/nixpkgs#576397. Remove the duplicate
builder patch without changing the selected driver or its settings.

Validation: Quine driver build and nvidia-smi --help pass; nixfmt,
git diff --check, and active LSP diagnostics are clean.
Sammyalhashe added a commit to Sammyalhashe/nixosConfig that referenced this pull request Nov 5, 2026
alcxyz added a commit to alcxyz/nix-config that referenced this pull request Nov 7, 2026
The nixpkgs pin now includes NixOS/nixpkgs#576397, so the driver builder
already patches its binaries in two calls and the local re-patch is redundant.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nvidia Nvidia-specific issues and fixes 7.no default reviewers This PR targets a package or module with no existing maintainers; roving reviewers, take pity! 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. 12.approvals: 2 This PR was reviewed and approved by two persons. 12.first-time contribution This PR is the author's first one; please be gentle!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants