Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Permission denied issue that was reportedly fixed in previous update still exists #5518

Closed
Craig1f opened this issue Mar 16, 2017 · 10 comments · Fixed by #5954
Closed

Permission denied issue that was reportedly fixed in previous update still exists #5518

Craig1f opened this issue Mar 16, 2017 · 10 comments · Fixed by #5954

Comments

@Craig1f
Copy link

Craig1f commented Mar 16, 2017

Java HotSpot(TM) 64-Bit Server VM warning: You have loaded library /opt/jruby-1.6.7/lib/native/i386-Linux/libjffi-1.0.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c ', or link it with '-z noexecstack'.
--- ERROR REPORT TEMPLATE -------------------------------------------------------

Error Report

Questions

Please fill out answers to these questions, it'll help us figure out
why things are going wrong.

  • What did you do?

    I ran the command /home/nifi/.rvm/gems/jruby-9.1.7.0/bin/bundle

  • What did you expect to happen?

    I expected Bundler to build and install the gems in the directory I was in, which works for at least one co-worker and has worked in the past in a different environment

  • What happened instead?

    Instead, what happened was the error below.

  • Have you tried any solutions posted on similar issues in our issue tracker, stack overflow, or google?

    I tried looking through the Issues on GitHub which indicate that issues like mine were fixed in the version of bundler that I'm on

  • Have you read our issues document, https://github.com/bundler/bundler/blob/master/doc/contributing/ISSUES.md?

    ...

Backtrace

Errno::EACCES: Permission denied - /tmp/bundler-compact-index-20170315-4211-1i69fq8/.
  org/jruby/RubyFile.java:443:in `initialize'
  org/jruby/RubyIO.java:1135:in `open'
  /opt/jruby-1.6.7//lib/ruby/1.8/fileutils.rb:699:in `remove_entry_secure'
  /opt/jruby-1.6.7//lib/ruby/1.8/tmpdir.rb:131:in `mktmpdir'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/compact_index_client/updater.rb:30:in `update'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/compact_index_client.rb:81:in `update'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/compact_index_client.rb:68:in `update_and_parse_checksums!'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/fetcher/compact_index.rb:68:in `available?'
  org/jruby/RubyMethod.java:117:in `call'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/fetcher/compact_index.rb:15:in `available?'
  org/jruby/RubyProc.java:270:in `call'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/fetcher.rb:157:in `use_api'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/source/rubygems.rb:341:in `api_fetchers'
  org/jruby/RubyArray.java:2395:in `select'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/source/rubygems.rb:341:in `api_fetchers'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/source/rubygems.rb:346:in `remote_specs'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/index.rb:10:in `build'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/source/rubygems.rb:345:in `remote_specs'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/source/rubygems.rb:82:in `specs'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/definition.rb:263:in `index'
  org/jruby/RubyArray.java:1615:in `each'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/definition.rb:261:in `index'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/index.rb:10:in `build'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/definition.rb:258:in `index'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/definition.rb:252:in `resolve'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/definition.rb:176:in `specs'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/definition.rb:164:in `resolve_remotely!'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/installer.rb:226:in `resolve_if_need'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/installer.rb:78:in `run'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/installer.rb:24:in `install'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/cli/install.rb:70:in `run'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/cli.rb:181:in `install'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/settings.rb:99:in `temporary'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/cli.rb:180:in `install'
  org/jruby/RubyKernel.java:2076:in `send'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/cli.rb:20:in `dispatch'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/cli.rb:11:in `start'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/exe/bundle:32:in `(root)'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/exe/bundle:24:in `(root)'
  org/jruby/RubyKernel.java:1058:in `load'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/gems/bundler-1.14.6/exe/bundle:19:in `'
  org/jruby/RubyKernel.java:1083:in `eval'
  /home/nifi/.rvm/gems/jruby-9.1.7.0/bin/jruby_executable_hooks:15:in `(root)'

Environment

