Summary: | dev-ruby/rubygems-3.0.9 Errno::EACCES: Permission denied @ rb_file_s_rename when trying to bundle install using rubygems > 3.0.3 | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Marat Radchenko <marat> |
Component: | Current packages | Assignee: | Gentoo Ruby Team <ruby> |
Status: | CONFIRMED --- | ||
Severity: | normal | CC: | jstein, sam |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
See Also: |
https://bugs.gentoo.org/show_bug.cgi?id=676946 https://bugs.gentoo.org/show_bug.cgi?id=911401 |
||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 818718 | ||
Attachments: | emerge --info output |
Description
Marat Radchenko
2021-05-13 12:21:05 UTC
The command bundle (/usr/bin/bundle) belongs to the dev-ruby/bundler package. What version of dev-ruby/bundler are you using? Is it correct that you are using =dev-ruby/bundler-2.1.4 as suggested in the Issue of rubygems/rubygems on GitHub? It might be possible that specific combinations of versions of dev-ruby/rubygems and dev-ruby/bundler are causing problems. I suggest that you try newer versions of dev-ruby/bundler, although they do not have stable keywords. (In reply to Tee KOBAYASHI from comment #1) > The command bundle (/usr/bin/bundle) belongs to the dev-ruby/bundler > package. What version of dev-ruby/bundler are you using? Is it correct that > you are using =dev-ruby/bundler-2.1.4 as suggested in the Issue of > rubygems/rubygems on GitHub? > > It might be possible that specific combinations of versions of > dev-ruby/rubygems and dev-ruby/bundler are causing problems. I suggest that > you try newer versions of dev-ruby/bundler, although they do not have stable > keywords. I am reproducing this with both =dev-ruby/bundler-2.1.4 (current stable) and =dev-ruby/bundler-2.2.17 (latest available in tree). Okay, I see some difference. This is output of `bundle env` with Rubygems 3.2.14 (broken): $ bundle env ## Environment ``` Bundler 2.2.17 Platforms ruby, x86_64-linux Ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux] Full Path /usr/bin/ruby26 Config Dir /etc RubyGems 3.2.14 Gem Home /usr/lib64/ruby/gems/2.6.0 <--------------------- Gem Path /home/irina/.gem/ruby/2.6.0:/usr/lib64/ruby/gems/2.6.0:/usr/local/lib64/ruby/gems/2.6.0 User Home /home/irina User Path /home/irina/.gem/ruby/2.6.0 Bin Dir /usr/bin <--------------------- Tools Git 2.26.3 RVM not installed rbenv not installed chruby not installed ``` ## Bundler Build Metadata ``` Built At 2021-05-05 Git SHA 69cbd6e10e Released Version true ``` And this is output of `bundle env` with Rubygems 3.0.3 (working) $ bundle env ## Environment ``` Bundler 2.2.17 Platforms ruby, x86_64-linux Ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux] Full Path /usr/bin/ruby26 Config Dir /etc RubyGems 3.0.3 Gem Home /home/irina/.gem/ruby/2.6.0 <--------------------- Gem Path /home/irina/.gem/ruby/2.6.0:/usr/local/lib64/ruby/gems/2.6.0:/usr/lib64/ruby/gems/2.6.0 User Home /home/irina User Path /home/irina/.gem/ruby/2.6.0 Bin Dir /home/irina/.gem/ruby/2.6.0/bin <--------------------- Tools Git 2.26.3 RVM not installed rbenv not installed chruby not installed ``` ## Bundler Build Metadata ``` Built At 2021-05-05 Git SHA 69cbd6e10e Released Version true ``` Note that for some reason "Gem Home" and "Bin Dir" have different values. On 3.0.3 it installs Gems to user dir while on 3.2.4 it tries to install to /usr Ahha! And that is most likely caused by the fact that Rubygems 3.0.3 uses files/gentoo-defaults.rb while Rubygems 3.0.9 uses files/gentoo-defaults-3.rb. In files/gentoo-defaults.rb, there is: def default_dir Process.euid == 0 ? local_dir : user_dir end While in files/gentoo-defaults-3.rb, there's something different going on. This is related to https://bugs.gentoo.org/676946#c2 Since rubygems-3.0.3 was removed in https://github.com/gentoo/gentoo/commit/0b5c29a63612cb1a39a2ef56789c01caaee7ddc3, there's no longer a single rubygems version in tree where bundler works under non-root account =/ (In reply to Marat Radchenko from comment #5) > Since rubygems-3.0.3 was removed in > https://github.com/gentoo/gentoo/commit/ > 0b5c29a63612cb1a39a2ef56789c01caaee7ddc3, there's no longer a single > rubygems version in tree where bundler works under non-root account =/ Sorry, I wasn't aware that this version was used as a workaround. I've restored the version and will try to tackle the bundler issue later this week or the next. dev-ruby/rubygems-3.0.9 can no longer be used as a workaround because it conflicts with dev-lang/ruby-2.7.x that went stable recently. I possibly could mask the latter, but this is not going to scale even mid-term. The issue is reproducible with dev-lang/ruby-2.7.4 too: $ bundle update Fetching gem metadata from https://rubygems.org/......... Resolving dependencies... Fetching rake 13.0.6 (was 13.0.3) Errno::EACCES: Permission denied @ rb_file_s_rename - (/home/irina/.gem/ruby/2.7.0/cache/rake-13.0.6.gem, /usr/lib64/ruby/gems/2.7.0/cache/rake-13.0.6.gem) An error occurred while installing rake (13.0.6), and Bundler cannot continue. Make sure that `gem install rake -v '13.0.6' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: rake As I said in comment #4, the root of this issue lies in the difference between files/gentoo-defaults.rb and files/gentoo-defaults-3.rb that was introduced in https://bugs.gentoo.org/676946#c2. I want to emphasize that current inability to install gems as a non-root user makes Gentoo somewhat unusable for Ruby development. I'm currently testing changes to the gentoo-defaults file with rubygems 3.2.31, which is currently masked for testing. I'd believe this should address the install issues, but I'd be happy to get some feedback on it before unmasking it. "bundle env" as user: Bundler 2.2.31 Platforms ruby, x86_64-linux Ruby 2.7.5p203 (2021-11-24 revision f69aeb83146be640995753667fdd6c6f157527f5) [x86_64-linux] Full Path /usr/bin/ruby27 Config Dir /etc RubyGems 3.2.31 Gem Home /usr/lib64/ruby/gems/2.7.0 Gem Path /home/graaff/.local/share/gem/ruby/2.7.0:/usr/lib64/ruby/gems/2.7.0:/usr/local/lib64/ruby/gems/2.7.0 User Home /home/graaff User Path /home/graaff/.local/share/gem/ruby/2.7.0 Bin Dir /home/graaff/bin "bundle env" as root: Bundler 2.2.31 Platforms ruby, x86_64-linux Ruby 2.7.5p203 (2021-11-24 revision f69aeb83146be640995753667fdd6c6f157527f5) [x86_64-linux] Full Path /usr/bin/ruby27 Config Dir /etc RubyGems 3.2.31 Gem Home /usr/lib64/ruby/gems/2.7.0 Gem Path /root/.gem/ruby/2.7.0:/usr/lib64/ruby/gems/2.7.0:/usr/local/lib64/ruby/gems/2.7.0 User Home /root User Path /root/.gem/ruby/2.7.0 Bin Dir /usr/local/bin The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a6a37f10bb8b1cc9c00b6ab7228ee8ffa2f01bff commit a6a37f10bb8b1cc9c00b6ab7228ee8ffa2f01bff Author: Hans de Graaff <graaff@gentoo.org> AuthorDate: 2021-11-26 10:06:24 +0000 Commit: Hans de Graaff <graaff@gentoo.org> CommitDate: 2021-11-26 10:06:37 +0000 dev-ruby/rubygems: add 3.2.31 with new gentoo profile This version also updates the gentoo-defaults.rb profile to address issues with installing gems directly with rubygems or bundler, either as root or as a normal user. Bug: https://bugs.gentoo.org/789957 Package-Manager: Portage-3.0.28, Repoman-3.0.3 Signed-off-by: Hans de Graaff <graaff@gentoo.org> dev-ruby/rubygems/Manifest | 1 + dev-ruby/rubygems/files/gentoo-defaults-5.rb | 65 ++++++++++++++++ dev-ruby/rubygems/rubygems-3.2.31.ebuild | 110 +++++++++++++++++++++++++++ 3 files changed, 176 insertions(+) The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=05be1308f64a6ee663e8c2d1a5a7f60caa904b2a commit 05be1308f64a6ee663e8c2d1a5a7f60caa904b2a Author: Hans de Graaff <graaff@gentoo.org> AuthorDate: 2022-01-16 16:03:27 +0000 Commit: Hans de Graaff <graaff@gentoo.org> CommitDate: 2022-01-16 16:03:38 +0000 dev-ruby/rubygems: add 3.2.33 and update gentoo-defaults This version uses a new set of defaults that make better use of the existing mechanism for configuration and require us to overwrite less methods. Bug: https://bugs.gentoo.org/789957 Package-Manager: Portage-3.0.28, Repoman-3.0.3 Signed-off-by: Hans de Graaff <graaff@gentoo.org> dev-ruby/rubygems/Manifest | 2 +- dev-ruby/rubygems/files/gentoo-defaults-5.rb | 44 +++++++--------------- ...bygems-3.2.31.ebuild => rubygems-3.2.33.ebuild} | 2 +- 3 files changed, 15 insertions(+), 33 deletions(-) I've tried unmasking and installing =dev-ruby/rubygems-3.2.33, but still observe the same behavior. $ bundle update Fetching gem metadata from https://rubygems.org/........ Fetching gem metadata from https://rubygems.org/. Resolving dependencies....................... Bundler::PermissionError: There was an error while trying to write to `/usr/lib64/ruby/gems/2.7.0/cache`. It is likely that you need to grant write permissions for that path. An error occurred while installing rake (13.0.6), and Bundler cannot continue. Make sure that `gem install rake -v '13.0.6' --source 'https://rubygems.org/'` succeeds before bundling. Output of `bundle env` says: ## Environment ``` Bundler 2.1.4 Platforms ruby, x86_64-linux Ruby 2.7.5p203 (2021-11-24 revision f69aeb83146be640995753667fdd6c6f157527f5) [x86_64-linux] Full Path /usr/bin/ruby27 Config Dir /etc RubyGems 3.2.33 Gem Home /usr/lib64/ruby/gems/2.7.0 Gem Path /home/irina/.gem/ruby/2.7.0:/usr/lib64/ruby/gems/2.7.0:/usr/local/lib64/ruby/gems/2.7.0 User Home /home/irina User Path /home/irina/.gem/ruby/2.7.0 Bin Dir /usr/bin Tools Git 2.32.0 RVM not installed rbenv not installed chruby not installed ``` Alternative solution in https://bugs.gentoo.org/911401 if anyone is still having this issue. |