rapid7 / metasploitable3

Metasploitable3 is a VM that is built from the ground up with a large amount of security vulnerabilities.
Other
4.78k stars 1.15k forks source link

Cannot complete build due to error about chocolatey. #576

Closed JohnTill123 closed 1 year ago

JohnTill123 commented 2 years ago

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

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 commented 2 years ago

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

Host System

Command Output

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

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 commented 2 years ago

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 commented 1 year ago

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.