chef: knife bootstrap winrm script fails
Description
bootstrap fails with “The system cannot find the batch label specified - key_create”
Chef Version
Workstation 20.5.6 Infra Client 16.0.287
Platform Version
Ubuntu 18.04 workstation Windows 10.0 18363 bootstrap target
Replication Case
knife bootstrap -o winrm -U username -P password ip.ip.ip.ip -N win10_azure -V
Client Output
[ip.ip.ip.ip] )
[ip.ip.ip.ip] Detected Windows Version 10.0 Build 18363
[ip.ip.ip.ip]
[ip.ip.ip.ip] C:\Users\btm\Documents>goto Version10.0
[ip.ip.ip.ip]
[ip.ip.ip.ip] C:\Users\btm\Documents>goto architecture_select
[ip.ip.ip.ip]
[ip.ip.ip.ip] C:\Users\btm\Documents>IF "AMD64" == "x86" IF not defined PROCESSOR_ARCHITEW6432
[ip.ip.ip.ip]
[ip.ip.ip.ip] C:\Users\btm\Documents>goto chef_installed
[ip.ip.ip.ip] Checking for existing Chef Infra Client installation
[ip.ip.ip.ip]
[ip.ip.ip.ip] C:\Users\btm\Documents>WHERE chef-client 1>nul 2>nul
[ip.ip.ip.ip]
[ip.ip.ip.ip] C:\Users\btm\Documents>If !ERRORLEVEL! == 0 (
[ip.ip.ip.ip]
[ip.ip.ip.ip] goto key_create
[ip.ip.ip.ip] ) else (
[ip.ip.ip.ip]
[ip.ip.ip.ip] goto install
[ip.ip.ip.ip] )
[ip.ip.ip.ip] Existing Chef Infra Client installation detected, skipping download
ERROR: The following error occurred on ip.ip.ip.ip:
ERROR: cmd.exe : The system cannot find the batch label specified - key_create
+ CategoryInfo : NotSpecified: (The system cann...ed - key_create:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 29 (11 by maintainers)
Commits related to this issue
- Add REM lines to windows bootstrap script to fix label For reasons only inferred on the internet, a batch label cannot exist near a "block boundary." What exactly that is I cannot discover. But this ... — committed to chef/chef by btm 4 years ago
- Add REM lines to windows bootstrap script to fix label For reasons only inferred on the internet, a batch label cannot exist near a "block boundary." What exactly that is I cannot discover. But this ... — committed to chef/chef by btm 4 years ago
We ran into something similar to this on knife version 16.0.287.
We discovered, what we think, is a mistake in this section. https://github.com/chef/chef/blob/d657a69f13d97f2ae89f39b6632f576b13822c7d/chef-config/lib/chef-config/config.rb#L95
This is used in the bootstrap.bat-file for windows and results in:
This is because “mkdir” does not accept paths with forward slash. so “mkdir c:/chef” will cause the syntax error.
We worked around it and hardcoded the correct path in our ‘–bootstrap-template’, ‘/data/app/chef/bootstrap/windows-chef-client-msi.erb’ hoping it would make things work again.
BUT
We hit yet another error.
Now chef is installing, but failed when trying to run the chef-client:
The paths added to %PATH% have similar wrong syntax (mix of forward slash and backward slash), that might make the command prompt not able to recognized the command ‘chef-client’ or the SET “PATH=”-command is run and the chef-client command is run in the same shell, so the paths are not updated before a new shell is launched.
Hope this is helpful resolving the issues.
/Martin