Skip to content
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

Error uploading script: Error uploading file to $env:TEMP\winrmcp-4688e2bf-c603-4d8a-6b02-15439b814a2b.tmp: Couldn't create shell: http response error: 401 - invalid content type #12115

Open
krishnaps7 opened this issue Nov 17, 2022 · 2 comments

Comments

@krishnaps7
Copy link

Using below provisioner:

provisioner "windows-shell" {
    inline = [
    "reg add HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\ /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f", 
    "reg add HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\ /v lmcompatibilitylevel /t REG_DWORD /d 0 /f"]
  }

This provisioner was working before, last used on Sep 1st 2022. But this time it ended up in error as below

06:19	2022/11/11 06:06:19 [INFO] (telemetry) Starting provisioner windows-shell
build	11-Nov-2022 06:06:19	1668146779,,ui,say,==> googlecompute: Provisioning with windows-shell...
build	11-Nov-2022 06:06:19	1668146779,,ui,say,==> googlecompute: Provisioning with shell script: /tmp/windows-shell-provisioner824394215
error	11-Nov-2022 06:06:19	2022/11/11 06:06:19 1668146779,,ui,say,==> googlecompute: Provisioning with windows-shell...
error	11-Nov-2022 06:06:19	2022/11/11 06:06:19 packer-provisioner-windows-shell plugin: Found command: reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\ /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f
error	11-Nov-2022 06:06:19	2022/11/11 06:06:19 packer-provisioner-windows-shell plugin: Found command: reg add HKLM\SYSTEM\CurrentControlSet\Control\Lsa\ /v lmcompatibilitylevel /t REG_DWORD /d 0 /f
error	11-Nov-2022 06:06:19	2022/11/11 06:06:19 1668146779,,ui,say,==> googlecompute: Provisioning with shell script: /tmp/windows-shell-provisioner824394215
error	11-Nov-2022 06:06:19	2022/11/11 06:06:19 packer-provisioner-windows-shell plugin: Opening /tmp/windows-shell-provisioner824394215 for reading
error	11-Nov-2022 06:06:19	2022/11/11 06:06:19 packer-provisioner-windows-shell plugin: [INFO] 222 bytes written for 'uploadData'
error	11-Nov-2022 06:06:19	2022/11/11 06:06:19 [INFO] 222 bytes written for 'uploadData'
error	11-Nov-2022 06:06:19	2022/11/11 06:06:19 packer-builder-googlecompute plugin: Uploading file to 'c:/Windows/Temp/script.bat'
error	11-Nov-2022 06:06:20	2022/11/11 06:06:20 packer-provisioner-windows-shell plugin: Retryable error: Error uploading script: Error uploading file to $env:TEMP\winrmcp-2c94e073-0167-4cc0-5493-b16e8a3eb607.tmp: Couldn't create shell: http response error: 401 - invalid content type
error	11-Nov-2022 06:06:22	2022/11/11 06:06:22 packer-provisioner-windows-shell plugin: [INFO] 222 bytes written for 'uploadData'
error	11-Nov-2022 06:06:22	2022/11/11 06:06:22 [INFO] 222 bytes written for 'uploadData'
error	11-Nov-2022 06:06:22	2022/11/11 06:06:22 packer-builder-googlecompute plugin: Uploading file to 'c:/Windows/Temp/script.bat'
error	11-Nov-2022 06:06:22	2022/11/11 06:06:22 packer-provisioner-windows-shell plugin: Retryable error: Error uploading script: Error uploading file to $env:TEMP\winrmcp-366550f4-484e-4e16-404b-c9307a8218f3.tmp: Couldn't create shell: http response error: 401 - invalid content type
error	11-Nov-2022 06:06:24	2022/11/11 06:06:24 packer-provisioner-windows-shell plugin: [INFO] 222 bytes written for 'uploadData'
error	11-Nov-2022 06:06:24	2022/11/11 06:06:24 [INFO] 222 bytes written for 'uploadData'
error	11-Nov-2022 06:06:24	2022/11/11 06:06:24 packer-builder-googlecompute plugin: Uploading file to 'c:/Windows/Temp/script.bat'
error	11-Nov-2022 06:06:25	2022/11/11 06:06:25 packer-provisioner-windows-shell plugin: Retryable error: Error uploading script: Error uploading file to $env:TEMP\winrmcp-21902a91-b048-48d0-6b09-6edfa9a150c7.tmp: Couldn't create shell: http response error: 401 - invalid content type
error	11-Nov-2022 06:06:27	2022/11/11 06:06:27 packer-provisioner-windows-shell plugin: [INFO] 222 bytes written for 'uploadData'
error	11-Nov-2022 06:06:27	2022/11/11 06:06:27 [INFO] 222 bytes written for 'uploadData'

Packer version used: Packer v1.8.4

@arizvisa
Copy link
Contributor

If it's not related to winrmcp (which is dying for a maintainer as per packer-community/winrmcp#38), it might be related to masterzen/winrm#75 which describes an issue with auth that might be worth trying.

@krishnaps7
Copy link
Author

@arizvisa thanks for response. Any alternative provisioner we can use for this reg commands executions on windows?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants