Skip to content

build-rust: make rustup's install paths group-writable for crate-pinned toolchains - #140

Merged
Jonathan Gangi (JAVGan) merged 1 commit into
konflux-lightwell:mainfrom
smatula:fix/rustup-writable-install-paths
Nov 10, 2026
Merged

Jonathan Gangi (JAVGan) merged 1 commit into
konflux-lightwell:mainfrom
smatula:fix/rustup-writable-install-paths

Conversation

@smatula

Copy link
Copy Markdown
Contributor

Problem

Building a wheel whose dependency tree contains a Rust-backed build backend fails in
fromager-build-wheels:

info: syncing channel updates for 1.97.1-x86_64-unknown-linux-gnu
error: could not create temp file /opt/_internal/rust-1.98.1/rustup/tmp/...: Permission denied (os error 13)
maturin failed
  Caused by: Cargo metadata failed.

The trigger is a crate pinning a toolchain. uv_build — the build backend for bidict,
among others — ships a rust-toolchain.toml pinning 1.97.1, while the image installs
1.98.1 via --default-toolchain "${RUST_VERSION}". rustup therefore tries to install the
pinned toolchain at build time, which requires writing to RUSTUP_HOME.

build-rust.sh already makes cargo/{registry,git} group-writable for the same OCP
arbitrary-UID/GID-0 reason, but nothing under rustup is writable.

Why not just rustup/tmp

Making only tmp writable moves the failure rather than fixing it. Reproduced locally by
replicating the script's output (root-owned RUSTUP_HOME, only cargo caches group-writable)
and running as a non-root UID with GID 0:

Writable set Result
as shipped could not create temp file .../rustup/tmp/...: Permission denied
+ tmp component download failed ... cleaning up cached downloads: No such file or directory
+ downloads, toolchains, settings.toml, rustup installs, then could not write update hash file: .../rustup/update-hashes/...
+ update-hashes clean install; rustup run <ver> rustc --version works

Note on the chmod

Non-recursive, unlike the cargo lines. toolchains/ only needs to be writable so a new
toolchain directory can be created; -R would make every already-installed toolchain binary
writable, against the intent of the existing comment.

Testing

Verified in the reproduction above. Not covered by CI — ci.yml doesn't build the image, and
nothing runs it as a non-root user, so this condition isn't observable in CI today.

🤖 Generated with Claude Code

A crate can pin a toolchain via rust-toolchain.toml, which makes rustup
install that toolchain at build time. Under OCP's arbitrary-UID/GID-0
model rustup cannot write to RUSTUP_HOME, so the build fails before
cargo runs.

This extends the existing cargo-cache treatment to the rustup paths an
install touches: tmp, downloads, toolchains, update-hashes, and
settings.toml. The chmod is non-recursive so already-installed toolchain
binaries stay read-only.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@pkhander

Copy link
Copy Markdown
Collaborator

/ok-to-test

@JAVGan
Jonathan Gangi (JAVGan) merged commit 2355ba9 into konflux-lightwell:main Nov 10, 2026
1 of 3 checks passed
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.

3 participants