Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Cannot complete build due to error about chocolatey. #576

Closed
JohnTill123 opened this issue Sep 23, 2022 · 3 comments
Closed

Cannot complete build due to error about chocolatey. #576

JohnTill123 opened this issue Sep 23, 2022 · 3 comments

Comments

@JohnTill123
Copy link

Issue Description

Please check the General Issues section in the wiki before you submit the issue.
If you didn't find your issue mentioned, please give a thorough description of the issue you're seeing.
Also, please be sure to include any troubleshooting steps that you've already attempted.

Host System

  • OS: Linux 5.15.0-48-generic Building Issues #54-Ubuntu SMP Fri Aug 26 13:26:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
  • Packer Version: 1.6.6
  • Vagrant Version: Vagrant 2.2.19
  • VirtualBox Version: Version 6.1.38 r153438 (Qt5.15.3)

Command Output

Copy the relevant command output here.
If it's long, either post to a gist and add the link here, or isolate the error lines.

Command: packer build --only=qemu ./packer/templates/windows_2008_r2.json

OK until here:

==> qemu: Provisioning with shell script: /home/b84333/git/metasploitable3/packer/templates/../../scripts/installs/install_boxstarter.bat
==> qemu: 'chocolatey' is not recognized as an internal or external command,
==> qemu: operable program or batch file.
qemu:
==> qemu: 'choco' is not recognized as an internal or external command,
qemu: C:\Users\vagrant>chocolatey feature enable -n=allowGlobalConfirmation
qemu:
==> qemu: operable program or batch file.
==> qemu: 'chocolatey' is not recognized as an internal or external command,
qemu: C:\Users\vagrant>choco install BoxStarter
==> qemu: operable program or batch file.
qemu:
qemu: C:\Users\vagrant>chocolatey feature disable -n=allowGlobalConfirmation
==> qemu: Provisioning step had errors: Running the cleanup provisioner, if present...
==> qemu: Deleting output directory...
Build 'qemu' errored after 12 minutes 37 seconds: Script exited with non-zero exit status: 1.Allowed exit codes are: [0]

==> Wait completed after 12 minutes 37 seconds

==> Some builds didn't complete successfully and had errors:
--> qemu: Script exited with non-zero exit status: 1.Allowed exit codes are: [0]

==> Builds finished but no artifacts were created.

@highball8
Copy link

I'm having what appears to be an identical issue, only I am trying to use both VirtualBox and VMware Fusion Pro.

Host System

  • OS: macOS 12.6 (Monterrey)
  • Packer Version: 1.8.3
  • Vagrant Version: 2.3.1
  • VirtualBox Version: 6.1.38 r153438 (Qt5.6.3)
  • VMware Fusion Pro Version: 12.2.4 (20071091)

Command Output

The error is occurring with both variants of the command (VMware Fusion Pro and VirtualBox):

  • packer build --only=vmware-iso ./packer/templates/windows_2008_r2.json
  • packer build --only=virtualbox-iso ./packer/templates/windows_2008_r2.json

The error happens at the same place, after the second VM reboot.

VirtualBox

==> virtualbox-iso: Provisioning with windows-shell...
==> virtualbox-iso: Provisioning with shell script: <local machine file path>/metasploitable3/packer/templates/../../scripts/installs/install_boxstarter.bat
    virtualbox-iso:
==> virtualbox-iso: 'chocolatey' is not recognized as an internal or external command,
==> virtualbox-iso: operable program or batch file.
    virtualbox-iso: C:\Users\vagrant>chocolatey feature enable -n=allowGlobalConfirmation
    virtualbox-iso:
    virtualbox-iso: C:\Users\vagrant>choco install BoxStarter
==> virtualbox-iso: 'choco' is not recognized as an internal or external command,
    virtualbox-iso:
    virtualbox-iso: C:\Users\vagrant>chocolatey feature disable -n=allowGlobalConfirmation
==> virtualbox-iso: operable program or batch file.
==> virtualbox-iso: 'chocolatey' is not recognized as an internal or external command,
==> virtualbox-iso: operable program or batch file.
==> virtualbox-iso: Provisioning step had errors: Running the cleanup provisioner, if present...
==> virtualbox-iso: Cleaning up floppy disk...
==> virtualbox-iso: Deregistering and deleting VM...
==> virtualbox-iso: Deleting output directory...
Build 'virtualbox-iso' errored after 13 minutes 12 seconds: Script exited with non-zero exit status: 1. Allowed exit codes are: [0]

==> Wait completed after 13 minutes 12 seconds

==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso: Script exited with non-zero exit status: 1. Allowed exit codes are: [0]

==> Builds finished but no artifacts were created.

VMware Fusion Pro

==> vmware-iso: Provisioning with windows-shell...
==> vmware-iso: Provisioning with shell script: <local machine file path>/metasploitable3/packer/templates/../../scripts/installs/install_boxstarter.bat
==> vmware-iso: 'chocolatey' is not recognized as an internal or external command,
    vmware-iso:
    vmware-iso: C:\Users\vagrant>chocolatey feature enable -n=allowGlobalConfirmation
    vmware-iso:
    vmware-iso: C:\Users\vagrant>choco install BoxStarter
==> vmware-iso: operable program or batch file.
    vmware-iso:
    vmware-iso: C:\Users\vagrant>chocolatey feature disable -n=allowGlobalConfirmation
