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

Rust installation freezes on Raspberry PI (worked in 1.26) #3966

Closed
2 tasks done
bernardolansing opened this issue Jul 26, 2024 · 13 comments
Closed
2 tasks done

Rust installation freezes on Raspberry PI (worked in 1.26) #3966

bernardolansing opened this issue Jul 26, 2024 · 13 comments
Labels

Comments

@bernardolansing
Copy link

bernardolansing commented Jul 26, 2024

Verification

Problem

The installation of Rust toolchain freezes when installing rust-docs on a Raspberry PI. The PI that I got here is a Zero 2W, 64-bit (aarch64-unknown-linux-gnu). The system image (RaspiOS Lite Bookworm, 64 bits) was made in the same day, so I doubt there was something messed up in my system specifically.

If I remember well, the only component that hanged the installation was rust-docs, and always soon after reaching 5.4 MB of installed size (I may be wrong, but I think that's it). Setting the installation profile to minimal didn't change a thing.

When I say it "freezes" the PI, I mean that the PI would get completely stuck and irresponsive. The disk write LED wouldn't stop blinking, and I couldn't start any new SSH sessions. Only solution was brute restart. I tried to wait a few hours to see if it eventually completed, but it didn't look as it'd happen.

Then I downloaded the rustup-init script version 1.26 and it worked fine.

Steps

  1. Get a fresh RaspiOS Bookworm Lite system image running on a Raspberry Zero 2W (actually this is the only combination that I could test, perhaps the bug regards only the system and not the hardware, or vice-versa).
  2. Execute curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh and start the installation.
  3. See your PI die as it tries to install rust-docs.

Possible Solution(s)

No response

Notes

No response

Rustup version

1.27.1

Installed toolchains

I couldn't see, as installation would not finish.

OS version

RaspiOS Bookworm Lite
@djc
Copy link
Contributor

djc commented Jul 26, 2024

Would you be able to bisect rustup changes to figure out which commit caused the issue?

@bernardolansing
Copy link
Author

I guess, but that'll take a while as I'm busy with some things. I'll keep you updated.

@djc
Copy link
Contributor

djc commented Jul 26, 2024

Sorry, other than I'm afraid there isn't much I can do make sense of this failure mode.

@Supermanuu
Copy link

Supermanuu commented Oct 4, 2024

I have the same problem with another Raspberry Pi Zero 2W, same OS, same rustup version.

For me, the installation freezes in the rustc installation (I think is the very last part). It gets to the 90% of that step and freezes. Could not Ctrl+C nor Ctrl+Z... The only way to restore the raspberry was power cut...

I have 105GB of free space in the SD card.

The 1.26 version did not work for me... I tried to install it several times...

@Supermanuu

This comment has been minimized.

@Supermanuu

This comment has been minimized.

@Supermanuu

This comment has been minimized.

@djc
Copy link
Contributor

djc commented Oct 4, 2024

Please don't spam this issue with repeated instances of the same problem. If you think there's value here, please add them in a single comment within a <details></details> widget.

@dborel
Copy link

dborel commented Oct 5, 2024

This is due to Rust installation exceeding the available memory. I was able to reproduce it with v1.26 and it didn't just occur when installing rust-docs. A minimal install produced the same kind of freeze when installing rustc. For me, the workaround was to increase the swapfile to 512MB (100MB was not enough, but I didn't try any other values).

sudo dphys-swapfile swapoff
sudo nano /etc/dphys-swapfile # Edit CONF_SWAPFILE=512
sudo dphys-swapfile setup
sudo dphys-swapfile swapon

@djc
Copy link
Contributor

djc commented Oct 5, 2024

We do have some code in place to try to avoid this kind of situation. If one of you can do some experiments to see if/how we could adapt that, would be great!

@dborel
Copy link

dborel commented Oct 5, 2024

It's pretty common to run out of memory on rpi, especially when compiling large codebases. I actually had to up the swapfile further to 2048 to build librespot with cargo as soon as I got past this issue. It would be nice if raspbian failed more gracefully in this situation. It's possible to watch swap usage with htop or /proc/swaps. Adding a 32-bit ARMv7 build might be another dirty hack to limit memory utilization on rpi.

@Supermanuu
Copy link

Supermanuu commented Oct 5, 2024

The swap increase worked for me too! I was able to install the latest version of rustup with curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh without problems! Thank you!

I have also problems to install some cargo crates too, I will try to install them again with the swap increase... But I think that this problem belongs to another people xD

Next week I can check with you @djc that code if you wish

@rami3l
Copy link
Member

rami3l commented Oct 6, 2024

Closing in favor of #3125 (sorry, this is another old and recurring issue!). Rustup's handling of very little free memory definitely needs some improvement... And indeed many report using Raspi Zero 2 or similar platforms.

Sometimes RUSTUP_IO_THREADS=1 helps, but only occasionally.

With all the refactoring in v1.28 I'm not sure if the situation has turned better or worse...

@rami3l rami3l closed this as not planned Won't fix, can't repro, duplicate, stale Oct 6, 2024
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