New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net-ssh 2.6.0 issues #286

Closed
skorfmann opened this Issue Oct 5, 2012 · 17 comments

Comments

Projects
None yet
@skorfmann

skorfmann commented Oct 5, 2012

I had this error after upgrading net-ssh from 2.5.2 to 2.6.0

connection failed for: [server] (ArgumentError: Could not parse PKey: no start line)

This seems to be related to net-ssh, but as I came across this issue in capistrano I'm filing the issue here now. Not sure what the problem is, no idea how to fix it :)

My workaround is just requiring net-ssh 2.5.2 explicitly for now.

@kajiaki

This comment has been minimized.

Show comment
Hide comment
@kajiaki

kajiaki Oct 5, 2012

Me too...

kajiaki commented Oct 5, 2012

Me too...

@JuliaLovel

This comment has been minimized.

Show comment
Hide comment
@JuliaLovel

JuliaLovel Oct 16, 2012

I had this error in capistrano, but I don't think it was related to net-ssh in my case. My problem was that I needed to enclose my ssh key file location in quotes in my config/deploy.rb file, like this:

ssh_options[:keys] = %w('~/.ssh/id_rsa.pub')

instead of:

ssh_options[:keys] = %w(~/.ssh/id_rsa.pub)

JuliaLovel commented Oct 16, 2012

I had this error in capistrano, but I don't think it was related to net-ssh in my case. My problem was that I needed to enclose my ssh key file location in quotes in my config/deploy.rb file, like this:

ssh_options[:keys] = %w('~/.ssh/id_rsa.pub')

instead of:

ssh_options[:keys] = %w(~/.ssh/id_rsa.pub)
@do-zen

This comment has been minimized.

Show comment
Hide comment
@do-zen

do-zen Oct 23, 2012

JuliaLovel, working well

do-zen commented Oct 23, 2012

JuliaLovel, working well

@carsomyr

This comment has been minimized.

Show comment
Hide comment
@carsomyr

carsomyr Oct 23, 2012

Contributor

All, I'm closing this for now. Please reopen if not fixed.

Contributor

carsomyr commented Oct 23, 2012

All, I'm closing this for now. Please reopen if not fixed.

@carsomyr carsomyr closed this Oct 23, 2012

@linjunpop

This comment has been minimized.

Show comment
Hide comment
@linjunpop

linjunpop Oct 24, 2012

I got this error even when I dont set ssh_options[:keys] in my deploy.rb.

With net-ssh 2.6.1

linjunpop commented Oct 24, 2012

I got this error even when I dont set ssh_options[:keys] in my deploy.rb.

With net-ssh 2.6.1

@moskanz

This comment has been minimized.

Show comment
Hide comment
@moskanz

moskanz Oct 24, 2012

same problem, ssh_options[:keys] not set

moskanz commented Oct 24, 2012

same problem, ssh_options[:keys] not set

@komagata

This comment has been minimized.

Show comment
Hide comment
@komagata

komagata Nov 13, 2012

same problem too.

komagata commented Nov 13, 2012

same problem too.

@bakorer

This comment has been minimized.

Show comment
Hide comment
@bakorer

bakorer Nov 16, 2012

same problem too.
With net-ssh 2.6.1

bakorer commented Nov 16, 2012

same problem too.
With net-ssh 2.6.1

@carsomyr carsomyr reopened this Nov 16, 2012

@carsomyr

This comment has been minimized.

Show comment
Hide comment
@carsomyr

carsomyr Nov 16, 2012

Contributor

What version of Ruby are y'all using? What version of OpenSSL? MacPorts or Homebrew?

Contributor

carsomyr commented Nov 16, 2012

What version of Ruby are y'all using? What version of OpenSSL? MacPorts or Homebrew?

@NoriyukiTanabe

This comment has been minimized.

Show comment
Hide comment
@NoriyukiTanabe

NoriyukiTanabe Nov 16, 2012

This problem may be caused by ssh private key with passphrase and no ssh public key.

Try remove ssh_options[:keys] and invoke follow command:

ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub

FYI