==> vmware-iso: 'choco' is not recognized as an internal or external command,
==> vmware-iso: operable program or batch file.
==> vmware-iso: 'chocolatey' is not recognized as an internal or external command,
==> vmware-iso: operable program or batch file.
==> vmware-iso: Provisioning step had errors: Running the cleanup provisioner, if present...
==> vmware-iso: Stopping virtual machine...
==> vmware-iso: Deleting output directory...
Build 'vmware-iso' errored after 13 minutes 24 seconds: Script exited with non-zero exit status: 1. Allowed exit codes are: [0]

==> Wait completed after 13 minutes 24 seconds

==> Some builds didn't complete successfully and had errors:
--> vmware-iso: Script exited with non-zero exit status: 1. Allowed exit codes are: [0]

==> Builds finished but no artifacts were created.

@Narzard
Copy link

Narzard commented Oct 7, 2022

I get the same thing as well. This is the actual error when it tries to run vagrant.ssh and the chocolatey.ps1 script:

==> virtualbox-iso: Provisioning with powershell script: ./scripts/configs/vagrant-ssh.ps1
==> virtualbox-iso: #< CLIXML
==> virtualbox-iso: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><S S="Error">Exception setting "SecurityProtocol": "Cannot convert null to type "System.Net._x000D__x000A_</S><S S="Error">SecurityProtocolType" due to invalid enumeration values. Specify one of the fol_x000D__x000A_</S><S S="Error">lowing enumeration values and try again. The possible enumeration values are "S_x000D__x000A_</S><S S="Error">sl3, Tls"."_x000D__x000A_</S><S S="Error">At line:2 char:35_x000D__x000A_</S><S S="Error">+        [Net.ServicePointManager]:: &lt;&lt;&lt;&lt; SecurityProtocol = [Net.SecurityProto_x000D__x000A_</S><S S="Error">colType]::Tls12; (New-Object System.Net.WebClient).DownloadFile('https://raw.gi_x000D__x000A_</S><S S="Error">thubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub', 'C:\Users\vagra_x000D__x000A_</S><S S="Error">nt\.ssh\authorized_keys')_x000D__x000A_</S><S S="Error">    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException_x000D__x000A_</S><S S="Error">    + FullyQualifiedErrorId : PropertyAssignmentException_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S><S S="Error">Exception calling "DownloadFile" with "2" argument(s): "The underlying connecti_x000D__x000A_</S><S S="Error">on was closed: An unexpected error occurred on a send."_x000D__x000A_</S><S S="Error">At line:2 char:135_x000D__x000A_</S><S S="Error">+        [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolTyp_x000D__x000A_</S><S S="Error">e]::Tls12; (New-Object System.Net.WebClient).DownloadFile &lt;&lt;&lt;&lt; ('https://raw.gi_x000D__x000A_</S><S S="Error">thubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub', 'C:\Users\vagra_x000D__x000A_</S><S S="Error">nt\.ssh\authorized_keys')_x000D__x000A_</S><S S="Error">    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException_x000D__x000A_</S><S S="Error">    + FullyQualifiedErrorId : DotNetMethodException_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S></Objs>
==> virtualbox-iso: Provisioning with powershell script: ./scripts/installs/chocolatey.ps1
==> virtualbox-iso: #< CLIXML
==> virtualbox-iso: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><S S="Error">Exception setting "SecurityProtocol": "Cannot convert null to type "System.Net._x000D__x000A_</S><S S="Error">SecurityProtocolType" due to invalid enumeration values. Specify one of the fol_x000D__x000A_</S><S S="Error">lowing enumeration values and try again. The possible enumeration values are "S_x000D__x000A_</S><S S="Error">sl3, Tls"."_x000D__x000A_</S><S S="Error">At line:2 char:35_x000D__x000A_</S><S S="Error">+        [Net.ServicePointManager]:: &lt;&lt;&lt;&lt; SecurityProtocol = [Net.SecurityProto_x000D__x000A_</S><S S="Error">colType]::Tls12; iex ((new-object net.webclient).DownloadString('https://chocol_x000D__x000A_</S><S S="Error">atey.org/install.ps1'))_x000D__x000A_</S><S S="Error">    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException_x000D__x000A_</S><S S="Error">    + FullyQualifiedErrorId : PropertyAssignmentException_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S><S S="Error">Exception calling "DownloadString" with "1" argument(s): "The underlying connec_x000D__x000A_</S><S S="Error">tion was closed: An unexpected error occurred on a send."_x000D__x000A_</S><S S="Error">At line:2 char:135_x000D__x000A_</S><S S="Error">+        [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolTyp_x000D__x000A_</S><S S="Error">e]::Tls12; iex ((new-object net.webclient).DownloadString &lt;&lt;&lt;&lt; ('https://chocol_x000D__x000A_</S><S S="Error">atey.org/install.ps1'))_x000D__x000A_</S><S S="Error">    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException_x000D__x000A_</S><S S="Error">    + FullyQualifiedErrorId : DotNetMethodException_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S></Objs>

@jmartin-tech
Copy link
Contributor

This is likely a duplicate from the same root cause as #575, please retest with the fix that landed recently and reopen if the issue persists.

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

No branches or pull requests

4 participants