CircleCI-Public / ruby-orb

The `circleci/ruby` orb source code.
https://circleci.com/developer/orbs/orb/circleci/ruby
MIT License
26 stars 53 forks source link

Cannot install Ruby with RVM - Operation not permitted could not set group #15

Closed schneems closed 4 years ago

schneems commented 4 years ago

Orb Version The version number of the orb

0.2.1

Describe the bug

Build fails while trying to ruby/install

#!/bin/bash -eo pipefail
# Fix for retrieving GPG over IPv6 issue
mkdir ~/.gnupg && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf
curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -

curl -sSL "https://get.rvm.io" | bash -s stable
adduser $(whoami) rvm
source /etc/profile.d/rvm.sh
rvm install 2.5.5
rvm use 2.5.5 default

echo 'source /etc/profile.d/rvm.sh' >> $BASH_ENV

mkdir: cannot create directory ‘/home/circleci/.gnupg’: File exists
gpg: key D39DC0E3: "Michal Papis (RVM signing) <mpapis@gmail.com>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1
gpg: key 39499BDB: public key "Piotr Kuczynski <piotr.kuczynski@gmail.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
Downloading https://github.com/rvm/rvm/archive/1.29.9.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.9/1.29.9.tar.gz.asc
gpg: Signature made Wed 10 Jul 2019 08:31:02 AM UTC using RSA key ID 39499BDB
gpg: Good signature from "Piotr Kuczynski <piotr.kuczynski@gmail.com>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 7D2B AF1C F37B 13E2 069D  6956 105B D0E7 3949 9BDB
GPG verified '/opt/circleci/.rvm/archives/rvm-1.29.9.tgz'
Creating group 'rvm'
Upgrading the RVM installation in /opt/circleci/.rvm/
chown: changing group of ‘/opt/circleci/.rvm/man/man1/rvm.1.gz’: Operation not permitted
    could not set group of '/opt/circleci/.rvm/man/man1/rvm.1.gz', prefix the command with 'rvmsudo' to fix it, if the situation persist report a bug.
chown: changing group of ‘/opt/circleci/.rvm/man/man1/rvm.1’: Operation not permitted
    could not set group of '/opt/circleci/.rvm/man/man1/rvm.1', prefix the command with 'rvmsudo' to fix it, if the situation persist report a bug.
    Found 5498 files not belonging to 'rvm',
use `--debug` to see the list, run `rvmsudo rvm get stable` to fix it., prefix the command with 'rvmsudo' to fix it, if the situation persist report a bug.
    Found 976 directories with mode different than '775',
use `--debug` to see the list, run `rvmsudo rvm get stable` to fix it., prefix the command with 'rvmsudo' to fix it, if the situation persist report a bug.
    Found 3445 files with mode different than '664' or '775',
use `--debug` to see the list, run `rvmsudo rvm get stable` to fix it., prefix the command with 'rvmsudo' to fix it, if the situation persist report a bug.
Upgrade of RVM in /opt/circleci/.rvm/ is complete.

<warn>Thanks for installing RVM 🙏</warn>
Please consider donating to our open collective to help us maintain RVM.

👉  Donate: <code>https://opencollective.com/rvm/donate</code>

To Reproduce

Here's my config.yml

version: 2.1
orbs:
  buildpacks: jkutner/buildpacks@0.0.7
  ruby: circleci/ruby@0.2.1
jobs:
  build:
    machine: true
    steps:
      - buildpacks/install-pack:
          version: "0.7.0"
      - checkout
      - ruby/install:
          version: 2.5.5
      - run:
          command: |
            bundle install
            bundle exec rake hatchet:setup_ci
      - run:
          command: |
            rspec spec/cnb/

workflows:
  main:
    jobs:
      - build

Expected behavior

I pushed and expect to be able to use Ruby 2.5.5. Instead I got an error

Additional context URL of the build: https://circleci.com/gh/heroku/heroku-buildpack-ruby/1033

It's also worth noting that the "prep for RVM" step also failed:

#!/bin/bash -eo pipefail
# Fix for retrieving GPG over IPv6 issue
mkdir ~/.gnupg && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf
curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -

