Rustup: Failed to allocate memory when installing a Rust toolchain (`armv7-unknown-linux-gnueabihf`)

Created on 11 May 2021  路  6Comments  路  Source: rust-lang/rustup

Problem

A user in a Japanese Rust community has reported that he/she cannot use Rustup v1.4.1 to install Rust to a Raspberry Pi 3 (with a 32-bit Arm Linux). It fails when unpacking a component due to a memory allocation error.

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
info: downloading installer
Welcome to Rust!
...
 18.8 MiB /  18.8 MiB (100 %)   2.5 MiB/s in  6s ETA:  0s
info: installing component 'rustc'
 18.3 MiB /  84.0 MiB ( 22 %)   3.8 MiB/s in  5s ETA: 17smemory allocation of 16777216 bytes failed
Aborted

Another user in the community confirmed the problem using his Raspberry Pi 3.

Steps

  1. Run curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  • Expected result: The latest Rustup and Rust toolchain should be installed.
  • Actual result: The latest Rustup was installed but it failed to install a Rust toolchain with a memory allocation error.



Notes

  • Rustup: v1.4.1
  • Hardware: Raspberry Pi 3
  • OS: Raspbian Buster 32-bit (2020-02-13-raspbian-buster-lite)
  • Host Triple: armv7-unknown-linux-gnueabihf

This issue seems similar to https://github.com/rust-lang/rustup/issues/2759 (Windows MSVC) but in a different platform.

bug duplicate

Most helpful comment

I don't have an irlo account so I'll just confirm here; 1.24.2 fixes the issue for me.

All 6 comments

As a workaround, I told them to use Rustup v1.3.1 for now and it worked for them.

Installing Rustup v1.3.1

$ TARGET_TRIPLE=armv7-unknown-linux-gnueabihf
$ curl -L -O https://static.rust-lang.org/rustup/archive/1.23.1/${TARGET_TRIPLE}/rustup-init
$ chmod +x rustup-init
$ ./rustup-init -y --default-toolchain none
$ source $HOME/.cargo/env
$ rustup -V
rustup 1.23.1 ...

Installing the latest Rust stable

$ RUSTUP_UNPACK_RAM=100000000 rustup install stable
...
thread 'main' panicked at 'RUSTUP_UNPACK_RAM must be larger than 220000000', src/dist/component/package.rs:202:13
...

$ RUSTUP_UNPACK_RAM=220000000 rustup install stable
...
  stable-armv7-unknown-linux-gnueabihf installed - rustc 1.52.0 (88f19c6da 2021-05-03)
info: default toolchain set to 'stable-armv7-unknown-linux-gnueabihf'
info: checking for self-updates
info: downloading self-update
$ rustc -V
rustc 1.52.0 (88f19c6da 2021-05-03)
$ cargo -V
cargo 1.52.0 (69767412a 2021-04-21)

I had the same issue on my Raspberry Pi 3 running Raspbian 10 arm32. RUSTUP_UNPACK_RAM=16777216 rustup update worked for me. I didn't have to also downgrade rustup to 1.23.1; just setting that env var was enough to make rustup 1.24.1 work.

I had the same issue on my Raspberry Pi 3 running Raspbian 10 arm32. RUSTUP_UNPACK_RAM=16777216 rustup update worked for me. I didn't have to also downgrade rustup to 1.23.1; just setting that env var was enough to make rustup 1.24.1 work.

I met same problem on cubietruck(like rpi3) running latest armbian(kernel 5.10.y). RUSTUP_UNPACK_RAM=16777216 works.

Yes, its the same problem as # #2759

I've updated the beta testing post on the users forum with details of how to test our proposed fix - https://internals.rust-lang.org/t/seeking-testers-for-rustup-1-24-2-beta/14634/6

I don't have an irlo account so I'll just confirm here; 1.24.2 fixes the issue for me.

Was this page helpful?
0 / 5 - 0 ratings