Skip to content

test: patchelf ELF interpreter in release docker image#198

Open
rishitesh-snt wants to merge 3 commits into
mainfrom
fix/patchelf-interpreter
Open

test: patchelf ELF interpreter in release docker image#198
rishitesh-snt wants to merge 3 commits into
mainfrom
fix/patchelf-interpreter

Conversation

@rishitesh-snt

Copy link
Copy Markdown
Contributor

Context

Since 1fc8650 (2026-03-03, "ci: switch ubuntu runners to nix exclusively") the release workflow builds sxt-node inside nix develop. Cargo therefore links against Nix's glibc, and the resulting binary's ELF PT_INTERP header points at:

/nix/store/j193mfi0f921y0kfs8vjc1znnr45ispv-glibc-2.40-66/lib/ld-linux-x86-64.so.2

sxtnode.Dockerfile copies this binary into parity/base-bin:latest (Ubuntu), which has no /nix/store/. The kernel can't resolve the interpreter, execve() returns ENOENT, and the shell prints the misleading:

/bin/bash: line 2: /usr/local/bin/sxt-node: No such file or directory

Discovered while trying to deploy v1.69.1 to testnet.

What this PR does

Inserts a patchelf --set-interpreter step in the sxtnode_docker job, after the artifact is downloaded and before docker buildx build. This rewrites PT_INTERP to Ubuntu's default linker path (/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2) so the container's kernel can actually launch the binary.

What this PR does NOT do

  • Address glibc symbol-version mismatches. If the binary references symbols not present in the base image's older glibc, we'll see symbol lookup error: ... GLIBC_X.YZ not found at runtime — an informative next error to diagnose.
  • Provide a durable fix. The right long-term answer is pkgs.dockerTools.buildLayeredImage so the whole closure is Nix-native. This is the fastest unblock only.

How to test

Run the Release workflow on this branch via workflow_dispatch. That will publish spaceandtime.jfrog.io/sxtnode-docker-local/sxt-node:patchelf-interpreter. Then:

docker pull spaceandtime.jfrog.io/sxtnode-docker-local/sxt-node:patchelf-interpreter
docker run --rm --entrypoint sh spaceandtime.jfrog.io/sxtnode-docker-local/sxt-node:patchelf-interpreter \
  -c '/usr/local/bin/sxt-node --version'

Success case: version prints. Failure case: GLIBC_X.YZ not found or similar — proves the interpreter was the first blocker but there's a secondary glibc mismatch to solve.

Test plan

  • Dispatch Release workflow on fix/patchelf-interpreter branch
  • Confirm sxtnode-docker-local/sxt-node:patchelf-interpreter appears on JFrog
  • Pull image, run --version command above
  • Report result on the linked issue

Nix-built sxt-node has an ELF interpreter pointing at /nix/store/...
which parity/base-bin lacks, causing runtime ENOENT masked as
'/usr/local/bin/sxt-node: No such file or directory'. This patches the
interpreter to Ubuntu's default path before docker build to test if
that alone unblocks execution.
@rishitesh-snt rishitesh-snt requested review from a team as code owners July 8, 2026 05:44
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

1.69.2

Nix-built binary references GLIBC_2.38 and GLIBC_2.39 symbols. Ubuntu
22.04 (parity/base-bin:latest) only ships glibc 2.35. Ubuntu 24.10
provides glibc 2.40, matching Nix's toolchain.

Explicit ca-certificates because ubuntu:24.10 doesn't ship them by
default (parity/base-bin did).
@rishitesh-snt

rishitesh-snt commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up commit 318c8a3 — patchelf validated the ELF interpreter theory (binary now execs), but exposed the expected glibc symbol-version mismatch:

24.04 provides glibc 2.39 which covers all GLIBC symbol versions the
binary needs (2.38 and 2.39 were the flagged ones). Also more reliable
apt mirrors in CI than the short-support 24.10.
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