Repository navigation
Description
Nixpkgs version
- Unstable (26.11)
Describe the bug
Since the nixos-unstable update that moved patchelf from 0.15.2 to 0.19.2, nvidia-smi from nvidia-x11 segfaults immediately on every invocation, before any library is loaded. The driver itself is unaffected (kernel module loads, desktop/GPU work); only the patched bin/ executables are broken.
This looks like the upstream patchelf bug NixOS/patchelf#674: running --interpreter and --set-rpath in one patchelf invocation produces a broken binary. The nvidia-x11 builder does exactly that for nvidia-smi, nvidia-cuda-mps-*, nvidia-debugdump and nvidia-powerd:
nixpkgs/pkgs/os-specific/linux/nvidia-x11/builder.sh
Lines 203 to 204 in 09063bd
| patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ | |
| --set-rpath $out/lib:$libPath $bin/bin/$i |
patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath $out/lib:$libPath $bin/bin/$iIn the resulting ELF the read-only LOAD segment overlaps the writable one and .dynamic ends up mapped read-only, so ld.so crashes with SEGV_ACCERR in dl_main (presumably when it writes DT_DEBUG).
Program headers of the old (working) and new (broken) build of the same driver:
old (patchelf 0.15.2)
LOAD 0x000000 0x3ff000 ... 0x001000 RW
DYNAMIC 0x000318 0x3ff318 ... 0x0001f0 RW
LOAD 0x001000 0x400000 ... 0x003418 R
Segment 03: .dynamic <- inside the RW LOAD
new (patchelf 0.19.2)
LOAD 0x000000 0x3ff000 ... 0x002670 RW <- covers up to 0x401670
LOAD 0x0012c4 0x4002c4 ... 0x003154 R <- starts at 0x4002c4, overlaps
DYNAMIC 0x002480 0x401480 ... 0x0001f0 RW
Segment 06: .dynstr .dynamic .gnu.version ... .rela.plt <- .dynamic inside the R LOAD
Things ruled out:
- glibc (2.44-25 -> 2.44-57 changed in the same update): the old binary runs fine with the new
ld.so, and the new binary crashes with the oldld.so. - Libraries:
LD_DEBUG=libsprints nothing before the crash, so no library has been loaded yet; forcing the previous openssl also still crashes. - Driver version: unchanged (615.78.08) between the working and broken builds.
Steps to reproduce
- On nixos-unstable (09063bd) with
hardware.nvidiaenabled (proprietary driver 615.78.08, RTX 4070 SUPER), runnvidia-smi. - It segfaults (exit 139).
Standalone reproducer, re-patching the unmodified binary nixpkgs ships in origBin/ with patchelf 0.19.2 from nixpkgs:
BIN=$(dirname $(dirname $(readlink -f $(command -v nvidia-smi)))) # nvidia-x11-*-bin output
RP=$(patchelf --print-rpath $BIN/bin/nvidia-smi)
INT=$(patchelf --print-interpreter $BIN/bin/nvidia-smi)
# single invocation, as builder.sh does
cp $BIN/origBin/nvidia-smi single && chmod +w single
patchelf --interpreter $INT --set-rpath "$RP" single
cmp single $BIN/bin/nvidia-smi && echo identical # -> identical to the nixpkgs binary
./single -L # -> Segmentation fault (exit 139)
# two invocations, rpath first
cp $BIN/origBin/nvidia-smi split && chmod +w split
patchelf --set-rpath "$RP" split
patchelf --interpreter $INT split
./split -L # -> GPU 0: NVIDIA GeForce RTX 4070 SUPER ... (exit 0)Minimal reproducer
Re-patching the unmodified binary nixpkgs ships in `origBin/`, with patchelf 0.19.2 from nixpkgs:
BIN=$(dirname $(dirname $(readlink -f $(command -v nvidia-smi)))) # nvidia-x11-*-bin output
RP=$(patchelf --print-rpath $BIN/bin/nvidia-smi)
INT=$(patchelf --print-interpreter $BIN/bin/nvidia-smi)
# single invocation, as builder.sh does
cp $BIN/origBin/nvidia-smi single && chmod +w single
patchelf --interpreter $INT --set-rpath "$RP" single
cmp single $BIN/bin/nvidia-smi && echo identical # -> identical to the nixpkgs binary
./single -L # -> Segmentation fault (exit 139)
# two invocations, rpath first
cp $BIN/origBin/nvidia-smi split && chmod +w split
patchelf --set-rpath "$RP" split
patchelf --interpreter $INT split
./split -L # -> GPU 0: NVIDIA GeForce RTX 4070 SUPER ... (exit 0)Expected behaviour
nvidia-smi runs, as it did with the previous build of the same driver (patched with patchelf 0.15.2).
Screenshots
No response
Relevant log output
$ nvidia-smi
Segmentation fault (core dumped)
systemd-coredump stack trace:
#0 dl_main (/nix/store/...-glibc-2.44-57/lib/ld-linux-x86-64.so.2 + 0x25a74)
#1 _dl_sysdep_start
#2 _dl_start
#3 _start
Signal: 11 (SEGV) si_code: SEGV_ACCERRAdditional context
- Any systemd unit that calls
nvidia-smi(e.g. one runningnvidia-smi -pm 1at boot) now fails on every boot and everynixos-rebuild switch. - Upstream patchelf bug: Setting interpreter before rpath results in broken binary patchelf#674 (another NixOS user confirms it with driver 595.104.02 on an RTX 3080).
- Possible fix in nixpkgs until patchelf is fixed: split the call in
builder.shintopatchelf --set-rpath ...followed by a separatepatchelf --interpreter ....
AI disclosure (per the Nixpkgs automation/AI policy): the investigation and this write-up were done with Claude Code (Claude Opus 5.5). I ran the reproducer from "Steps to reproduce" on my machine and reviewed the report before submitting.
System metadata
- system:
"x86_64-linux" - host os:
Linux 7.2.11-zen1, NixOS, 26.11 (Zokor), 26.11.20261017.09063bd - multi-user?:
yes - sandbox:
yes - version:
nix-env (Nix) 2.34.9 - nixpkgs: nixos-unstable at
09063bd1f2b36fd9fd793c36dfade7bd40a93dfc - NVIDIA driver: 615.78.08 (proprietary,
hardware.nvidia.open = false) - patchelf: 0.19.2 (previously 0.15.2)
Notify maintainers
Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)
I assert that this issue is relevant for Nixpkgs
- I assert that this is a bug and not a support request.
- I assert that this is not a duplicate of an existing issue.
- I assert that I have read the NixOS Code of Conduct and agree to abide by it.
- I assert that I have read the automation/AI policy and that this issue report complies with it.
Is this issue important to you?
Add a 👍 reaction to issues you find important.
Activity
fix(nvidia): re-patch nvidia-smi so it stops segfaulting (#2396)
fix(nixos): patch the nvidia driver with patchelf 0.16.1
aurora: patch the NVIDIA programs with patchelf 0.15.2, for now (#94)
jne14 commentedon Oct 21, 2026
Confirming on driver 595.104.02 (RTX 4060 Laptop, PRIME offload), kernel 7.3.0, nixos-unstable 09063bd. Same SEGV_ACCERR in dl_main, same overlapping LOAD layout. The previous build (patchelf 0.15.2) of the same driver works against the same kernel module. My analysis: NixOS/patchelf#446 (comment).
mgnsk commentedon Oct 21, 2026
This isn't limited to nvidia:
autoPatchelfHookhits the same bug, so the nvidia-specific fix in #576397 won't cover other packages.auto-patchelfrunspatchelf --set-interpreterand thenpatchelf --set-rpathas two separate invocations (L406, L488). That's the order NixOS/patchelf#674 reports as broken, so any non-PIE executable patched by the hook can end up with the overlappingLOADlayout. I hit it with REAPER 7.82 (reaperfrom 9Prestidigitator/reaper-flake, a plainautoPatchelfHookpackage). It segfaults indl_mainon nixos-unstable 09063bd and 02c087f:Also:
.dynamicon its own RW page.autoPatchelfHookcases too.autoPatchelfHookpackages:patchelfFlags = [ "--page-size" "2097152" ];. The hook passes these flags through to patchelf (--extra-args). 2 MiB matched the binary's ownLOADalignment, and REAPER then starts.AI disclosure: investigated with Claude Code (Claude Opus 5.5). I ran the reproductions above on my machine.
t3code-server: Work around patchelf 0.19 breaking executables
fix(nvidia): build the driver with patchelf 0.15.2
hp-z240-xeon-1240v6-nixos: convert to hosts/ dir, FAH space heater (C…
aurora: drop the NVIDIA patchelf override
chore: flake update - 2026-10-27 (#101)
fix(packages): autoPatchelf custom binaries with stable's patchelf, s…
fix: work around patchelf 0.19.2 breaking REAPER startup
update nixpkgs
Work around patchelf 0.19.2 breaking gcc-arm-embedded
fix(k3s-nvidia-vgpu): repair patched binaries and license token mode
Fix guest driver build and runtime on current nixpkgs (#2)