Reputation: 393
I am getting this error on doing cap production deploy in my rails application my net-ssh version is 5.0.2 can anyone please help me how i can fix this. My server is Puma
#<Thread:0x00007fe400cfb5e8@/Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
26: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
25: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/backends/abstract.rb:29:in `run'
24: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/backends/abstract.rb:29:in `instance_exec'
23: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/capistrano-rvm-0.1.2/lib/capistrano/tasks/rvm.rake:9:in `block (3 levels) in <top (required)>'
22: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/backends/abstract.rb:64:in `capture'
21: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/backends/abstract.rb:145:in `create_command_and_execute'
20: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/backends/abstract.rb:145:in `tap'
19: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/backends/abstract.rb:145:in `block in create_command_and_execute'
18: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/backends/netssh.rb:129:in `execute_command'
17: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/backends/netssh.rb:176:in `with_ssh'
16: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/backends/connection_pool.rb:59:in `with'
15: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/sshkit-1.17.0/lib/sshkit/backends/connection_pool.rb:59:in `call'
14: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh.rb:246:in `start'
13: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/authentication/session.rb:71:in `authenticate'
12: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/authentication/session.rb:71:in `each'
11: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/authentication/session.rb:85:in `block in authenticate'
10: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/authentication/methods/publickey.rb:19:in `authenticate'
9: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/authentication/key_manager.rb:119:in `each_identity'
8: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/authentication/key_manager.rb:119:in `each'
7: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/authentication/key_manager.rb:122:in `block in each_identity'
6: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/authentication/methods/publickey.rb:20:in `block in authenticate'
5: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/authentication/methods/publickey.rb:62:in `authenticate_with'
4: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/authentication/key_manager.rb:142:in `sign'
3: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/key_factory.rb:44:in `load_private_key'
2: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/key_factory.rb:53:in `load_data_private_key'
1: from /Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/key_factory.rb:113:in `classify_key'
/Users/synup/.rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/authentication/ed25519_loader.rb:21:in `raiseUnlessLoaded': OpenSSH keys only supported if ED25519 is available (NotImplementedError)
net-ssh requires the following gems for ed25519 support:
* ed25519 (>= 1.2, < 2.0)
* bcrypt_pbkdf (>= 1.0, < 2.0)
cap aborted!
NotImplementedError: OpenSSH keys only supported if ED25519 is available
net-ssh requires the following gems for ed25519 support:
* ed25519 (>= 1.2, < 2.0)
* bcrypt_pbkdf (>= 1.0, < 2.0)
See https://github.com/net-ssh/net-ssh/issues/565 for more information
Gem::LoadError : "ed25519 is not part of the bundle. Add it to your Gemfile."
Upvotes: 26
Views: 18482
Reputation: 83
I'm using Macbook M2 and while I tried every alternative suggested in the other answers, I couldn't fix it. The error persisted and changed to a slightly different one: now the problem was incompatible architecture for bcrypt_pbkdf
:
The deploy has failed with an error: OpenSSH keys only supported if ED25519 is available
net-ssh requires the following gems for ed25519 support:
* ed25519 (>= 1.2, < 2.0)
* bcrypt_pbkdf (>= 1.0, < 2.0)
See https://github.com/net-ssh/net-ssh/issues/565 for more information
LoadError : "dlopen(/Users/*/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bcrypt_pbkdf-1.1.0/lib/bcrypt_pbkdf_ext.bundle, 0x0009): tried: '/Users/*/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bcrypt_pbkdf-1.1.0/lib/bcrypt_pbkdf_ext.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/*/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bcrypt_pbkdf-1.1.0/lib/bcrypt_pbkdf_ext.bundle' (no such file), '/Users/*/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bcrypt_pbkdf-1.1.0/lib/bcrypt_pbkdf_ext.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')) - /Users/brunocruz/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bcrypt_pbkdf-1.1.0/lib/bcrypt_pbkdf_ext.bundle"
I solved it by converting the new OpenSSH private key to the old PEM format:
ssh-keygen -p -m PEM -f ~/.ssh/id_rsa
Now Capistrano can SSH into my server.
Upvotes: 1
Reputation: 21
gem install ed25519 bcrypt_pbkdf
For new keys generated with the ed25519 algorithm, this fixes it
Upvotes: 2
Reputation: 842
In a multi user developement server, without root permission, this solved:
eval `ssh-agent -s`
ssh-add
Upvotes: 1
Reputation: 1710
This solved the same issue with me
ssh-agent -s && ssh-add ~/.ssh/id_rsa
Upvotes: 4
Reputation: 2321
Although you can get around this error by adding the gems suggested by the other answers, you don't necessarily need to do it this way.
An alternative is to follow the advice given in the Known Issues for Puppet's Bolt tool, in particular this one.
Just in case that link disappears, the solution is to generate your SSH keys in the PEM format rather than OpenSSH. You can do this by adding an extra option to your ssh-keygen
command:
ssh-keygen -t rsa -m PEM
I've been able to successfully use this technique to avoid adding the extra gems.
Upvotes: 7
Reputation: 399
My working solution:
Gemfile
gem 'net-ssh', '>= 6.0.2'
gem 'ed25519', '>= 1.2', '< 2.0'
gem 'bcrypt_pbkdf', '>= 1.0', '< 2.0'
Upvotes: 7
Reputation: 3258
On Mac OS at least, you'll get this error if you don't ssh-add [yourkey] after system startup.
Upvotes: 13
Reputation: 899
Add those gems to your Gemfile,
gem 'rbnacl', '< 5.0', :require => false
gem 'rbnacl-libsodium', :require => false
gem 'bcrypt_pbkdf', '< 2.0', :require => false
and then run bundle install
and try again.
Upvotes: 2