rustup: OOM installing rustc-dev with 1GB of memory

Problem

I tried installing a rust toolchain in a VM I assigned 1GB of ram. (100MB used by the minimal debian install) When installing rustc-dev it got an OOM however.

Steps

  1. Create a VM
  2. Assign 1GB of ram
  3. Install a minimal debian system in the VM. When running it only uses 100MB of ram.
  4. Attempt to install a rust toolchain with the rustc-dev component in the VM.
  5. OOM

Possible Solution(s)

I thought rustup 1.24 enabled installation on systems with little ram. Is this a regression? Would it be possible to stream the component rather than attempt to load it all at once in memory?

Notes

For now I will be increasing the assigned amount of memory, but IMO it should be possible to install on systems with this little ram, hence this issue.

Rustup version

rustup 1.25.1 (bb60b1e89 2022-07-12)

Installed toolchains

Default host: x86_64-unknown-linux-gnu
rustup home:  /home/bjorn/.rustup

no active toolchain

I attempted to install nightly-2022-12-13-x86_64-unknown-linux-gnu.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 20 (12 by maintainers)

Most upvoted comments

I am not interested in your tmpfs use case.

I am currently trying to install rustup on a t4g.nano instance running Ubuntu 22.04 and the unpacking is running out of memory.

info: profile set to 'minimal'
info: setting default host triple to aarch64-unknown-linux-gnu
info: syncing channel updates for 'stable-aarch64-unknown-linux-gnu'
info: latest update on 2023-10-05, rust version 1.73.0 (cc66ad468 2023-10-03)
info: downloading component 'cargo'
info: downloading component 'rust-std'
info: downloading component 'rustc'
 76.5 MiB /  76.5 MiB (100 %)  72.4 MiB/s in  1s ETA:  0s
info: installing component 'cargo'
warning: Ignoring RUSTUP_UNPACK_RAM (10) less than minimum of 33554432.
info: installing component 'rust-std'
warning: Ignoring RUSTUP_UNPACK_RAM (10) less than minimum of 33554432.
Killed

free -h looks like this:

               total        used        free      shared  buff/cache   available
Mem:           419Mi       126Mi       252Mi       0.0Ki        40Mi       274Mi
Swap:             0B          0B          0B

The linked closed issue is about installing in a tmpfs mount, i.e. a system where disk and memory together come out of a 1 GB pool. I am trying to install on a system with 128 GB of disk and 500 MB of memory (less than that in practice because OS, but you know).

I’ve forked rustup and started poking at this situation. I’ll try to write a patch myself, but if push comes to shove I’ll just set up a lot of swap.

You might slightly exceed it if you use a real disk (maybe using the minimal profile works to fit in 1GB), but if the filesystem is stored in ram, you definitively need more than 1GB of ram to fit both the filesystem and the rustup installer process.