Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gem::FilePermissionError when installing Ruby dependencies #43

Closed
AlexKrupa opened this issue Mar 30, 2022 · 4 comments
Closed

Gem::FilePermissionError when installing Ruby dependencies #43

AlexKrupa opened this issue Mar 30, 2022 · 4 comments

Comments

@AlexKrupa
Copy link

I encountered this problem when upgrading from a legacy Android image to the latest next-gen one.

Problem

Running ruby/install-deps step from Ruby orb fails like this:

Gemfile.lock is bundled with bundler version 2.3.3
Installing bundler 2.3.3
Fetching bundler-2.3.3.gem
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /var/lib/gems/2.7.0 directory.

After solving this for /var/libs/gems it fails again for /usr/local/bin directory.

Solution

Use chmod to grant directory permissions as described in this StackOverflow answer.

steps:
  # ...
  - run:
       name: Fix Ruby permissions
       command: sudo chmod -R a+w /var/lib/gems/ && sudo chmod -R a+w /usr/local/bin
  - ruby/install-deps
  # ...

I'm not sure if that's the best approach, but it solved the issue for me. Is it something that could be included in the image?

@sw360cab
Copy link

@AlexKrupa your solution works, you could even write it shorter

steps:
  - run:
       name: Fix Ruby permissions
       command: sudo chmod -R a+w /var/lib/gems/ /usr/local/bin

@sw360cab
Copy link

AFAIK

The variant are built starting from Dockerfile.template
which uses as base image cimg/base:xxx

In my case I am using cimg/android:2022.01.1-node
which is based upon cimg/base:2022.01.

The latter is based upon Ubuntu 20.04, where the issue may come from

circleci@9b41a1eb3b0a:~/project$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:        20.04
Codename:       focal

Indeed it looks like the issue has been fixed in following versions of Ubuntu starting from 20.10.4 on, see https://stackoverflow.com/a/68258603/2199731

@FelicianoTech
Copy link
Contributor

This looks to be a problem with the Ruby orb. Closing for now.

@FelicianoTech FelicianoTech closed this as not planned Won't fix, can't repro, duplicate, stale Aug 19, 2022
@sw360cab
Copy link

@FelicianoTech does this mean that more recent versions of the ORBs won't be affected by this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants