Reputation: 7061
I use sudo
to install gems and update rubygems itself but this causes the problem of all new files in /usr/lib/ruby/gems/1.8/gems
to be owned by root:root
with a permission of 750
This in turn causes most gems to fail to load.
For example, I recently updated rubygems and if I try gem env
I get:
/usr/local/lib/site_ruby/1.8/rubygems/specification.rb:512:in `read': Permission denied - /usr/lib/ruby/gems/1.8/specifications/rubygems-update-1.6.2.gemspec (Errno::EACCES) from /usr/local/lib/site_ruby/1.8/rubygems/specification.rb:512:in `load' from /usr/local/lib/site_ruby/1.8/rubygems/source_index.rb:116:in `load_gems_in' from /usr/local/lib/site_ruby/1.8/rubygems/source_index.rb:115:in `each' from /usr/local/lib/site_ruby/1.8/rubygems/source_index.rb:115:in `load_gems_in' from /usr/local/lib/site_ruby/1.8/rubygems/source_index.rb:112:in `reverse_each' from /usr/local/lib/site_ruby/1.8/rubygems/source_index.rb:112:in `load_gems_in' from /usr/local/lib/site_ruby/1.8/rubygems/source_index.rb:309:in `refresh!' from /usr/local/lib/site_ruby/1.8/rubygems/source_index.rb:67:in `from_gems_in' from /usr/local/lib/site_ruby/1.8/rubygems/source_index.rb:47:in `from_installed_gems' from /usr/local/lib/site_ruby/1.8/rubygems.rb:1025:in `source_index' from /usr/local/lib/site_ruby/1.8/rubygems/gem_path_searcher.rb:135:in `init_gemspecs' from /usr/local/lib/site_ruby/1.8/rubygems/gem_path_searcher.rb:14:in `initialize' from /usr/local/lib/site_ruby/1.8/rubygems.rb:984:in `new' from /usr/local/lib/site_ruby/1.8/rubygems.rb:984:in `searcher' from /usr/local/lib/site_ruby/1.8/rubygems.rb:206:in `try_activate' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:57:in `require' from /usr/local/lib/site_ruby/1.8/rubygems/config_file.rb:55 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' from /usr/local/lib/site_ruby/1.8/rubygems/gem_runner.rb:8 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' from /usr/bin/gem:9
The current workaround is to chmod
all files to be readable by everyone but this is getting really annoying.
Some server stats:
uname -a
gives
Linux HomeBox 2.6.35 28-server #49-Ubuntu SMP Tue Mar 1 14:55:37 UTC 2011 x86_64 GNU/Linux
sudo gem env
gives
RubyGems Environment: - RUBYGEMS VERSION: 1.6.2 - RUBY VERSION: 1.8.7 (2010-06-23 patchlevel 299) [x86_64-linux] - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8 - RUBY EXECUTABLE: /usr/bin/ruby1.8 - EXECUTABLE DIRECTORY: /usr/bin - RUBYGEMS PLATFORMS: - ruby - x86_64-linux - GEM PATHS: - /usr/lib/ruby/gems/1.8 - /home/nicklas/.gem/ruby/1.8 - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - http://rubygems.org/
ruby -v
gives
ruby 1.8.7 (2010-06-23 patchlevel 299) [x86_64-linux]
I'd be happy to provide more info on the problem.
I just cleaned out all ruby and rubygems stuff and reinstalled it. Same problem.
Upvotes: 1
Views: 1801
Reputation: 37507
I use Ubuntu at home too, and after many problems with using apt to install, I discovered RVM.
RVM is super-simple to install, and gets you up and running quickly and easily. But once you start using it for a while, you'll discover that it is superior to any OS package system because it has features that allow you to:
rvm use 1.9.2
or rvm use jruby-1.6.2
and my path is switched automatically and everthing just works.My recommendation is to uninstall the native ruby package, and install RVM. You'll be glad you did.
Upvotes: 1