Bundler   1.14.6
Rubygems  1.8.15
Ruby      1.8.7 (2012-02-22 patchlevel 357) [java]
GEM_HOME  /home/nifi/.rvm/gems/jruby-9.1.7.0
GEM_PATH  /home/nifi/.rvm/gems/jruby-9.1.7.0:/home/nifi/.rvm/gems/jruby-9.1.7.0@global
RVM       1.29.1 (latest)
Git       not installed
Platform  universal-java-1.8
OpenSSL   JRuby-OpenSSL 0.9.20
rubygems-bundler (1.4.4)

--- TEMPLATE END ----------------------------------------------------------------

Unfortunately, an unexpected error occurred, and Bundler cannot continue.

First, try this link to see if there are any existing issue reports for this error:
https://github.com/bundler/bundler/search?q=Permission+denied+-+%2Ftmp%2Fbundler-compact-index-20170315-4211-1i69fq8%2F.&type=Issues

If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
https://github.com/bundler/bundler/issues/new
@colby-swandale
Copy link
Member

Does the user/group that is running bundle have access to read/write to /tmp/bundler-compact-index-20170315-4211-1i69fq8/.?

@colby-swandale
Copy link
Member

colby-swandale commented Mar 16, 2017

Thanks for providing the error. Bundler really should be presenting a proper error message to the user when Bundler cannot write to either $HOME or the tmp dir. I can work on this.

@Craig1f
Copy link
Author

Craig1f commented Mar 16, 2017

I have one user called nifi. I have not installed anything as root. nifi owns the ~/.bundle directory. Also, the /tmp/bundler-compact-index-20170315-4211-1i69fq8/ file is created dynamically during bundle install, and nifi DOES have access. It is also empty when I check the contents after running bundle install. Also, I've tried running this as root and I get the same error.

My suspicion is that the error is because some file doesn't exist that the bundle install expects in the /tmp folder. I don't think it's a permission error, I think it's a file-doesn't-exist error that is masquerading as a permission error. But that's just a hunch I can't really prove.

@Craig1f
Copy link
Author

Craig1f commented Mar 16, 2017

Also, a co-worker has installed everything and his seems to work. We can't figure out what we've done differently in our setup. We aren't using a scripted provisioning yet but plan to later.

Running CentOS 6.8 in VirtualBox.

@ajwann
Copy link
Contributor

ajwann commented Aug 13, 2017

@colby-swandale I'd like to work on this, but I'm not 100% sure what the ask is. Does bundler just need to return an error message if it doesn't have permissions on $HOME or /tmp?

@colby-swandale
Copy link
Member

Pretty much, there are similar errors for when the disk was full as well. We already handle these situations in Bundler but the client index is not, see https://github.com/bundler/bundler/blob/master/lib/bundler/shared_helpers.rb#L112

@ajwann
Copy link
Contributor

ajwann commented Aug 15, 2017

Thanks for the info. This issue seems pretty similar to #5786, are we sure that they are different?
If they are really different issues, I will get started and put up a PR in the next week or so.

@colby-swandale
Copy link
Member

colby-swandale commented Aug 15, 2017

#5786 is fixing a different problem relating to permissions in the bundler directory. I'm not sure what i meant when i said $HOME before.

@ajwann
Copy link
Contributor

ajwann commented Aug 18, 2017 via email

@segiddins
Copy link
Member

Excellent, thanks!

bundlerbot added a commit that referenced this issue Sep 10, 2017
…r=segiddins

ensure $HOME and Dir.tmpdir are writable

Fixes #5518

### What was the end-user problem that led to this PR?
A user had issues installing gems due to a permissions issue on the temp dir, because
Bundler was not checking for proper permissions on the temp directory or $HOME.

### What was your diagnosis of the problem?
After discussing the issue with @colby-swandale, the solution was to check permissions on $HOME and the ```tmpdir```.

### What is your fix for the problem, implemented in this PR?
The creation of the [temp dir](https://github.com/bundler/bundler/blob/master/lib/bundler/compact_index_client/updater.rb#L31) is now wrapped in the block passed to ```filesystem_access```, so ```filesystem_access``` will rescue the ```Errno::EACCES``` exception which is thrown if the effective user of the bundler process doesn't have sufficient permissions to create the temp dir.

### Why did you choose this fix out of the possible options?
I chose this fix because it's what was discussed in the original issue thread.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants