Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rustup installation failure at installing rustc component #2128

Closed
acnologia000 opened this issue Nov 15, 2019 · 22 comments
Closed

Rustup installation failure at installing rustc component #2128

acnologia000 opened this issue Nov 15, 2019 · 22 comments

Comments

@acnologia000
Copy link

`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
`

@hellow554
Copy link

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.

@Centril
Copy link

Centril commented Nov 15, 2019

cc @kinnison & @Manishearth -- the issue should probably be transferred to the rustup repo.

@Manishearth Manishearth transferred this issue from rust-lang/rust Nov 15, 2019
@kinnison
Copy link
Contributor

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.

@acnologia000
Copy link
Author

acnologia000 commented Nov 21, 2019

image

i did set the RUSTUP_UNPACK_RAM=90 X 1024 X 1024

@kinnison

@kinnison
Copy link
Contributor

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.

@acnologia000
Copy link
Author

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

@acnologia000
Copy link
Author

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

UPDATE :
image

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

@richardanaya
Copy link

I was able to install 1.44.1 using RUSTUP_UNPACK_RAM=200000000 fore rustup install

@loehden
Copy link

loehden commented May 7, 2021

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.

@kinnison
Copy link
Contributor

kinnison commented May 7, 2021

That is quite surprising @loehden - Are you running a 32bit or a 64bit userland on that Pi 4?

@rbtcollins
Copy link
Contributor

I'd be interested in whether this patch: #2756 behaves better.

@loehden
Copy link

loehden commented May 11, 2021

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).

@kinnison
Copy link
Contributor

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 ?

@sunknudsen
Copy link

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.

@kinnison
Copy link
Contributor

@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

@sunknudsen
Copy link

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?

@hi-rustin
Copy link
Member

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.

@kinnison
Copy link
Contributor

@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.

@sunknudsen
Copy link

Thanks for helping out @kinnison!

@sunknudsen
Copy link

Rust is installed now. Great!

Thanks for release @kinnison!

@kinnison
Copy link
Contributor

@sunknudsen You're very welcome, thank you for being patient with this :D

@mchaos
Copy link

mchaos commented Aug 15, 2023

Here is how to make this work on an RPI with less than 500mbs available physical memory. If you are using say, an RPI zero 2, you will have 500mb's of physical mem. Some of that will be taken by the system. Rustc needs 500mbs of mem to compile. So there is a problem. Standard raspbian setup will have 99mb swap, and will used about 50 mbs of that. So increasing your swap file will solve the mem issue. Making the swap file 200mbs should be more than enough.

Run the following commands to increase the swap size.
sudo swapoff -a sudo dd if=/dev/zero of=/swapfile bs=1M count=256 sudo mkswap /swapfile sudo swapon /swapfile

Now rustc will compile and install just fine.

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

No branches or pull requests

10 participants