Skip to content

linuxPackages.nvidia_x11: nvidia-smi segfaults on start since patchelf 0.19.2 #576412

Open

Description

@DanielTallon

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:

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/$i

In 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 old ld.so.
  • Libraries: LD_DEBUG=libs prints 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

  1. On nixos-unstable (09063bd) with hardware.nvidia enabled (proprietary driver 615.78.08, RTX 4070 SUPER), run nvidia-smi.
  2. 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_ACCERR

Additional context

  • Any systemd unit that calls nvidia-smi (e.g. one running nvidia-smi -pm 1 at boot) now fails on every boot and every nixos-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.sh into patchelf --set-rpath ... followed by a separate patchelf --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

@Kiskae
@edwtjo


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

Is this issue important to you?

Add a 👍 reaction to issues you find important.

Activity

  1. added
    0.kind: bug
    on Oct 20, 2026
  2. jne14 commented on Oct 21, 2026

    @jne14

    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).

  3. mgnsk commented on Oct 21, 2026

    @mgnsk

    This isn't limited to nvidia: autoPatchelfHook hits the same bug, so the nvidia-specific fix in #576397 won't cover other packages.

    auto-patchelf runs patchelf --set-interpreter and then patchelf --set-rpath as 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 overlapping LOAD layout. I hit it with REAPER 7.82 (reaper from 9Prestidigitator/reaper-flake, a plain autoPatchelfHook package). It segfaults in dl_main on nixos-unstable 09063bd and 02c087f:

    patchelf 0.19.2 (autoPatchelfHook output)
      LOAD     0x000000 0x3ff000 0x003e58 RW     <- up to 0x402e58
      LOAD     0x001254 0x400254 0xc0a56d R E    <- overlaps
      DYNAMIC  0x003c18 0x402c18 0x000240 RW     <- mapped r-x, ld.so faults writing DT_DEBUG
    

    Also:

    AI disclosure: investigated with Claude Code (Claude Opus 5.5). I ran the reproductions above on my machine.

  4. added a commit that references this issue on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions