Skip to content

Remove workaround for broken pre-installed Ruby 4.0.1 on ubuntu-latest runner #3942

@st0012

Description

@st0012

Context

Starting around Jan 28–Feb 5 2026, the ubuntu-latest runner image was updated from 20260119.4.1 to 20260126.10.1, which added Ruby 4.0.1 as a pre-installed tool in /opt/hostedtoolcache/Ruby/4.0.1/. This caused ruby/setup-ruby to skip downloading Ruby from ruby-builder and use the pre-installed version instead.

The pre-installed Ruby has broken gem directory permissions (world-writable, missing sticky bit) that cause Bundler to refuse to reinstall gems with native extensions like erb 6.0.1 (see ruby/rubygems#9284). The sticky bit is a Unix permission flag that restricts file deletion in world-writable directories to the file owner — without it, Bundler considers the directory insecure and refuses to operate.

Testing also showed issues beyond just the sticky bit — the chmod +t workaround suggested in that issue was insufficient; only a fresh ruby-builder download resolves all failures.

Workaround

In #3940, we added a CI step that removes the pre-installed Ruby 4.0 from the tool cache before setup-ruby runs:

- name: Remove pre-installed Ruby 4.0
  if: matrix.os == 'ubuntu-latest' && matrix.ruby == '4.0'
  run: rm -rf /opt/hostedtoolcache/Ruby/4.0*

This forces setup-ruby to download a working build from ruby-builder.

When to revisit

This workaround can be removed when either of the following is true:

Metadata

Metadata

Assignees

No one assigned

    Labels

    choreChore task

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions