CircleCI-Public / cimg-android

The CircleCI Android Docker Convenience Image.
MIT License
72 stars 37 forks source link

unable to `bundle install` on `cimg/android:2023.05.1-node` #82

Closed ethanneff closed 1 year ago

ethanneff commented 1 year ago

Executors

I am running 3 different builds, only cimg/android:2023.05.1-node is failing

executors:
  node:
    docker:
      - image: cimg/ruby:3.2.2-node
  android:
    docker:
      - image: cimg/android:2023.05.1-node
    resource_class: xlarge
  ios:
    macos:
      xcode: 14.2.0
    resource_class: large

Command

  install_android_deps:
    steps:
      - restore_cache:
          key: bundle-v1-{{ checksum "android/Gemfile.lock" }}-{{ arch }}
      - run:
          command: bundle install
          working_directory: android
      - save_cache:
          key: bundle-v1-{{ checksum "android/Gemfile.lock" }}-{{ arch }}
          paths:
            - vendor/bundle

Error

#!/bin/bash -eo pipefail
bundle install
Bundler 2.4.12 is running, but your lockfile was generated with 2.3.10. Installing Bundler 2.3.10 and restarting using that version.
Fetching gem metadata from https://rubygems.org/.
Fetching bundler 2.3.10

Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/bundler-2.3.10.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (3/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/bundler-2.3.10.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (4/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/bundler-2.3.10.gem`. It is likely that you need to grant write permissions for that path.

There was an error installing the locked bundler version (2.3.10), rerun with the `--verbose` flag for more details. Going on using bundler 2.4.12.
Fetching gem metadata from https://rubygems.org/........
Using rake 13.0.6
Fetching jmespath 1.6.1
Using babosa 1.0.4
Using httpclient 2.8.3
Using rexml 3.2.5
Using trailblazer-option 0.1.2
Using artifactory 3.0.15
Using atomos 0.1.3
Using aws-eventstream 1.2.0
Using webrick 1.7.0
Fetching aws-partitions 1.631.0
Using colored 1.2
Fetching json 2.6.2

Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/jmespath-1.6.1.gem`. It is likely that you need to grant write permissions for that path.
Using declarative 0.0.20
Using digest-crc 0.6.4
Using unf_ext 0.0.8.2

Retrying download gem from https://rubygems.org/ due to error (3/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/jmespath-1.6.1.gem`. It is likely that you need to grant write permissions for that path.
Using dotenv 2.8.1
Using emoji_regex 3.2.3
Using security 0.1.3
Using faraday-excon 1.1.0
Using faraday-httpclient 1.0.1
Using unicode-display_width 1.8.0

Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/json-2.6.2.gem`. It is likely that you need to grant write permissions for that path.
Using faraday-patron 1.0.0
Using faraday-rack 1.0.0

Retrying download gem from https://rubygems.org/ due to error (4/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/jmespath-1.6.1.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/aws-partitions-1.631.0.gem`. It is likely that you need to grant write permissions for that path.
Using faraday-retry 1.0.3
Using gh_inspector 1.1.3
Using memoist 0.16.2

Fetching fastlane-plugin-load_json 0.0.1
Using os 1.1.4
Fetching excon 0.92.4
Fetching fastlane-plugin-versioning_android 0.1.0
Using multipart-post 2.0.0
Using mini_mime 1.1.2
Using unf 0.1.4
Using uber 0.1.0
Using retriable 3.1.2
Using faraday-multipart 1.0.4
Using domain_name 0.5.20190701
Using claide 1.1.0
Using highline 2.0.3
Fetching mini_magick 4.11.0
Using naturally 2.2.1
Using optparse 0.1.1

Using faraday-em_http 1.0.0
Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/fastlane-plugin-versioning_android-0.1.0.gem`. It is likely that you need to grant write permissions for that path.
Fetching plist 3.6.0
Using faraday-em_synchrony 1.0.0
Using terminal-notifier 2.0.0
Using faraday-net_http 1.0.1

Retrying download gem from https://rubygems.org/ due to error (3/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/fastlane-plugin-versioning_android-0.1.0.gem`. It is likely that you need to grant write permissions for that path.
Using faraday-net_http_persistent 1.2.0
Using tty-cursor 0.7.1
Using word_wrap 1.0.0

Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/mini_magick-4.11.0.gem`. It is likely that you need to grant write permissions for that path.
Using ruby2_keywords 0.0.5
Using fastimage 2.2.6
Using rouge 2.0.7
Fetching faraday 1.10.2
Fetching fastlane-plugin-appcenter 2.0.0
Using xcpretty 0.3.0
Using multi_json 1.15.0
Using xcpretty-travis-formatter 1.0.1
Fetching jwt 2.5.0
Fetching CFPropertyList 3.0.5
Fetching aws-sigv4 1.5.1
Fetching public_suffix 5.0.0

Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/plist-3.6.0.gem`. It is likely that you need to grant write permissions for that path.
Fetching google-cloud-errors 1.3.0
Using representable 3.2.0
Using colored2 3.1.2
Using http-cookie 1.0.5
Using commander 4.6.0

Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/aws-sigv4-1.5.1.gem`. It is likely that you need to grant write permissions for that path.
Using rubyzip 2.3.2
Using tty-screen 0.8.1
Using nanaimo 0.3.0

Retrying download gem from https://rubygems.org/ due to error (4/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/fastlane-plugin-versioning_android-0.1.0.gem`. It is likely that you need to grant write permissions for that path.
Using tty-spinner 0.9.3

Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/fastlane-plugin-load_json-0.0.1.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/google-cloud-errors-1.3.0.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (3/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/mini_magick-4.11.0.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (3/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/aws-partitions-1.631.0.gem`. It is likely that you need to grant write permissions for that path.
Using bundler 2.4.12
Using terminal-table 1.8.0

Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/faraday-1.10.2.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (3/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/google-cloud-errors-1.3.0.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (3/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/plist-3.6.0.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/excon-0.92.4.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (3/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/aws-sigv4-1.5.1.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/CFPropertyList-3.0.5.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (3/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/fastlane-plugin-load_json-0.0.1.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (3/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/faraday-1.10.2.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (4/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/aws-sigv4-1.5.1.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (4/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/mini_magick-4.11.0.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/jwt-2.5.0.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (4/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/aws-partitions-1.631.0.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (4/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/google-cloud-errors-1.3.0.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (3/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/json-2.6.2.gem`. It is likely that you need to grant write permissions for that path.
Retrying download gem from https://rubygems.org/ due to error (4/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/faraday-1.10.2.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (3/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/excon-0.92.4.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (4/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/plist-3.6.0.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (4/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/excon-0.92.4.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (3/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/CFPropertyList-3.0.5.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/public_suffix-5.0.0.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (3/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/jwt-2.5.0.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (4/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/json-2.6.2.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (3/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/public_suffix-5.0.0.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (4/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/jwt-2.5.0.gem`. It is likely that you need to grant write permissions for that path.
Retrying download gem from https://rubygems.org/ due to error (4/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/fastlane-plugin-load_json-0.0.1.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (4/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/public_suffix-5.0.0.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/fastlane-plugin-appcenter-2.0.0.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (4/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/CFPropertyList-3.0.5.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (3/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/fastlane-plugin-appcenter-2.0.0.gem`. It is likely that you need to grant write permissions for that path.

Retrying download gem from https://rubygems.org/ due to error (4/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/3.0.0/cache/fastlane-plugin-appcenter-2.0.0.gem`. It is likely that you need to grant write permissions for that path.

Bundler::PermissionError: There was an error while trying to write to
`/var/lib/gems/3.0.0/cache/CFPropertyList-3.0.5.gem`. It is likely that you need
to grant write permissions for that path.
ethanneff commented 1 year ago

related https://github.com/CircleCI-Public/cimg-android/issues/43

ethanneff commented 1 year ago

Current solution

  install_android_deps:
    steps:
      - restore_cache:
          key: bundle-v1-{{ checksum "android/Gemfile.lock" }}-{{ arch }}
+     # this step can be removed if https://github.com/CircleCI-Public/cimg-android/issues/82 is ever resolved
+     - run: 
+         name: Fix Ruby permissions for Android
+         command: sudo chmod -R a+w /var/lib/gems/ /usr/local/bin
      - run:
          command: bundle install
          working_directory: android
      - save_cache:
          key: bundle-v1-{{ checksum "android/Gemfile.lock" }}-{{ arch }}
          paths:
            - vendor/bundle
ryanbourdais commented 1 year ago

Hi @ethanneff what are the other 2 images that you are using in these builds? Are they other variants of the android convenience image or different images entirely?

ryanbourdais commented 1 year ago

I just revisited this and realized that I entirely misread this, I was just able to recreate this and as a result I added the proposed chmod solution to the dockerfile template and included it in the PR for this month.

ryanbourdais commented 1 year ago

June's image includes the chmod step to prevent this bundle issue from happening, closing this issue as a result. Please reopen this if that does not fix the issue experienced.

francescopedronomnys commented 8 months ago

Using orb circleci/android@2.3.0 with image cimg/android:2023.12-node I had to add this command before running bundle install:

sudo chown -R circleci:circleci /var/lib/gems && sudo chmod -R 755 /var/lib/gems

Muhammad-Soban commented 6 months ago

I had to run this command first before running bundle install, and it worked for me.

- run:
    name: Fix Ruby permissions
    command: sudo chown -R circleci:circleci /var/lib/gems /usr/local/bin && sudo chmod -R 755 /var/lib/gems /usr/local/bin