net-ssh: "Could not parse PKey: no start line" error message needs improvement

https://github.com/capistrano/capistrano/issues/286 http://tickets.opscode.com/browse/CHEF-4180

When net-ssh can’t find part of the private/public keypair in net-ssh 2.6 it errors with:

ArgumentError: Could not parse PKey: no start line

This error doesn’t convey the issue well and usually requires a bunch of poking around to resolve it.

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Comments: 24

Most upvoted comments

I was able to get this working by using @birdie-github solution and then running

ssh-keygen -p -m PEM

My solution was to ssh-add -A

I get this error and google ranks this page quite high. But after reading the thread several times i could not make sense. I summarize my understanding and solution for the next guy:

For me the problem stemmed from having a password protected, hence encrypted, private key (with the Proc-Type: 4,ENCRYPTED mentioned above)

The solution was to run ssh-keygen -p . This prompts for the old password and when leaving the new blank, generated a version that was then readable by net-ssh.

btw: thanks to the creators/maintainers

This issue appears to be recurring for me, in any version of net-ssh above 2.5.2. Using a key that is not password locked avoids the issue.