`pi@raspberrypi:~ $ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
info: downloading installer
Welcome to Rust!
This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.
It will add the cargo, rustc, rustup and other commands to
Cargo's bin directory, located at:
/home/pi/.cargo/bin
This can be modified with the CARGO_HOME environment variable.
Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:
/home/pi/.rustup
This can be modified with the RUSTUP_HOME environment variable.
This path will then be added to your PATH environment variable by
modifying the profile file located at:
/home/pi/.profile
You can uninstall at any time with rustup self uninstall and
these changes will be reverted.
Current installation options:
default host triple: arm-unknown-linux-gnueabihf
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: syncing channel updates for 'stable-arm-unknown-linux-gnueabihf'
info: latest update on 2019-11-07, rust version 1.39.0 (4560ea788 2019-11-04)
warning: Force-skipping unavailable component 'clippy-arm-unknown-linux-gnueabihf'
warning: Force-skipping unavailable component 'rustfmt-arm-unknown-linux-gnueabihf'
info: downloading component 'cargo'
4.3 MiB / 4.3 MiB (100 %) 2.1 MiB/s in 3s ETA: 0s
info: downloading component 'rust-std'
182.6 MiB / 182.6 MiB (100 %) 1.9 MiB/s in 2m 15s ETA: 0s
info: downloading component 'rustc'
49.3 MiB / 49.3 MiB (100 %) 2.1 MiB/s in 30s ETA: 0s
info: installing component 'cargo'
4.3 MiB / 4.3 MiB (100 %) 1.6 MiB/s in 3s ETA: 0s
info: installing component 'rust-std'
182.6 MiB / 182.6 MiB (100 %) 1.5 MiB/s in 3m 23s ETA: 0s
5 iops / 5 iops (100 %) 0 iops/s in 14s ETA: 49710d 6h 28m 15s
info: installing component 'rustc'
31.1 MiB / 49.3 MiB ( 63 %) 1.2 MiB/s in 38s ETA: 14smemory allocation of 146176856 bytes failedAborted
`
memory allocation of 146176856 bytes failed
That is around 140MB allocating memory. If you have a 1GB Raspberry Pi model it may be too much. I wonder why rustup allocated so much memory.
cc @kinnison & @Manishearth -- the issue should probably be transferred to the rustup repo.
Rustup assumes that the average Rust program needs around 400M of RAM to build/link and as such that it's fair for it to use around that for processing IO as quickly as it can. If you are having difficulty with that, we do have some environment variables you can tweak to see if that helps:
https://github.com/rust-lang/rustup/#environment-variables
In particular RUSTUP_UNPACK_RAM which defaults to 419430400 (400 * 1024 * 1024) could be lowered. Though it's worth noting that cannot be below the size of the largest component which rustup has to unpack which is likely to be 70 to 90 megabytes for LLVM or librustc.
Good luck, and pop along to #wg-rustup on our discord if you want to discuss ways we might detect this kind of situation and self-limit. I'm not sure of a platform-independent way to detect available RAM.

i did set the RUSTUP_UNPACK_RAM=90 X 1024 X 1024
@kinnison
The value in RUSTUP_UNPACK_RAM isn't a valid number with those commas in it. Also it appears to be 1MiB not 90MiB. You could try export RUSTUP_UNPACK_RAM=94371840 for 90MiB.

i doubt my poor pi would be able to allocate that much

i doubt my poor pi would be able to allocate that much
UPDATE :

it did work but i believe this error was worth auto recovery by formulating and adjusting amount of memory needed instead of failing it totally
@kinnison
I was able to install 1.44.1 using RUSTUP_UNPACK_RAM=200000000 fore rustup install
I now get the same error on my Raspberry Pi 4 with 4 GB RAM (> 3 GB free) and had to reduce the the unpack size even more. RUSTUP_UNPACK_RAM=20000000 worked, but this is < 20 MiB and thus smaller than rustc, weird.
That is quite surprising @loehden - Are you running a 32bit or a 64bit userland on that Pi 4?
I'd be interested in whether this patch: https://github.com/rust-lang/rustup/pull/2756 behaves better.
Sorry, I must have missed my email notifications. And thanks for the fast replies!
@kinnison: I am using 32 bit Raspberry Pi OS.
@rbtcollins: Since the patch has been merged into master now, I guess I will see results at the next update, right? For the current update I still had to use the workaround (got the same error, even had to use RUSTUP_UNPACK_RAM=18000000 now).
I've updated the beta post on the users forum @loehden - If you get a chance, could you try https://internals.rust-lang.org/t/seeking-testers-for-rustup-1-24-2-beta/14634/6 ?
I now get the same error on my Raspberry Pi 4 with 4 GB RAM (> 3 GB free) and had to reduce the the unpack size even more.
@loehden @kinnison I am experiencing same issue on Raspberry Pi 3B (1GB RAM) and Pi 4B (4GB RAM).
Used to be able to run curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh flawlessly on Pi 3B.
@sunknudsen If you've time you can check out the beta version linked above, otherwise if you can wait a couple of days we'll have the beta released properly as 1.24.2
Thanks @kinnison. Unfortunately, I know little about Rust ecosystem… Is there a way to install older version of Rust using curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh?
Thanks @kinnison. Unfortunately, I know little about Rust ecosystem… Is there a way to install older version of Rust using
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh?
You can install the toolchain for a specified date:
rustup toolchain install nightly-2021-05-10
About the toolchain, you can refer to https://rust-lang.github.io/rustup/concepts/toolchains.html this docs.
@sunknudsen It's less about installling on older Rust and more about installing either 1.23.1 of rustup (hard) or the beta copy (medium difficulty) or waiting for the new release (takes time). If you want to do the middle one, then you need to do: export RUSTUP_UPDATE_ROOT=https://dev-static.rust-lang.org/rustup before the usual installation sequence you already know. But you need to remember that export command each time you use rustup until the next release.
Thanks for helping out @kinnison!
Rust is installed now. Great!
Thanks for release @kinnison!
@sunknudsen You're very welcome, thank you for being patient with this :D
Most helpful comment
I now get the same error on my Raspberry Pi 4 with 4 GB RAM (> 3 GB free) and had to reduce the the unpack size even more.
RUSTUP_UNPACK_RAM=20000000worked, but this is < 20 MiB and thus smaller thanrustc, weird.