Skip to content

Gem::FilePermissionError: You don't have write permissions for the /var/lib/gems/3.1.0 directory. #6759

@Ghosty1776

Description

@Ghosty1776

Thank you for contributing to the
rubygems repository, and specifically to
RubyGems.

Describe the problem as clearly as you can

While trying to install prereqs for blue_hydra on kali linux I run into an issue where bundle install does not work which means I am unable to download sqlite3 (one of the required dependencies). The reason it gives me is that there is a lock on one of the gemfiles and I don't have permissions to write. I've tried every update and command online that I can find, but nothing seems to work.

Did you try upgrading RubyGems?

tried to update ruby gems and received this error message: ERROR: Your RubyGems was installed trough APT, and upgrading it through RubyGems itself is unsupported. If you really need the latest version of RubyGems (tip: you usually don't), then you need to install RubyGems (and Ruby) manually, maybe using tools like ruby-install, rvm, etc.

Post steps to reproduce the problem

338 sudo apt-get update
339 sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
340 git clone https://github.com/rbenv/rbenv.git ~/.rbenv
341 echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
342 exec $SHELL
343 git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
344 echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
345 exec $SHELL
346 rbenv install 2.3.1
347 rbenv global 2.3.1
348 ruby -v
349 gem install bundler
350 rbenv rehash
351 ruby -v
352 bundle install
353 gem install rubygems-update
431 sudo gem install rubygems-update
432 update_rubygems
433 gem update --system

Which command did you run?

bundle install

What were you expecting to happen?

I expected it to install all the needed dependencies, but instead gave me an error message saying it was unable to install sqlite3 do to not having write permissions on the /var/lib/gems/3.1.0 directory.

What actually happened?

Gem::FilePermissionError: You don't have write permissions for the /var/lib/gems/3.1.0 directory.
/usr/lib/ruby/vendor_ruby/rubygems/installer.rb:720:in verify_gem_home' /usr/lib/ruby/vendor_ruby/rubygems/installer.rb:910:in pre_install_checks'
/var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/rubygems_gem_installer.rb:64:in pre_install_checks' /var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/rubygems_gem_installer.rb:12:in install'
/var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/source/rubygems.rb:201:in install' /var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/installer/gem_installer.rb:54:in install'
/var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/installer/gem_installer.rb:16:in install_from_spec' /var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/installer/parallel_installer.rb:156:in do_install'
/var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/installer/parallel_installer.rb:147:in block in worker_pool' /var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/worker.rb:62:in apply_func'
/var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/worker.rb:57:in block in process_queue' /var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/worker.rb:54:in loop'
/var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/worker.rb:54:in process_queue' /var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/worker.rb:90:in block (2 levels) in create_threads'
Errno::EACCES: Permission denied @ rb_sysopen - /var/lib/gems/3.1.0/bundler.lock
/var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/process_lock.rb:9:in initialize' /var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/process_lock.rb:9:in open'
/var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/process_lock.rb:9:in lock' /var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/installer.rb:71:in run'
/var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/installer.rb:23:in install' /var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/cli/install.rb:62:in run'
/var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/cli.rb:261:in block in install' /var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/settings.rb:131:in temporary'
/var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/cli.rb:260:in install' /var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/vendor/thor/lib/thor/command.rb:27:in run'
/var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in invoke_command' /var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/vendor/thor/lib/thor.rb:392:in dispatch'
/var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/cli.rb:34:in dispatch' /var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/vendor/thor/lib/thor/base.rb:485:in start'
/var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/cli.rb:28:in start' /var/lib/gems/3.1.0/gems/bundler-2.4.14/exe/bundle:37:in block in <top (required)>'
/var/lib/gems/3.1.0/gems/bundler-2.4.14/lib/bundler/friendly_errors.rb:117:in with_friendly_errors' /var/lib/gems/3.1.0/gems/bundler-2.4.14/exe/bundle:29:in <top (required)>'
/usr/local/bin/bundle:25:in load' /usr/local/bin/bundle:25:in

'

Run gem env and paste the output below

RubyGems Environment:

  • RUBYGEMS VERSION: 3.3.15
  • RUBY VERSION: 3.1.2 (2022-04-12 patchlevel 20) [x86_64-linux-gnu]
  • INSTALLATION DIRECTORY: /var/lib/gems/3.1.0
  • USER INSTALLATION DIRECTORY: /home/kali/.local/share/gem/ruby/3.1.0
  • RUBY EXECUTABLE: /usr/bin/ruby3.1
  • GIT EXECUTABLE: /usr/bin/git
  • EXECUTABLE DIRECTORY: /usr/local/bin
  • SPEC CACHE DIRECTORY: /home/kali/.local/share/gem/specs
  • SYSTEM CONFIGURATION DIRECTORY: /etc
  • RUBYGEMS PLATFORMS:
    • ruby
    • x86_64-linux
  • GEM PATHS:
    • /var/lib/gems/3.1.0
    • /home/kali/.local/share/gem/ruby/3.1.0
    • /usr/local/lib/ruby/gems/3.1.0
    • /usr/lib/ruby/gems/3.1.0
    • /usr/lib/x86_64-linux-gnu/ruby/gems/3.1.0
    • /usr/share/rubygems-integration/3.1.0
    • /usr/share/rubygems-integration/all
    • /usr/lib/x86_64-linux-gnu/rubygems-integration/3.1.0
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :backtrace => false
    • :bulk_threshold => 1000
  • REMOTE SOURCES:
  • SHELL PATH:
    • /usr/local/sbin
    • /usr/local/bin
    • /usr/sbin
    • /usr/bin
    • /sbin
    • /bin
    • /usr/local/games
    • /usr/games

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions