chef / knife-windows

Plugin for Chef's knife tool for working with Windows nodes
Apache License 2.0
152 stars 110 forks source link

Bootstrapping Windows 2012 ends with \Microsoft was unexpected at this time #412

Closed kriston closed 5 years ago

kriston commented 7 years ago

Bootstrapping Windows 2012 ends with \Microsoft was unexpected at this time. This happens with 1.7.1 and 1.7.0.

This is the output when it attempts this step in the bootstrap:

DEBUG: [WinRM] opening remote shell on http://10.0.0.1:5985/wsman
DEBUG: [WinRM] remote shell created with shell_id: B0FD312C-9CC0-44E6-B091-C7B4C28139B6
DEBUG: [WinRM] Command created for cmd.exe /C echo Rendering "%TEMP%\bootstrap-4478-1479504696.bat" chunk 7 && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.mkdir C:\chef\trusted_certs) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.^> C:\chef/trusted_certs/mycert.crt ^() && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.-----BEGIN CERTIFICATE-----) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.MIIDqDCCApACCQC03kaY6uOUvzANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMC) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.VVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZWF0dGxlMRAwDgYDVQQKEwdZb3VD) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.b3JwMRMwEQYDVQQLEwpPcGVyYXRpb25zMSAwHgYDVQQDExdidWlsZGNoZWYtMDEu) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.bGFiLnZiLmxvYzEeMBwGCSqGSIb3DQEJARYPeW91QGV4YW1wbGUuY29tMB4XDTE0) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.MDMxMjA3MzUzN1oXDTI0MDMwOTA3MzUzN1owgZUxCzAJBgNVBAYTAlVTMQswCQYD) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.VQQIEwJXQTEQMA4GA1UEBxMHU2VhdHRsZTEQMA4GA1UEChMHWW91Q29ycDETMBEG) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.A1UECxMKT3BlcmF0aW9uczEgMB4GA1UEAxMXYnVpbGRjaGVmLTAxLmxhYi52Yi5s) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.b2MxHjAcBgkqhkiG9w0BCQEWD3lvdUBleGFtcGxlLmNvbTCCASIwDQYJKoZIhvcN) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.AQEBBQADggEPADCCAQoCggEBAKm0+Zl5Eh3DjIUQGljDaMoPwGt2CqyFtW2XzvcF) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.9ha/ZIA5dNPbq6dWtB4yXB0+HSNnmCqPuY7QIX4stT1N2Tv+GEURZv8JHNSs+sOn) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.Px9kZtgGnXbphpS9JoCPpHboXvdkLYJp3i1P7QZSc7PPPb8/chUh2/M26VpvEiO5) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.b1iXt6Wm9rk6TzNJVhe7Z0mbU1w5wKVUqfo/Ae/fn0fhE7txTKHNiBjzlUakhO8l) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.L+5Bcb5JhEVGUFXNnSoM3aRLrnGxgxlSlwi6XXLCNGrUY12wvrl3nVayhPZirVis) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.bAp3jEPFQLOG1Fd5QQgzNIwRKiwFdQw90zMVxOmTTXHU09ECAwEAATANBgkqhkiG) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.9w0BAQUFAAOCAQEAIhNGeUB+XocFUbpWP1uF5rgsyEtbYQ3XjzTTNtllkdkJo5bm) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.+DtBZ1ZdYxi8gkJi5UIp3NVpbNScqs8L4phwWYU0Q/fRQ9Q6XLOLTxDS6lR3WLCE) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.CQ89F+O+q+eOSOWYNR+HcHSfQeyG4SkDs2HKmyqPltqks4OHpD1n21PeFcuPzEdl) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.ojr7JiNWR6LxstrSnaVff1zs++PNFgRtOhzy83VhF7jSTQMQqPf3ORxwCEYDKmTx) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.KUTdSLL8QD/8JiRKdxfc78ymqsFHU7htCZJvtBnh4wRr4O5p95qyY7p88eAC8Hfz) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.hbth53UDlQHJVBPgM5n3NKpnLKFRcQLJdUEG3A==) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.-----END CERTIFICATE-----) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.^)) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.^> C:\chef\client.rb ^() && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.log_level        :info) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.log_location     STDOUT) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.chef_server_url  "https://chef.example.com:443") && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.validation_client_name "chef-validator") && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.file_cache_path   "c:/chef/cache") && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.file_backup_path  "c:/chef/backup") && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.cache_options     ^^^({:path =^^^> "c:/chef/cache/checksums", :skip_expires =^^^> true}^^^)) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.node_name "target-windows-machine@example.com") && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.trusted_certs_dir "c:/chef/trusted_certs") && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.^)) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.^> C:\chef\first-boot.json ^() && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.echo.{"run_list":["role[my_role]"]}) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.^)) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.) && >> "
%TEMP%\bootstrap-4478-1479504696.bat" (echo.@echo Starting chef to bootstrap the node...) && >> "%TEMP%\bootstrap-4478-1479504696.bat" (echo.SET "PATH=%PATH%;C:\ruby\bin;C:\opscode\chef\bin;C:\opscode\chef\embedded\bin") with id: 41D82AC5-BB1F-42CA-8834-239CCCFDE36C
DEBUG: [WinRM] creating command_id: 41D82AC5-BB1F-42CA-8834-239CCCFDE36C on shell_id B0FD312C-9CC0-44E6-B091-C7B4C28139B6
DEBUG: [WinRM] Waiting for output...
DEBUG: [WinRM] Processing output
10.150.2.101 \Microsoft was unexpected at this time.
DEBUG: [WinRM] cleaning up command_id: 41D82AC5-BB1F-42CA-8834-239CCCFDE36C on shell_id B0FD312C-9CC0-44E6-B091-C7B4C28139B6
btm commented 7 years ago

Is Windows installed in a regular path, i.e. C:\Windows?

btm commented 7 years ago

"\Microsoft" sounds like a path with spaces is being used somewhere, like C:\Program Files (x86)\Microsoft Windows\ or such, but I can't imagine why that would be happening as part of the installation.

Where is %TEMP% on your system?

mwrock commented 7 years ago

Would also be helpful to see your bootstrap command and also to know what version of windows you are trying to bootstrap.

kriston commented 7 years ago

%TEMP% is at C:\User\Administrator\AppData\Local\Temp It's Windows Server 2012 (non-R2). knife bootstrap -VV windows winrm -N ${HOST} ${IP} --winrm-user="localhost\administrator" --run-list role[${ROLE}]

This machine has Visual Studio Enterprise 2015, nodejs, and a pretty huge PATH. I don't really get why knife winrm would choke on a PATH statement with spaces in it or why it feels the need to use that variable, anyway.

btm commented 7 years ago

Can you run that command with -V -V and share the debug output?

dheerajd-msys commented 5 years ago

I have tried today to reproduce this issue on Windows 2012 with knife-windows v2.0.1 but unable to reproduce.

@kriston Any updates from your side regarding above comments? Else can we close this issue?

tas50 commented 5 years ago

Hey there. In Chef Infra Client 15 we completely rewrote the bootstrap functionality of Chef to use train engine. That rewrite fixed a large number of long standing issues and moves us to a much more robust connection method for bootstrapping. There is high likelihood that this issue has been resolved with that rewrite. I'm going to close this out at this point, but if you encounter the problem with Chef Infra Client 15 please open it up again.

kriston commented 5 years ago

I'm satisfied with the outcome especially with the news that it had been rewritten, though I will not be able to confirm this issue is resolved.