3

Running the command knife bootstrap windows winrm ec2box.amazonaws.com -r 'role[web]' -x Administrator -P 'mypassword' from my Mac OS X workstation produces the output below. Running it from a Windows workstation, the command successfully runs. Is there an extra step I need to take to get my Mac OS X workstation to communicate via WinRM correctly?

I'm using this on Amazon's Windows Server 2012 AMI. It printed #39 everywhere on my terminal, not an artifact of Stack Overflow.

WARNING: Could not load IOV methods. Check your GSSAPI C library for an update
WARNING: Could not load AEAD methods. Check your GSSAPI C library for an update
Bootstrapping Chef on ec2box.amazonaws.com
ec2box.amazonaws.com "Rendering 'C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7738-1370535154.bat' chunk 1"
ec2box.amazonaws.com "Rendering 'C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7738-1370535154.bat' chunk 2"
ec2box.amazonaws.com '#39' is not recognized as an internal or external command,
ec2box.amazonaws.com operable program or batch file.
ec2box.amazonaws.com "Rendering 'C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7738-1370535154.bat' chunk 3"
ec2box.amazonaws.com "Rendering 'C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7738-1370535154.bat' chunk 4"
ec2box.amazonaws.com '#39' is not recognized as an internal or external command,
ec2box.amazonaws.com operable program or batch file.
ec2box.amazonaws.com '#39' is not recognized as an internal or external command,
ec2box.amazonaws.com operable program or batch file.
ec2box.amazonaws.com "Rendering 'C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7738-1370535154.bat' chunk 5"
ec2box.amazonaws.com "Rendering 'C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7738-1370535154.bat' chunk 6"
ec2box.amazonaws.com "Rendering 'C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7738-1370535154.bat' chunk 7"
ec2box.amazonaws.com "Rendering 'C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7738-1370535154.bat' chunk 8"
ec2box.amazonaws.com "Rendering 'C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7738-1370535154.bat' chunk 9"
ec2box.amazonaws.com
ec2box.amazonaws.com else was unexpected at this time.
ec2box.amazonaws.com C:\Users\Administrator>mkdir C:\chef
ec2box.amazonaws.com
ec2box.amazonaws.com C:\Users\Administrator>(
ec2box.amazonaws.com echo.url = WScript.Arguments.Named("url")
ec2box.amazonaws.com  echo.path = WScript.Arguments.Named("path")
ec2box.amazonaws.com  echo.proxy = null
ec2box.amazonaws.com  echo.Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP")
ec2box.amazonaws.com  echo.Set wshShell = CreateObject( "WScript.Shell" )
ec2box.amazonaws.com  echo.Set objUserVariables = wshShell.Environment("USER")
ec2box.amazonaws.com  echo.
ec2box.amazonaws.com  echo.
ec2box.amazonaws.com  echo.On Error Goto 0
ec2box.amazonaws.com  echo.
ec2box.amazonaws.com  echo.objXMLHTTP.open "GET", url, false
ec2box.amazonaws.com  echo.objXMLHTTP.send()
ec2box.amazonaws.com  echo.If objXMLHTTP.Status = 200 Then
ec2box.amazonaws.com  echo.Set objADOStream = CreateObject("ADODB.Stream")
ec2box.amazonaws.com  echo.objADOStream.Open
ec2box.amazonaws.com  echo.objADOStream.Type = 1
ec2box.amazonaws.com  echo.objADOStream.Write objXMLHTTP.ResponseBody
ec2box.amazonaws.com  echo.objADOStream.Position = 0
ec2box.amazonaws.com  echo.Set objFSO = Createobject("Scripting.FileSystemObject")
ec2box.amazonaws.com  echo.If objFSO.Fileexists(path) Then objFSO.DeleteFile path
ec2box.amazonaws.com  echo.Set objFSO = Nothing
ec2box.amazonaws.com  echo.objADOStream.SaveToFile path
ec2box.amazonaws.com  echo.objADOStream.Close
ec2box.amazonaws.com  echo.Set objADOStream = Nothing
ec2box.amazonaws.com  echo.End if
ec2box.amazonaws.com  echo.Set objXMLHTTP = Nothing
ec2box.amazonaws.com ) 1>C:\chef\wget.vbs
ec2box.amazonaws.com
ec2box.amazonaws.com C:\Users\Administrator>(
ec2box.amazonaws.com echo.param(
ec2box.amazonaws.com  echo.   [String] $remoteUrl,
ec2box.amazonaws.com  echo.   [String] $localPath
ec2box.amazonaws.com  echo.)
ec2box.amazonaws.com  echo.
ec2box.amazonaws.com  echo.$webClient = new-object System.Net.WebClient;
ec2box.amazonaws.com  echo.
ec2box.amazonaws.com  echo.$webClient.DownloadFile($remoteUrl, $localPath);
ec2box.amazonaws.com ) 1>C:\chef\wget.ps1
ec2box.amazonaws.com C:\Users\Administrator>) else (
Omar
  • 39,496
  • 45
  • 145
  • 213
  • What's the output of `gem list |grep knife`? What version of Windows? Are you using Amazon's AMIs, or your own? Also, did it show ''' all over the place in your terminal, or is that an artifact of Stack Overflow? – Henry Finucane Sep 27 '13 at 03:26
  • 1
    @henry - Updated my question. I'm using this on Amazon's Windows Server 2012 AMI. It printed #39 everywhere on my terminal, not an artifact of Stack Overflow. – Omar Sep 27 '13 at 13:18

4 Answers4

2

I faced a similar issue. What i did was:

Uninstall gem and then did aptitude update, and then installed gem & knife windows pluggin in this loaction(/opt/chef/embedded/bin/gem install knife-windows), and opened the 5985 port and configured the winrm:

  1.winrm quickconfig -q   
  2.winrm set winrm/config/winrs @{MaxMemoryPerShellMB="300"}  
  3.winrm set winrm/config @{MaxTimeoutms="1800000"}  
  4.winrm set winrm/config/service @{AllowUnencrypted="true"}   
  5.winrm set winrm/config/service/auth @{Basic="true"}

and then bootstrapped:

knife bootstrap windows winrm ec2-xx-xxx-xx.compute-1.amazonaws.com -r 'recipe[cookbook]' -x Administrator -P xxxxxxxx -N "WIN-xxxxx"
slavoo
  • 5,798
  • 64
  • 37
  • 39
1

It seems to work with knife-windows 0.5.10 [tested with windows server 2008R2]

Install it with:

gem uninstall knife-windows
gem install knife-windows -v 0.5.10   

check your gems with:

gem list|grep knife-windows

And it should show:

knife-windows (0.5.10)  
Ludwig Van Beethoven
  • 1,866
  • 2
  • 13
  • 12
1

I had exactly the same issue with #39 characters on my OSX, see my description of it: Stuck trying to bootstrap Windows server using Chef

In my case, rvm was the responsible culprit.

I managed to resolve this issue by following steps: 1) downloading and running the omnibus installer

curl -L https://www.opscode.com/chef/install.sh | sudo bash

2) Disabling rvm by using system ruby:

rvm use system 

3)installing knife-windows directly in chefs library:

sudo /opt/chef/embedded/bin/gem install knife-windows

This, together with configuring the Windows 2008 server as recommended on https://github.com/opscode/knife-windows (commands available in this gist: https://gist.github.com/jimcroft/3878113) did the trick, and I could bootstrap my node :) Agata

Community
  • 1
  • 1
themathmagician
  • 467
  • 5
  • 16
1

Looks like the problem may be related to poor interoperability between Ruby 2.x and the winrm gem:

https://github.com/WinRb/WinRM/pull/73

Julian Dunn
  • 286
  • 1
  • 4