curl -sSL "https://get.rvm.io" | bash -s stable
adduser $(whoami) rvm
source /etc/profile.d/rvm.sh
rvm install 2.5.5
rvm use 2.5.5 default

echo 'source /etc/profile.d/rvm.sh' >> $BASH_ENV

mkdir: cannot create directory ‘/home/circleci/.gnupg’: File exists
gpg: key D39DC0E3: "Michal Papis (RVM signing) <mpapis@gmail.com>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1
gpg: key 39499BDB: public key "Piotr Kuczynski <piotr.kuczynski@gmail.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
Downloading https://github.com/rvm/rvm/archive/1.29.9.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.9/1.29.9.tar.gz.asc
gpg: Signature made Wed 10 Jul 2019 08:31:02 AM UTC using RSA key ID 39499BDB
gpg: Good signature from "Piotr Kuczynski <piotr.kuczynski@gmail.com>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 7D2B AF1C F37B 13E2 069D  6956 105B D0E7 3949 9BDB
GPG verified '/opt/circleci/.rvm/archives/rvm-1.29.9.tgz'
Creating group 'rvm'
Upgrading the RVM installation in /opt/circleci/.rvm/
chown: changing group of ‘/opt/circleci/.rvm/man/man1/rvm.1.gz’: Operation not permitted
    could not set group of '/opt/circleci/.rvm/man/man1/rvm.1.gz', prefix the command with 'rvmsudo' to fix it, if the situation persist report a bug.
chown: changing group of ‘/opt/circleci/.rvm/man/man1/rvm.1’: Operation not permitted
    could not set group of '/opt/circleci/.rvm/man/man1/rvm.1', prefix the command with 'rvmsudo' to fix it, if the situation persist report a bug.
    Found 5498 files not belonging to 'rvm',
use `--debug` to see the list, run `rvmsudo rvm get stable` to fix it., prefix the command with 'rvmsudo' to fix it, if the situation persist report a bug.
    Found 976 directories with mode different than '775',
use `--debug` to see the list, run `rvmsudo rvm get stable` to fix it., prefix the command with 'rvmsudo' to fix it, if the situation persist report a bug.
    Found 3445 files with mode different than '664' or '775',
use `--debug` to see the list, run `rvmsudo rvm get stable` to fix it., prefix the command with 'rvmsudo' to fix it, if the situation persist report a bug.
Upgrade of RVM in /opt/circleci/.rvm/ is complete.

<warn>Thanks for installing RVM 🙏</warn>
Please consider donating to our open collective to help us maintain RVM.

👉  Donate: <code>https://opencollective.com/rvm/donate</code>

adduser: Only root may add a user or group to the system.

Exited with code exit status 1
schneems commented 4 years ago

Any progress here?

KyleTryon commented 4 years ago

Hello Schneems,

I will be updating the orb and will look into this.

galonge commented 4 years ago

hello @KyleTryon is there

Hello Schneems,

I will be updating the orb and will look into this.

@KyleTryon is there an alternative to get past this error yet? I'm also experiencing this.

KyleTryon commented 4 years ago

Good news is the Ruby orb will be updated no later than by the end of next week, likely in the first half of next week. We just needed to also update a sample project for proper testing of the orb.

If you'd like to see the current working code it can be found here in the branch I am currently working on.

https://github.com/CircleCI-Public/ruby-orb/blob/OSK_update/src/commands/install.yml

if however at all possible, do not use orbs to install languages/frameworks

It will be faster and easier to use a Docker image with the appropriate version of Ruby installed when possible (or build from that image)

https://hub.docker.com/r/cimg/ruby

KyleTryon commented 4 years ago

Hello,

Version 1.0.0 of the Ruby orb has been released.

https://github.com/CircleCI-Public/ruby-orb/releases/tag/v1.0.0 https://circleci.com/orbs/registry/orb/circleci/ruby?version=1.0.0

The Ruby installation logic has been updated. Please try updating to 1.0.0 and report back if you continue to experience any issues.

Thank you.