setup-ruby: ruby/setup-ruby@v1 does not run in a self-hosted runner
I can’t run ruby/setup-ruby@v1 in a self-hosted runner. My action works fine in GitHub-hosted runner ubuntu-latest but I tried with my own docker image, the myoung34/github-runner:ubuntu-focal image and tcardonne/github-runner:ubuntu-20.04 and VM with Ubuntu 20.04. I always get the same error:
I tried ruby 2.6 and 2.7, looks like node can’t spawn the process. Maybe a missing dependency in the runner?
##[error]There was an error when attempting to execute the process '/root/.rubies/ruby-2.7.1/bin/gem'. This may indicate the process failed to start. Error: spawn /root/.rubies/ruby-2.7.1/bin/gem ENOENT
My simple repo to test this: https://github.com/navarroaxel/ruby-runner/runs/1133643210
My workflow:
name: Ruby
on: push
jobs:
publish:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1.45.0
with:
ruby-version: 2.7
output:
Run ruby/setup-ruby@v1
Took 0.00 seconds
Run ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler: default
bundler-cache: false
working-directory: .
Downloading Ruby
https://github.com/ruby/ruby-builder/releases/download/enable-shared/ruby-2.7.1-ubuntu-20.04.tar.gz
Took 23.29 seconds
Extracting Ruby
/usr/bin/tar -xz -C /root/.rubies -f /tmp/work/_temp/acd71600-4e4d-4beb-bca0-db920cc72d0c
Took 0.34 seconds
Installing Bundler
/root/.rubies/ruby-2.7.1/bin/gem install bundler -v ~> 2 --no-document
Took 0.00 seconds
##[error]There was an error when attempting to execute the process '/root/.rubies/ruby-2.7.1/bin/gem'. This may indicate the process failed to start. Error: spawn /root/.rubies/ruby-2.7.1/bin/gem ENOENT
If I run the downloaded binaries in the VM I get this error:
$ ./.rubies/ruby-2.7.1/bin/gem
-bash: ./../.rubies/ruby-2.7.1/bin/gem: /home/runner/.rubies/ruby-2.7.1/bin/ruby: bad interpreter: No such file or directory
$ ./.rubies/ruby-2.7.1/bin/ruby
./.rubies/ruby-2.7.1/bin/ruby: error while loading shared libraries: libruby.so.2.7: cannot open shared object file: No such file or directory
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 17 (9 by maintainers)
I’d like to close this issue. It seems the original error is due to an incorrect setup of the GitHub Actions runner. Docker-based Actions are unrelated, this is a so-called JavaScript-based Action so it works on other OS than Linux.
In short this action does not support self-hosted runners, because it’s not possible to precompile Rubies for all variants of them.
As that doc says, either have your runners similar enough to GH-hosted runners and they can reuse the prebuilt Rubies, otherwise as said there as well you need to build Ruby yourself in the toolcache (a standard GHA feature) and this action will use it.
Note for other users: In my case, this problem was caused because of wrong linux user name. README.md explained that it should be
runnerbut ours wasn’t so. I could solve my problem bysudo ln -s /home/theuser /home/runner.This is not the same issue because the binaries for
Amazon Linux 2should be added to https://github.com/ruby/ruby-builder/releases or change this action to fallback toRuby Version Managerif the OS is notUbuntu.