Sunday, December 31, 2017

chef "kitchen login" failed with "ssh (Errno::ENOENT)"

My environment:

  • Windows 10 with powershell
  • chefdk-2.4.17-1
  • vagrant_2.0.1
  • VirtualBox-5.2.4
  • "kitchen create" succeeded with a simple apache recipe, and "kitchen list" showed the instance was created

My Problem:

When run "kitchen login", I got error "No such file or directory - ssh (Errno::ENOENT)". The full error message is as following. It's version related, but similar error should have same root cause.

 PS > kitchen login
C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.19.2/lib/kitchen/instance.rb:217:in `exec': No such file or directory - ssh (Errno::ENOENT)
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.19.2/lib/kitchen/instance.rb:217:in `login'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.19.2/lib/kitchen/command/login.rb:36:in `call'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.19.2/lib/kitchen/cli.rb:52:in `perform'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.19.2/lib/kitchen/cli.rb:252:in `login'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.19.2/bin/kitchen:13:in `block in '
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.19.2/lib/kitchen/errors.rb:171:in `with_friendly_errors'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.19.2/bin/kitchen:13:in `'
        from C:/opscode/chefdk/bin/kitchen:267:in `load'
        from C:/opscode/chefdk/bin/kitchen:267:in `
'

Root Cause:

"kitchen login" is complaining that when it tried to run 'ssh' command, it didn't find it and failed. You can directly type 'ssh' in powershell, and you will be told that it's not recognized.

My Solution:

You can install any ssh client, as long as when you type 'ssh' in powershell, it prompts you a usage, then this problem of 'kitchen login' will be gone. In my case, I followed https://codehollow.com/2017/06/ssh-for-windows-powershell/ , installed "Open SSH for Powershell". I have to install chocolatey first followed the instruction.

Set-ExecutionPolicy Unrestricted
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
choco install openssh                # installs open ssh
refreshenv                           # reloads the environment variables 

No comments:

Post a Comment