ArgumentError: Could not parse PKey: no start line
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh/key_factory.rb:77:in `read'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh/key_factory.rb:77:in `load_data_private_key'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh/key_factory.rb:42:in `load_private_key'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh/authentication/key_manager.rb:215:in `block in load_identities'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh/authentication/key_manager.rb:207:in `map'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh/authentication/key_manager.rb:207:in `load_identities'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh/authentication/key_manager.rb:100:in `each_identity'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh/authentication/methods/publickey.rb:19:in `authenticate'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh/authentication/session.rb:78:in `block in authenticate'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh/authentication/session.rb:65:in `each'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh/authentication/session.rb:65:in `authenticate'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh.rb:190:in `start'
    from (irb):3
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `'

NoriyukiTanabe commented Nov 16, 2012

This problem may be caused by ssh private key with passphrase and no ssh public key.

Try remove ssh_options[:keys] and invoke follow command:

ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub

FYI

ArgumentError: Could not parse PKey: no start line
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh/key_factory.rb:77:in `read'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh/key_factory.rb:77:in `load_data_private_key'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh/key_factory.rb:42:in `load_private_key'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh/authentication/key_manager.rb:215:in `block in load_identities'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh/authentication/key_manager.rb:207:in `map'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh/authentication/key_manager.rb:207:in `load_identities'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh/authentication/key_manager.rb:100:in `each_identity'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh/authentication/methods/publickey.rb:19:in `authenticate'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh/authentication/session.rb:78:in `block in authenticate'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh/authentication/session.rb:65:in `each'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh/authentication/session.rb:65:in `authenticate'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.6.1/lib/net/ssh.rb:190:in `start'
    from (irb):3
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `'
@bakorer

This comment has been minimized.

Show comment
Hide comment
@bakorer

bakorer Nov 16, 2012

carsomyr, I'm sorry it was my misunderstanding.

Thx, NoriyukiTanabe! I solved my problems. ;-)

bakorer commented Nov 16, 2012

carsomyr, I'm sorry it was my misunderstanding.

Thx, NoriyukiTanabe! I solved my problems. ;-)

@carsomyr

This comment has been minimized.

Show comment
Hide comment
@carsomyr

carsomyr Nov 16, 2012

Contributor

Aha, an unhelpful error message masking a common mistake!

Contributor

carsomyr commented Nov 16, 2012

Aha, an unhelpful error message masking a common mistake!

@carsomyr carsomyr closed this Nov 16, 2012

@paneq

This comment has been minimized.

Show comment
Hide comment
@paneq

paneq Jan 2, 2013

How is this problem solved in your opinion ?

paneq commented Jan 2, 2013

How is this problem solved in your opinion ?

@tristanfisher

This comment has been minimized.

Show comment
Hide comment
@tristanfisher

tristanfisher Jan 10, 2013

+1 to @paneq

/gems/net-ssh-2.6.2/lib/net/ssh/key_factory.rb:77:in `read': Could not parse PKey: no start line (ArgumentError)

can be verified by calling:
Net::SSH::KeyFactory.load_public_key('/path/to/public')
Net::SSH::KeyFactory.load_private_key('/path/to/private')

I can see how it's an issue with the underlying 'net/ssh', but the response could be far more helpful.

tristanfisher commented Jan 10, 2013

+1 to @paneq

/gems/net-ssh-2.6.2/lib/net/ssh/key_factory.rb:77:in `read': Could not parse PKey: no start line (ArgumentError)

can be verified by calling:
Net::SSH::KeyFactory.load_public_key('/path/to/public')
Net::SSH::KeyFactory.load_private_key('/path/to/private')

I can see how it's an issue with the underlying 'net/ssh', but the response could be far more helpful.

@schof

This comment has been minimized.

Show comment
Hide comment
@schof

schof Apr 14, 2013

FYI the solution suggested by @NoriyukiTanabe worked for me as well. For some reason I was missing the public key in my .ssh directory (and private key was passphrase protected).

schof commented Apr 14, 2013

FYI the solution suggested by @NoriyukiTanabe worked for me as well. For some reason I was missing the public key in my .ssh directory (and private key was passphrase protected).

@x3mka

This comment has been minimized.

Show comment
Hide comment
@x3mka

x3mka May 15, 2013

I had the same issue on Windows.
I launched ProcessMonitor and found ruby process trying to load file ~.ssh\key.pub.pub which gave me an idea that path to the private (not public) key should be in ssh_config['keys'].

So
ssh_options[:keys] = %w(~/.ssh/id_rsa)
should work

x3mka commented May 15, 2013

I had the same issue on Windows.
I launched ProcessMonitor and found ruby process trying to load file ~.ssh\key.pub.pub which gave me an idea that path to the private (not public) key should be in ssh_config['keys'].

So
ssh_options[:keys] = %w(~/.ssh/id_rsa)
should work

@vsakaria

This comment has been minimized.

Show comment
Hide comment
@vsakaria

vsakaria Mar 12, 2014

Yes JuliaLovel toward the top of this post worked!

ssh_options[:keys] = %w('~/.ssh/id_rsa.pub')

NOT

ssh_options[:keys] = %w(~/.ssh/id_rsa.pub)

vsakaria commented Mar 12, 2014

Yes JuliaLovel toward the top of this post worked!

ssh_options[:keys] = %w('~/.ssh/id_rsa.pub')

NOT

ssh_options[:keys] = %w(~/.ssh/id_rsa.pub)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment