cannot load such file -- net/ssh/authentication/agent/socket (LoadError)

5.2k Views Asked by At

If i run rails s

/Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- net/ssh/authentication/agent/socket (LoadError)
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-2.5.0/lib/net/ssh/authentication/agent.rb:22:in `<top (required)>'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-2.5.0/lib/net/ssh/authentication/key_manager.rb:4:in `<top (required)>'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-2.5.0/lib/net/ssh/authentication/session.rb:4:in `<top (required)>'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-2.5.0/lib/net/ssh.rb:11:in `<top (required)>'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-gateway-1.1.0/lib/net/ssh/gateway.rb:2:in `<top (required)>'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.12.0/lib/capistrano/configuration/connections.rb:2:in `<top (required)>'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.12.0/lib/capistrano/configuration.rb:5:in `<top (required)>'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.12.0/lib/capistrano.rb:3:in `<top (required)>'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.1.3/lib/bundler/runtime.rb:68:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.1.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.1.3/lib/bundler/runtime.rb:66:in `each'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.1.3/lib/bundler/runtime.rb:66:in `block in require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `each'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.1.3/lib/bundler.rb:119:in `require'
    from /Users/frankie/projects/unitedfreelance/config/application.rb:13:in `<top (required)>'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.0/lib/rails/commands.rb:53:in `require'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.0/lib/rails/commands.rb:53:in `block in <top (required)>'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.0/lib/rails/commands.rb:50:in `tap'
    from /Users/frankie/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.0/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Gemfile

source 'http://rubygems.org'

gem 'rails', '3.2.0'

# Bundle edge Rails instead:
# gem 'rails',     :git => 'git://github.com/rails/rails.git'

gem 'pg'
gem "cocoon"
gem 'nokogiri'
gem 'hpricot'
gem "formtastic", "~> 2.1.1"
gem "activeadmin", "~> 0.4.4"
gem 'omniauth'
gem 'country-select'
gem "paperclip", "~> 3.0"
gem 'cancan'
gem 'rolify'

gem "meta_search",    '>= 1.1.0.pre'
gem 'bourbon', "~> 2.0.0.rc1"
gem "rails-boilerplate"
gem 'geocoder'
gem 'httparty'
gem 'hashie'
gem 'will_paginate', :git => "git://github.com/mislav/will_paginate.git"
gem 'thinking-sphinx', '2.0.10'
gem 'sanitize'
gem 'feedzirra'
gem "crypt19", "~> 1.2.1"
gem 'wicked_pdf'
gem 'forem', :git => "git://github.com/radar/forem.git"
gem 'thin'
gem 'whenever', :require => false
gem "ckeditor", "3.7.1"
# gem 'sisow'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end

gem 'haml-rails' 
gem 'jquery-rails'

group :development do
    gem 'ruby_parser'
end

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the web server
gem 'unicorn'

# Deploy with Capistrano
gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

One second it works, the next it doesn't.

I stopped working after I tried to fix the CKeditor integration following this guide: https://github.com/galetahub/ckeditor

Update

This error occured because I am using Capistrano and that gem requires net-ssh. The net-ssh gem was updated from 2.4 -> 2.5.0 which caused the problem.

Updated my Gemfile:

gem 'rails', '3.2.0'
gem "net-ssh", "~> 2.4.0"

Then ran $ gem update net-ssh

And the error with the rails s command dissapeared. Not using Capistrano yet to deploy, so can't say if the error is present using deployment.

Update 2

Capistrano failed to deploy, so that's messed up. When using cap deploy I get the error message you see at the start of the post.

Update 3

Upgraded net-ssh to 2.5.1 because in the comments someone mentioned 2.5.0 was broken. After the upgrade the require issue was solved, however, Capistrano still will not deploy.

[deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: 85.xxx.xxx.xxx (NameError: uninitialized constant Net::SSH::KnownHosts::SUPPORTED_TYPE)
connection failed for: 85.xxx.xxx.xxx (NameError: uninitialized constant Net::SSH::KnownHosts::SUPPORTED_TYPE)

Update 4 (plus workaround)

In the comments below a workaround was posted.

  • Keep your net-ssh version on 2.5.1
  • Before you deploy with Capistrano, delete the line with your server from the ~/.ssh/known_hosts file
  • You can now deploy once. Repeat before every deploy.
3

There are 3 best solutions below

3
On

Downgrading to 2.4.0 allows for rails s to work, but cap commands fail.

Make sure you use 2.5.1 by issueing this command:

bundle update net-ssh

You may also add this to your Gemfile:

gem "net-ssh", "~> 2.5.1"
2
On

I think it's an error in capistrano gem. I just executed bundle update for my project and have the same error, but if I remove capistrano from Gemfile, everything works.

UPD: Capistrano gem uses net-ssh gem, that was updated 1 hour ago.

0
On

Gem version 2.5.2 fixes this issue for me.