Skip to content

Rust profile installs rustup shims without a usable guest toolchain #560

Open

Description

@hbrodin

Summary

The built-in rust profile installs rustup as root and copies the executables from /root/.cargo/bin into /usr/local/bin, but it does not make the installed toolchain available to the configured guest user. The guest can find rustc and cargo, yet both are rustup shims that fail because the user's rustup home contains no toolchain.

Current behavior

scripts/guest/profiles/rust-post.sh currently does this:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
cp /root/.cargo/bin/* /usr/local/bin/ 2>/dev/null || true

The installer stores the toolchain under root's rustup home. Copying /root/.cargo/bin copies the rustup proxy binaries, not the compiler and standard library managed under /root/.rustup. In a VM created from the resulting image, the guest user sees behavior equivalent to:

$ rustup toolchain list
no installed toolchains

$ rustc --version
rustup could not choose a version of rustc to run

This also means a profile named rust is not sufficient to build the workspace without manual toolchain installation.

Expected behavior

A VM created from an image built with --profile rust should give the configured guest user a usable Rust toolchain immediately. rustc --version, cargo --version, and rustup toolchain list should succeed without accessing root-owned state.

The implementation could install as the guest user after that user exists, or deliberately use shared RUSTUP_HOME/CARGO_HOME locations with suitable ownership. The important contract is that the installed toolchain, components, and future rustup operations work for both the default and custom guest user.

Acceptance criteria

  • A fresh image built with the rust profile provides a usable toolchain to the configured guest user.
  • The guest does not depend on /root/.rustup or other inaccessible root-owned state.
  • Default and custom guest usernames are covered.
  • An integration assertion executes rustc --version and cargo --version as the guest user, rather than only checking that the shim files exist.
  • The profile recipe/version marker changes so existing stale images are rebuilt when appropriate.

Related: #381 tracks the broader ordering problem for profile scripts and guest-user creation. This issue is independently observable because the current Rust script explicitly installs into root's rustup home and copies only the proxy binaries.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions