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

Unable to install rust on Raspberry Pi 3A+ #2564

Closed
shytikov opened this issue Nov 22, 2020 · 7 comments
Closed

Unable to install rust on Raspberry Pi 3A+ #2564

shytikov opened this issue Nov 22, 2020 · 7 comments
Labels

Comments

@shytikov
Copy link

Sorry for ditching standard template, but It's not really applicable here for me because I hit issue earlier on the process.

Regardless what I do I'm not able to install rust on my Raspberry Pi 3A+ with 512MB of memory.

And even worse, installer leaves me with partially broken installation which I'm not able to cleanup afterwards.

Here is the log of rustup execution:

info: profile set to 'default'
info: default host triple is armv7-unknown-linux-gnueabihf
info: syncing channel updates for 'stable-armv7-unknown-linux-gnueabihf'
info: latest update on 2020-11-19, rust version 1.48.0 (7eac88abb 2020-11-16)
info: downloading component 'cargo'
  4.7 MiB /   4.7 MiB (100 %)   3.3 MiB/s in  2s ETA:  0s
info: downloading component 'clippy'
info: downloading component 'rust-std'
 18.2 MiB /  18.2 MiB (100 %)   3.7 MiB/s in  6s ETA:  0s
info: downloading component 'rustc'
 66.8 MiB /  66.8 MiB (100 %)   4.4 MiB/s in 19s ETA:  0s
info: downloading component 'rustfmt'
  3.1 MiB /   3.1 MiB (100 %)   3.1 MiB/s in  1s ETA:  0s
info: installing component 'cargo'
info: Defaulting to 329.6 MiB unpack ram
  4.7 MiB /   4.7 MiB (100 %)   4.0 MiB/s in  1s ETA:  0s
info: installing component 'clippy'
info: installing component 'rust-std'
 18.2 MiB /  18.2 MiB (100 %)   2.5 MiB/s in  9s ETA:  0s
info: installing component 'rustc'
 56.0 MiB /  66.8 MiB ( 84 %)   3.3 MiB/s in 30s ETA:  3sKilled

This issue is related to #2365, but since it was closed, creating a new one.

@shytikov shytikov added the bug label Nov 22, 2020
@kinnison
Copy link
Contributor

Frankly this looks like it's running out of RAM installing the component which suggests that you're likely to hit similar problems compiling any non-trivial programs. Either add swap, or cross-build from another more powerful system.

I am not sure what else to suggest.

@cztomsik
Copy link

Happens to me too, it worked fine before (1 year ago for sure), for what exactly does rustup needs so much memory?

@rbtcollins
Copy link
Contributor

Try exporting RUSTUP_IO_THREADS=1 before running rustup.

The underlying problem is that rust has some very large files (single files > 200MB), and we need to untar the file and write it to disk, but because of interactions with other system constraints like Windows Defender and NFS servers we've settled on concurrent file writing across the board (it took several evolutions to get here, even though it doesn't look like an obvious place to aim); our next iteration is to introduce chunking for large files to deal with this issue, but none of our contributors have had time to write the fairly modest changes needed to do this.

@cztomsik
Copy link

cztomsik commented Feb 3, 2021

It helped a bit, it failed first time but after restart it probably fit into memory and got through.

Oh, I had no idea, I thought the install process just downloads binaries and untars them somewhere (with system tar if possible). Ok, thanks a lot.

BTW: could you outline the work needed for handling big files on devices with limited memory?

@kinnison
Copy link
Contributor

kinnison commented Feb 7, 2021

I am not certain of the details since I've not looked at that part of the codebase in a while, however in brief the work would involve detecting when a particularly large file is encountered in the incoming stream of files, and rather than reading it all in at once and passing it to an IO thread to be written out, operating on the main thread to do that particular file in a streaming fashion.

I'm sure @rbtcollins could do a better job of explaining how that might look, if he has some time.

rbtcollins added a commit to rbtcollins/rustup.rs that referenced this issue Apr 4, 2021
Fixes rust-lang#2632, rust-lang#2145, rust-lang#2564

Files over 16M are now written incrementally chunks rather than buffered
in memory in one full linear buffer. This chunk size is not
configurable.

For threaded unpacking, the entire memory buffer will be used to buffer
chunks and a single worker thread will dispatch IO operations from the
buffer, so minimal performance impact should be anticipated (file
size/16M round trips at worst, and most network file systems will
latency hide linear writes).

For immediate unpacking, each chunk is dispatched directly to disk,
which may impact performance as less latency hiding is possible - but
for immediate unpacking clarity of behaviour is the priority.
rbtcollins added a commit to rbtcollins/rustup.rs that referenced this issue Apr 5, 2021
Fixes rust-lang#2632, rust-lang#2145, rust-lang#2564

Files over 16M are now written incrementally chunks rather than buffered
in memory in one full linear buffer. This chunk size is not
configurable.

For threaded unpacking, the entire memory buffer will be used to buffer
chunks and a single worker thread will dispatch IO operations from the
buffer, so minimal performance impact should be anticipated (file
size/16M round trips at worst, and most network file systems will
latency hide linear writes).

For immediate unpacking, each chunk is dispatched directly to disk,
which may impact performance as less latency hiding is possible - but
for immediate unpacking clarity of behaviour is the priority.
@rbtcollins
Copy link
Contributor

Fixed by #2707

rbtcollins added a commit to rbtcollins/rustup.rs that referenced this issue Apr 27, 2021
Fixes rust-lang#2632, rust-lang#2145, rust-lang#2564

Files over 16M are now written incrementally chunks rather than buffered
in memory in one full linear buffer. This chunk size is not
configurable.

For threaded unpacking, the entire memory buffer will be used to buffer
chunks and a single worker thread will dispatch IO operations from the
buffer, so minimal performance impact should be anticipated (file
size/16M round trips at worst, and most network file systems will
latency hide linear writes).

For immediate unpacking, each chunk is dispatched directly to disk,
which may impact performance as less latency hiding is possible - but
for immediate unpacking clarity of behaviour is the priority.
rbtcollins added a commit to rbtcollins/rustup.rs that referenced this issue Jul 11, 2021
Fixes rust-lang#2632, rust-lang#2145, rust-lang#2564

Files over 16M are now written incrementally chunks rather than buffered
in memory in one full linear buffer. This chunk size is not
configurable.

For threaded unpacking, the entire memory buffer will be used to buffer
chunks and a single worker thread will dispatch IO operations from the
buffer, so minimal performance impact should be anticipated (file
size/16M round trips at worst, and most network file systems will
latency hide linear writes).

For immediate unpacking, each chunk is dispatched directly to disk,
which may impact performance as less latency hiding is possible - but
for immediate unpacking clarity of behaviour is the priority.
@ixje
Copy link

ixje commented Nov 25, 2022

For whomever finds this thread while trying to install on raspberry pi zero 2w, I had to export RUSTUP_UNPACK_RAM=250000000 to get it to work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants