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 3.0.0 `require': cannot load such file #2535

Closed
k-yamada-4105156 opened this Issue Dec 20, 2018 · 16 comments

Comments

9 participants
@k-yamada-4105156
Copy link

k-yamada-4105156 commented Dec 20, 2018

I'm having a problem

My current problem is
I cannot build nokogiri libraries in gem 3.0.0 with non privileged user
I cloud build in gem 2.7.8 and gem 2.5.1
How cloud I solve this problem?

my environment

Amazon linux
ruby 2.3.1

I ran command below
root@ip-10-7-4-13:~$ runuser -l deploy -c 'bundle config build.nokogiri --use-system-libraries'

Error messages below

/usr/local/rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- rubygems/core_ext/kernel_warn (LoadError)
	from /usr/local/rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/local/rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems.rb:1395:in `<top (required)>'
	from <internal:gem_prelude>:4:in `require'
	from <internal:gem_prelude>:4:in `<internal:gem_prelude>'

This issue is related to:

  • Network problems
  • Installing a library
  • Publishing a library
  • The command line gem
  • Other

Here are my current environment details:

$ gem env version
root@ip-10-7-4-13:~$ gem -v
3.0.0
@hsbt

This comment has been minimized.

Copy link
Member

hsbt commented Dec 20, 2018

I couldn't reproduce with Ruby 2.3.8 and RubyGems 3.0.0.

~ > ruby -v
ruby 2.3.8p459 (2018-10-18 revision 65136) [x86_64-darwin18]
~ > gem -v
3.0.0
~ > gem i nokogiri -- --use-system-libraries=true
Fetching nokogiri-1.9.1.gem
Fetching mini_portile2-2.4.0.gem
Successfully installed mini_portile2-2.4.0
Building native extensions with: '--use-system-libraries=true'
This could take a while...
Successfully installed nokogiri-1.9.1
1 gem installed

Maybe, It's related with #2442

@k-yamada-4105156

This comment has been minimized.

Copy link
Author

k-yamada-4105156 commented Dec 20, 2018

OK, I am going to check it.
Thank you for your information.

@hsbt

This comment has been minimized.

Copy link
Member

hsbt commented Dec 20, 2018

Thanks. I did confirm to contain kernel_warn.rb in Manifest.txt

https://github.com/rubygems/rubygems/blob/master/Manifest.txt#L314

@ryanjwilke

This comment has been minimized.

Copy link

ryanjwilke commented Dec 20, 2018

I'm having a similar issue on my CI platform. I'm getting lots of this:

/usr/gem/bin/bundle:23:in `load': cannot load such file -- /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.2/exe/bundle

So far, the fix has been to add RUN gem update --system 2.7.8 to my Dockerfile.

@MSP-Greg

This comment has been minimized.

Copy link
Contributor

MSP-Greg commented Dec 20, 2018

@ryanjwilke

Not being sure what other gem commands are being run, but the following should be safe for anything newer than Ruby 2.2.x. It will use RG 3.0.0 rather than forcing 2.7.8...

gem update --system --conservative
gem i bundler --conservative
@ryanjwilke

This comment has been minimized.

Copy link

ryanjwilke commented Dec 20, 2018

@MSP-Greg I just tried that, but is still breaks with the following error message:

/usr/gem/bin/bundle:23:in `load': cannot load such file -- /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.2/exe/bundle (LoadError)
	from /usr/gem/bin/bundle:23:in `<main>'
@MSP-Greg

This comment has been minimized.

Copy link
Contributor

MSP-Greg commented Dec 20, 2018

@ryanjwilke

What CI platform? Do you know if bundler is already installed? Your error shows the standard 'internal' gem path, but I think RG 3.0.0 installs bundler in 'site_ruby'.

I think I've repo'd it locally. Adding the following before the above two lines fixed it.

gem uninstall bundler -x --force
@ryanjwilke

This comment has been minimized.

Copy link

ryanjwilke commented Dec 21, 2018

@MSP-Greg CodeShip is the CI platform. I'm using Jekyll's docker image which already has some stuff packaged with it. Here's what the Dockerfile looks like:

FROM jekyll/jekyll:3.8.5
ENV JEKYLL_VERSION=3.8.5

RUN apk --no-cache add curl jq
RUN gem update --system 2.7.8
RUN npm install --global surge

WORKDIR /srv/jekyll

COPY Gemfile* /srv/jekyll/

RUN bundle install

ADD . /srv/jekyll
@zx1986

This comment has been minimized.

Copy link

zx1986 commented Dec 21, 2018

I got this issue in phusion/passenger-ruby25:0.9.34 docker image too.

ruby '2.5.1'

@hsbt

This comment has been minimized.

Copy link
Member

hsbt commented Dec 21, 2018

@ryanjwilke @zx1986 Maybe your problems caused by the Linux distribution problem like Debian. I can not support their specific problems because they added custom configuration about the package of RubyGems.

@envygeeks

This comment has been minimized.

Copy link

envygeeks commented Dec 21, 2018

@hsbt this happens on Alpine Linux too. #2541 (comment) the only thing special about Alpine Linux docker image is GEM_HOME, and BUNDLE_HOME

@envygeeks

This comment has been minimized.

Copy link

envygeeks commented Dec 21, 2018

@ryanjwilke I've fixed this bug in jekyll/jekyll Docker image, and it's deploying right now, this should no longer be an issue on my images. At the end of the day this is not a jekyll/jekyll Docker image bug, but I've fixed it there because a lot of people use that image.

@jeremywadsack

This comment has been minimized.

Copy link

jeremywadsack commented Dec 21, 2018

We are having the same problem on Circle CI. See this StackOverflow post for additional instances.

I ended up changing out Dockerfile to not update rubygems:

- RUN gem update --system --no-document
+ RUN gem update bundler --no-document

Per #2541 we are running these commands a root because we are building a container. But then we create a user to run bundle so that gems are installed with the user that will be accessing them.

@headius

This comment has been minimized.

Copy link
Contributor

headius commented Dec 22, 2018

JRuby master (pre-9.2.6 with fixes for recently discovered issues) appears to be unaffected, but previous versions will likely not get this far due to #2542.

@hsbt hsbt added this to the 3.0.1 milestone Dec 22, 2018

@hsbt hsbt self-assigned this Dec 22, 2018

@zx1986

This comment has been minimized.

Copy link

zx1986 commented Dec 22, 2018

my solution is lock rubygems version by:
gem update --system 2.7.8

hsbt added a commit that referenced this issue Dec 22, 2018

bundlerbot bot pushed a commit that referenced this issue Dec 22, 2018

Merge #2546
2546: Added permissions to installed files for non-owners r=hsbt a=hsbt

# Description:

#2219 introduced to deny to access files installed rubygems installer. I'm not sure why @nobu choose `700` permission instead of `755`.

I will merge this after discussion with @nobu.

  Fixes #2535
  Fixes #2541
  Fixes #2543

______________

# Tasks:

- [ ] Describe the problem / feature
- [ ] Write tests
- [ ] Write code to solve the problem
- [ ] Get code review from coworkers / friends

I will abide by the [code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md).


Co-authored-by: SHIBATA Hiroshi <hsbt@ruby-lang.org>

@bundlerbot bundlerbot bot closed this in #2546 Dec 22, 2018

hsbt added a commit that referenced this issue Dec 22, 2018

Merge #2546
2546: Added permissions to installed files for non-owners r=hsbt a=hsbt

# Description:

#2219 introduced to deny to access files installed rubygems installer. I'm not sure why @nobu choose `700` permission instead of `755`.

I will merge this after discussion with @nobu.

  Fixes #2535
  Fixes #2541
  Fixes #2543

______________

# Tasks:

- [ ] Describe the problem / feature
- [ ] Write tests
- [ ] Write code to solve the problem
- [ ] Get code review from coworkers / friends

I will abide by the [code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md).


Co-authored-by: SHIBATA Hiroshi <hsbt@ruby-lang.org>
(cherry picked from commit 8984913)
@hsbt

This comment has been minimized.

Copy link
Member

hsbt commented Dec 23, 2018

CamJN added a commit to phusion/passenger_binary_build_automation that referenced this issue Dec 27, 2018

CamJN added a commit to phusion/passenger that referenced this issue Dec 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.