typescentoskeycapistrano

Capistrano unsupported key type


When I do 'cap production deploy' with capistrano on CentOS, I get following errors.

What I'm sure is that my pirvate key for both git and server are both perfect original files, and public key is normally on the server.

And I have ssh_options[:keys] = [File.join(ENV["HOME"], ".ssh", "example-rsa")] in my production.rb, and I put the file as /root/.ssh/example-rsa correctly. I ssh-add ed my private key for git and server.

Strange thing is that even though both files require pass-phrase, my terminal asked me for the password for the git, but not the one for the server.

I synced my version of ruby with the server, opeenssh, and so on.

  triggering start callbacks for `deploy'
  * 2014-02-27 10:09:45 executing `multistage:ensure'
  * 2014-02-27 10:09:45 executing `deploy'
  * 2014-02-27 10:09:45 executing `deploy:update'
 ** transaction: start
  * 2014-02-27 10:09:45 executing `deploy:update_code'
    updating the cached checkout on all servers
    executing locally: "git ls-remote git@github.com:example/AskOnStack.git HEAD"
*** [deploy:update_code] rolling back
  * executing "rm -rf /home/deployer/apps/AskOnStack/releases/20140227010945; true"
    servers: ["**.**.***.**"]
 ** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: **.**.***.**:**** 

(NotImplementedError: unsupported key type `��"�ep���ˎ��-�wƿ3�����-���S�(�')
// this part is the start of errors. what are those strange texts?

/home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy.rb:138:in ``': No such file or directory - git ls-remote git@github.com:mocoga/KakaoGameFriend.git HEAD (Errno::ENOENT)
 from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano- 2.15.5/lib/capistrano/recipes/deploy.rb:138:in `block in run_locally'
 from /home/stackoverflow/.rvm/rubies/ruby-1.9.3-p392-railsexpress/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
    from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy.rb:137:in `run_locally'
    from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy.rb:43:in `block (3 levels) in load'
    from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy.rb:124:in `with_env'
    from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy.rb:43:in `block (2 levels) in load'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy/scm/git.rb:229:in `query_revision'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy/scm/base.rb:35:in `block in method_missing'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy/scm/base.rb:63:in `local'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy/scm/base.rb:35:in `method_missing'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy.rb:43:in `block in load'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/variables.rb:87:in `call'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/variables.rb:87:in `block in fetch'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/variables.rb:110:in `block in protect'
from <internal:prelude>:10:in `synchronize'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/variables.rb:110:in `protect'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/variables.rb:78:in `fetch'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/variables.rb:95:in `[]'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy/strategy/base.rb:86:in `revision'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy/strategy/remote_cache.rb:35:in `update_repository_cache'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy/strategy/remote_cache.rb:15:in `deploy!'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy.rb:253:in `block (2 levels) in load'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:138:in `instance_eval'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:89:in `execute_task'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/namespaces.rb:110:in `block in define_task'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy.rb:234:in `block (3 levels) in load'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:56:in `transaction'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy.rb:233:in `block (2 levels) in load'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:138:in `instance_eval'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:89:in `execute_task'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/namespaces.rb:110:in `block in define_task'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/recipes/deploy.rb:201:in `block (2 levels) in load'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:138:in `instance_eval'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:89:in `execute_task'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:46:in `block in execute_requested_actions'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:45:in `each'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:45:in `execute_requested_actions'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/cli/help.rb:19:in `execute_requested_actions_with_help'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:34:in `execute!'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:14:in `execute'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/gems/capistrano-2.15.5/bin/cap:4:in `<top (required)>'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/bin/cap:23:in `load'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/bin/cap:23:in `<main>'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/bin/ruby_executable_hooks:15:in `eval'
from /home/stackoverflow/.rvm/gems/ruby-1.9.3-p392-railsexpress/bin/ruby_executable_hooks:15:in `<main>'

Solution

  • My problem was I had a lot of different keys in my local ~/.ssh/known_hosts file because every time my VPS reboots in rescue mode it would change.

    So I removed all of them and connected to ssh normally (not through capistrano) and after that I tried with capistrano and it worked.

    Additional details : This happens when ssh has trouble reading the key file, you can run ssh -v user@host to see what's going on

    (see the comments in the first answer here : https://serverfault.com/questions/613756/how-to-stop-ssh-passphrase-prompt)