rustup: Rustup installation fails on raspberry pi 4 (raspbian)

Problem

I need the latest version ot rustc to install the last release of home assistant, but it seems that the executables for a wrong architecture were downloaded using rustup default installation.

As a result I get

error: command failed: ‘rustc’: No such file or directory (os error 2)

Help or suggestions?

Thanks, Massimo

Steps

Steps followed:


(homeassistant) homeassistant@raspix:/srv/homeassistant $ curl --proto ‘=https’ --tlsv1.2 -sSf https://sh.rustup.rs | sh info: downloading installer warning: it looks like you have an existing installation of Rust at: warning: /usr/bin warning: It is recommended that rustup be the primary Rust installation. warning: Otherwise you may have confusion unless you are careful with your PATH warning: If you are sure that you want both rustup and your already installed Rust warning: then please reply y' or yes’ or set RUSTUP_INIT_SKIP_PATH_CHECK to yes warning: or pass `-y’ to ignore all ignorable checks. error: cannot install while Rust is installed

Continue? (y/N) y

Welcome to Rust!

This will download and install the official compiler for the Rust programming language, and its package manager, Cargo.

Rustup metadata and toolchains will be installed into the Rustup home directory, located at:

/home/homeassistant/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory is located at:

/home/homeassistant/.cargo

This can be modified with the CARGO_HOME environment variable.

The cargo, rustc, rustup and other commands will be added to Cargo’s bin directory, located at:

/home/homeassistant/.cargo/bin

This path will then be added to your PATH environment variable by modifying the profile files located at:

/home/homeassistant/.profile /home/homeassistant/.bashrc

You can uninstall at any time with rustup self uninstall and these changes will be reverted.

Current installation options:

default host triple: aarch64-unknown-linux-gnu default toolchain: stable (default) profile: default modify PATH variable: yes

  1. Proceed with installation (default)
  2. Customize installation
  3. Cancel installation

2

I’m going to ask you the value of each of these installation options. You may simply press the Enter key to leave unchanged.

Default host triple? [aarch64-unknown-linux-gnu]

Default toolchain? (stable/beta/nightly/none) [stable]

Profile (which tools and data to install)? (minimal/default/complete) [default]

Modify PATH variable? (Y/n)

Current installation options:

default host triple: aarch64-unknown-linux-gnu default toolchain: stable profile: default modify PATH variable: yes

  1. Proceed with installation (default)
  2. Customize installation
  3. Cancel installation

1

info: profile set to ‘default’ info: setting default host triple to aarch64-unknown-linux-gnu info: syncing channel updates for ‘stable-aarch64-unknown-linux-gnu’ info: latest update on 2023-04-20, rust version 1.69.0 (84c898d65 2023-04-16) info: downloading component ‘cargo’ 5.8 MiB / 5.8 MiB (100 %) 3.0 MiB/s in 2s ETA: 0s info: downloading component ‘clippy’ info: downloading component ‘rust-docs’ 13.4 MiB / 13.4 MiB (100 %) 3.0 MiB/s in 5s ETA: 0s info: downloading component ‘rust-std’ 33.2 MiB / 33.2 MiB (100 %) 3.0 MiB/s in 12s ETA: 0s info: downloading component ‘rustc’ 73.4 MiB / 73.4 MiB (100 %) 2.7 MiB/s in 27s ETA: 0s info: downloading component ‘rustfmt’ info: installing component ‘cargo’ 5.8 MiB / 5.8 MiB (100 %) 5.6 MiB/s in 1s ETA: 0s info: installing component ‘clippy’ info: installing component ‘rust-docs’ 13.4 MiB / 13.4 MiB (100 %) 1.4 MiB/s in 7s ETA: 0s info: installing component ‘rust-std’ 33.2 MiB / 33.2 MiB (100 %) 4.9 MiB/s in 7s ETA: 0s info: installing component ‘rustc’ 73.4 MiB / 73.4 MiB (100 %) 5.3 MiB/s in 13s ETA: 0s info: installing component ‘rustfmt’ info: default toolchain set to ‘stable-aarch64-unknown-linux-gnu’

stable-aarch64-unknown-linux-gnu installed - (error reading rustc version)

Rust is installed now. Great!

To get started you may need to restart your current shell. This would reload your PATH environment variable to include Cargo’s bin directory ($HOME/.cargo/bin).

To configure your current shell, run: source “$HOME/.cargo/env” (homeassistant) homeassistant@raspix:/srv/homeassistant $ source “$HOME/.cargo/env” (homeassistant) homeassistant@raspix:/srv/homeassistant $ rustup --version rustup 1.26.0 (5af9b9484 2023-04-05) info: This is the version for the rustup toolchain manager, not the rustc compiler. info: The currently active rustc version is (error reading rustc version) (homeassistant) homeassistant@raspix:/srv/homeassistant $ rustc --version error: command failed: ‘rustc’: No such file or directory (os error 2) (homeassistant) homeassistant@raspix:/srv/homeassistant $

Possible Solution(s)

No response

Notes

No response

Rustup version

1.26.0

Installed toolchains

all

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 2
  • Comments: 17 (5 by maintainers)

Most upvoted comments

SOLVED using another architecture arm-unknown-linux-gnueabihf

Thanks , bye

Still a bug though. In fact I see 2 bugs here:

  • rustup is guessing the wrong host triple on this OS
  • rustup is not clever enough to notice when it installs the wrong toolchain, leading to confusing messages when end-user attempts to run rustc or cargo

SOLVED using another architecture arm-unknown-linux-gnueabihf

Thanks , bye

First time user of Rust here - trying to install python cryptography so that I can install python certbot so that I can enable ssl for my mqtt server - so I’m thoroughly in a yak-shaving hole here.

This wasn’t the most useful message just landing into this issue with no context…

I think it translates to:

rustup toolchain install stable-arm-unknown-linux-gnueabihf rustup default stable-arm-unknown-linux-gnueabihf

@rami3l Thanks for the update - this now works for me, running as:

export RUSTUP_UPDATE_ROOT=https://dev-static.rust-lang.org/rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

I get default host triple: armv7-unknown-linux-gnueabihf and the installation seems to work fine.

Thanks for your help!