Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Errno::EPERM: Operation not permitted @ dir_s_rmdir

I'm getting this error when running bundle install:

Errno::EPERM: Operation not permitted @ dir_s_rmdir - /home/rbtlong/.bundle/cache/compact_index/rubygems.org.443.29b0360b937aa4d161703e6160654e47/versions
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb:50:in `unlink'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb:50:in `delete'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb:50:in `update'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb:64:in `update'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb:55:in `update_and_parse_checksums!'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/fetcher/compact_index.rb:65:in `available?'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/fetcher/compact_index.rb:15:in `call'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/fetcher/compact_index.rb:15:in `block in compact_index_request'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/fetcher.rb:154:in `use_api'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/source/rubygems.rb:331:in `block in api_fetchers'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/source/rubygems.rb:331:in `select'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/source/rubygems.rb:331:in `api_fetchers'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/source/rubygems.rb:336:in `block in remote_specs'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/index.rb:10:in `build'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/source/rubygems.rb:335:in `remote_specs'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/source/rubygems.rb:82:in `specs'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/lazy_specification.rb:56:in `__materialize__'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/spec_set.rb:91:in `block in materialize'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/spec_set.rb:88:in `map!'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/spec_set.rb:88:in `materialize'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/definition.rb:140:in `specs'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/definition.rb:129:in `resolve_remotely!'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/installer.rb:195:in `resolve_if_need'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/installer.rb:70:in `run'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/installer.rb:22:in `install'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/cli/install.rb:102:in `run'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/cli.rb:175:in `install'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/cli.rb:11:in `start'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/exe/bundle:27:in `block in <top (required)>'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors'
/home/rbtlong/.rvm/gems/ruby-2.2.3/gems/bundler-1.12.3/exe/bundle:19:in `<top (required)>'
/home/rbtlong/.rvm/gems/ruby-2.2.3/bin/bundle:23:in `load'
/home/rbtlong/.rvm/gems/ruby-2.2.3/bin/bundle:23:in `<main>'
/home/rbtlong/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `eval'
/home/rbtlong/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `<main>'

Environment:

Bundler 1.12.3
Rubygems 2.4.8
Ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
GEM_HOME /home/rbtlong/.rvm/gems/ruby-2.2.3
GEM_PATH /home/rbtlong/.rvm/gems/ruby-2.2.3:/home/rbtlong/.rvm/gems/ruby-2.2.3@global
RVM 1.27.0 (latest)
Git 2.5.0
rubygems-bundler (1.4.4)

Bundler Settings:

orig_path
Set via BUNDLE_ORIG_PATH: "/home/rbtlong/.rvm/gems/ruby-2.2.3/bin:/home/rbtlong/.rvm/gems/ruby-2.2.3@global/bin:/home/rbtlong/.rvm/rubies/ruby-2.2.3/bin:/home/rbtlong/.rvm/bin:/home/rbtlong/.dnx/runtimes/dnx-mono.1.0.0-rc1-update1/bin:/home/rbtlong/.dnx/bin:/usr/local/heroku/bin:/home/rbtlong/.rbenv/plugins/ruby-build/bin:/home/rbtlong/.rbenv/shims:/home/rbtlong/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
orig_gem_path
Set via BUNDLE_ORIG_GEM_PATH: "/home/rbtlong/.rvm/gems/ruby-2.2.3:/home/rbtlong/.rvm/gems/ruby-2.2.3@global"
like image 462
rbtLong Avatar asked Dec 18 '22 17:12

rbtLong


2 Answers

it worked after i did ...

sudo chmod 1777 -R /home/rbtlong/.bundle/cache/compact_index

and

sudo chmod 1777 -R /tmp
like image 118
rbtLong Avatar answered Dec 31 '22 16:12

rbtLong


For me it worked only with 777 mode. So I did

sudo chmod 777 -R /home/<username>/.bundle/cache/compact_index

and

sudo chmod 777 -R /tmp

Explaining why that works: it is related to Unix permissions. You can't run bundle as a superuser (root) but bundle is trying to write to a folder that the user must be a super user to write on them. chmod 777 -R is a command that basically says that anyone (not only superusers) can read or write to that folder, for files you can do the same without the -R parameter (That means recursive).

like image 22
Ana Ribeiro Avatar answered Dec 31 '22 17:12

Ana Ribeiro