Skip to content

Ubuntu 24.10 VPS with Low (1GB) Ram freezes during build of YJIT on ruby-3.3.0 install #2515

@TimeTravelerFromNow

Description

@TimeTravelerFromNow

Steps to reproduce the behavior

Start a new digital ocean VPS/droplet on Ubuntu 24.10, with 1GB of ram or less.
Install dependencies

sudo apt update && apt upgrade
apt-get install autoconf patch build-essential rustc libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libgmp-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev uuid-dev

apt install libpq-dev
apt install rbenv

rbenv init
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
reconnect to server...

rbenv install 3.3.0 --verbose
Build freezes at building Rust YJIT (see logs)

Temp file system is at half usage.

 df -h /tmp
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           481M  257M  224M  54% /tmp

Expected vs. actual behavior

Expected behavior:
Using a lower than recommended amount of ram, expected a message that lets me know why the build is frozen or will not complete.

Actual behavior:
Build freezes and doesnt complete. If using non-verbose mode, the build appears stuck at
make -j 1 and there are no logs. The only way out is to cancel the build and manually increase /tmp/ (see the solution below)

Logs

rbenv install 3.3.0 --verbose got stuck here

building Rust YJIT (release mode)
warning: unused import: `condition::Condition`
  --> ./yjit/src/asm/arm64/arg/mod.rs:13:9
   |
13 | pub use condition::Condition;
   |         ^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

warning: unused import: `rb_yjit_fix_mul_fix as rb_fix_mul_fix`
   --> ./yjit/src/cruby.rs:188:9
    |
188 | pub use rb_yjit_fix_mul_fix as rb_fix_mul_fix;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: this method call resolves to `<&Box<[T]> as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<Box<[T]> as IntoIterator>::into_iter` in Rust 2024
   --> ./yjit/src/core.rs:982:49
    |
982 |         formatter.debug_list().entries(branches.into_iter()).finish()
    |                                                 ^^^^^^^^^
    |
    = warning: this changes meaning in Rust 2024
    = note: `#[warn(boxed_slice_into_iter)]` on by default
help: use `.iter()` instead of `.into_iter()` to avoid ambiguity
    |
982 |         formatter.debug_list().entries(branches.iter()).finish()
    |                                                 ~~~~
help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value
    |
982 |         formatter.debug_list().entries(IntoIterator::into_iter(branches)).finish()
    |                                        ++++++++++++++++++++++++        ~

Solution

Use a VPS with 2GB of ram.

Or follow these steps if you're trying to save money:

Preparing to try install of ruby-3.3.0 again by wiping /tmp...
disclaimer: I dont know how bad it is to run rm -rf /tmp/, but it's probably bad practice

rm -rf /tmp
rm: cannot remove '/tmp': Device or resource busy

Manually adding a swapfile and increasing available tmp space with virtual ram:
sudo dd if=/dev/zero of=/mnt/swapfile bs=1M count=1024
sudo mkswap /mnt/swapfile
sudo swapon /mnt/swapfile

Then increase tempfs size:
mount -o remount,size=1G /tmp/

df -h /tmp/
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           1.0G     0  1.0G   0% /tmp

Attempt install of ruby-3.3.0 again

rbenv install 3.3.0 --verbose

It should succeed this time

==> Installed ruby-3.3.0 to /root/.rbenv/versions/3.3.0

NOTE: to activate this Ruby version as the new default, run: rbenv global 3.3.0

root@ubuntu-s-1vcpu-1gb-nyc1-01:~# rbenv versions
* system (set by /root/.rbenv/version)
  3.3.0

It should succeed this time, but if doesnt, I tried these steps a few days ago (Mar 22) and this would still not work because Ubuntu 24.10 shipped with an older version of rustc. So I needed to manually install the latest rustup with these steps:
sudo apt remove rustc
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
add to PATH:
source "$HOME/.cargo/env"

Cleanup:
Turn off the swapfile
sudo swapoff /mnt/swapfile
Remount /tmp/ filesystem to original size
mount -o remount,size=481M /tmp/
check /tmp/ is configured with origin size

root@ubuntu-s-1vcpu-1gb-nyc1-01:~# df -h /tmp/
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           481M     0  481M   0% /tmp

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions