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

Build Error #520

Closed
sachinjung opened this issue Apr 14, 2021 · 13 comments · Fixed by #562
Closed

Build Error #520

sachinjung opened this issue Apr 14, 2021 · 13 comments · Fixed by #562

Comments

@sachinjung
Copy link

I have been trying to build the Metasploitable3 box but I got errors. I have the following setup

OS: Windows 10 Pro
Packer Version: 1.7.2
Vagrant Version: 2.2.15
VirtualBox Version: 6.1

vagrant plugin install vagrant-vbguest
vagrant plugin install vagrant-reload

PS C:\Users\Sachin Jung Karki\Documents\ISO\MS3\metasploitable3-master> .\build.ps1 windows2008

Compatible version of VirtualBox found.
Compatible version of Packer found.
Compatible version of Vagrant found.
Compatible version of vagrant-reload plugin found.
All requirements found. Proceeding...
Building metasploitable3-win2k8 Vagrant box...
Error: Failed to prepare build: "virtualbox-iso"

1 error occurred:
* Deprecated configuration key: 'iso_checksum_type'. Please call packer fix
against your template to update your template to be compatible with the current
version of Packer. Visit https://www.packer.io/docs/commands/fix/ for more
detail.

==> Builds finished but no artifacts were created.
Error building the Vagrant box using Packer. Please check the output above for any error messages.
At C:\Users\Sachin Jung Karki\Documents\ISO\MS3\metasploitable3-master\build.ps1:157 char:10

  •      throw "Error building the Vagrant box using Packer. Please c ...
    
  •      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationStopped: (Error building ...error messages.:String) [], RuntimeException
    • FullyQualifiedErrorId : Error building the Vagrant box using Packer. Please check the output above for any error
      messages.

PS C:\Users\Sachin Jung Karki\Documents\ISO\MS3\metasploitable3-master>

PS C:\Users\Sachin Jung Karki\Documents\ISO\MS3\metasploitable3-master> cd .\packer\templates\

PS C:\Users\Sachin Jung Karki\Documents\ISO\MS3\metasploitable3-master\packer\templates> packer build .\windows_2008_r2_old.json
Error: Failed to prepare build: "parallels-iso"

1 error occurred:
* Deprecated configuration key: 'iso_checksum_type'. Please call packer fix
against your template to update your template to be compatible with the current
version of Packer. Visit https://www.packer.io/docs/commands/fix/ for more
detail.

Error: Failed to prepare build: "qemu"

1 error occurred:
* Deprecated configuration key: 'iso_checksum_type'. Please call packer fix
against your template to update your template to be compatible with the current
version of Packer. Visit https://www.packer.io/docs/commands/fix/ for more
detail.

Error: Failed to prepare build: "virtualbox-iso"

1 error occurred:
* Deprecated configuration key: 'iso_checksum_type'. Please call packer fix
against your template to update your template to be compatible with the current
version of Packer. Visit https://www.packer.io/docs/commands/fix/ for more
detail.

Error: Failed to prepare build: "vmware-iso"

1 error occurred:
* Deprecated configuration key: 'iso_checksum_type'. Please call packer fix
against your template to update your template to be compatible with the current
version of Packer. Visit https://www.packer.io/docs/commands/fix/ for more
detail.

==> Builds finished but no artifacts were created.
PS C:\Users\Sachin Jung Karki\Documents\ISO\MS3\metasploitable3-master\packer\templates>

PS C:\Users\Sachin Jung Karki\Documents\ISO\MS3\metasploitable3-master\packer\templates> packer fix .\windows_2008_r2.json > windows_2008_r2_new.json
PS C:\Users\Sachin Jung Karki\Documents\ISO\MS3\metasploitable3-master\packer\templates> cd ../..
PS C:\Users\Sachin Jung Karki\Documents\ISO\MS3\metasploitable3-master> .\build.ps1 windows2008

Compatible version of VirtualBox found.
Compatible version of Packer found.
Compatible version of Vagrant found.
Compatible version of vagrant-reload plugin found.
All requirements found. Proceeding...
Building metasploitable3-win2k8 Vagrant box...
Failed to parse template: Error parsing JSON: invalid character 'ÿ' looking for beginning of value
At line 1, column 1 (offset 1):
1: �
^

Error building the Vagrant box using Packer. Please check the output above for any error messages.
At C:\Users\Sachin Jung Karki\Documents\ISO\MS3\metasploitable3-master\build.ps1:157 char:10

  •      throw "Error building the Vagrant box using Packer. Please c ...
    
  •      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationStopped: (Error building ...error messages.:String) [], RuntimeException
    • FullyQualifiedErrorId : Error building the Vagrant box using Packer. Please check the output above for any error
      messages.

PS C:\Users\Sachin Jung Karki\Documents\ISO\MS3\metasploitable3-master>

PS C:\Users\Sachin Jung Karki\Documents\ISO\MS3\metasploitable3-master> cd .\packer\templates
PS C:\Users\Sachin Jung Karki\Documents\ISO\MS3\metasploitable3-master\packer\templates> packer build .\windows_2008_r2.json
Failed to parse template: Error parsing JSON: invalid character 'ÿ' looking for beginning of value
At line 1, column 1 (offset 1):
1: �
^

PS C:\Users\Sachin Jung Karki\Documents\ISO\MS3\metasploitable3-master\packer\templates>

Can you help solve this issue

@hamzakoleri
Copy link

I am also facing the same issue. Any help would be highly appreciated

@kgardas
Copy link

kgardas commented Apr 26, 2021

packer fix ./packer/templates/windows_2008_r2.json > ./packer/templates/windows_2008_r2.json.fix
mv ./packer/templates/windows_2008_r2.json.fix ./packer/templates/windows_2008_r2.json

is what I used on Linux.

@OumaimaBeny
Copy link

did u solve the probleme ?

@sachinjung
Copy link
Author

Hi kgardas,

I tried the fix and had same result. Looking into the core parts now.

@zwq871482439
Copy link

zwq871482439 commented May 12, 2021

first changedirection to the metasploitable3 folder,
then try the command
packer fix --only=vmware-iso ./packer/templates/windows_2008_r2.json > ./packer/templates/windows_2008_r2_fix.json
after the fix complete, using the command
packer build --only=vmware-iso ./packer/templates/windows_2008_r2_fix.json
if return a error with

Original error: Error parsing JSON: invalid character 'ÿ' looking for beginning of value

just create a new file, copy all the codes from windows_2008_r2_fix.json and rename the file as windows_2008_r2_copy.json
then using the command
packer build --only=vmware-iso ./packer/templates/windows_2008_r2_copy.json
see if it solved

@sachinjung
Copy link
Author

first changedirection to the metasploitable3 folder,
then try the command
packer fix --only=vmware-iso ./packer/templates/windows_2008_r2.json > ./packer/templates/windows_2008_r2_fix.json
after the fix complete, using the command
packer build --only=vmware-iso ./packer/templates/windows_2008_r2_fix.json
if return a error with

Original error: Error parsing JSON: invalid character 'ÿ' looking for beginning of value

just create a new file, copy all the codes from windows_2008_r2_fix.json and rename the file as windows_2008_r2_copy.json
then using the command
packer build --only=vmware-iso ./packer/templates/windows_2008_r2_copy.json
see if it solved

Hi,

I am using Virtual Box as you can see below is my environment. I am not using VMware due to the commercial vagrant plugin.
OS: Windows 10 Pro
Packer Version: 1.7.2
Vagrant Version: 2.2.15
VirtualBox Version: 6.1

vagrant plugin install vagrant-vbguest
vagrant plugin install vagrant-reload

@sachinjung
Copy link
Author

mv ./packer/templates/windows_2008_r2.json.fix ./packer/templates/windows_2008_r2.json

I did used as you said and here is the result.
PS C:\Users\Sachin Jung Karki\Documents\Virtual Machines\MSF3\metasploitable3> mv ./packer/templates/windows_2008_r2.json.fix ./packer/templates/windows_2008_r2.json
PS C:\Users\Sachin Jung Karki\Documents\Virtual Machines\MSF3\metasploitable3> .\build.ps1 windows2008

Compatible version of VirtualBox found.
Compatible version of Packer found.
Compatible version of Vagrant found.
Vagrant failed to initialize at a very early stage:

The plugins failed to initialize correctly. This may be due to manual
modifications made within the Vagrant home directory. Vagrant can
attempt to automatically correct this issue by running:

vagrant plugin repair

If Vagrant was recently updated, this error may be due to incompatible
versions of dependencies. To fix this problem please remove and re-install
all plugins. Vagrant can attempt to do this automatically by running:

vagrant plugin expunge --reinstall

Or you may want to try updating the installed plugins to their latest
versions:

vagrant plugin update

Error message given during initialization: Unable to resolve dependency: user requested 'vagrant-reload (= 0.0.1)'
Could not find a compatible version of vagrant-reload plugin. Attempting to install...
Installing the 'vagrant-reload' plugin. This can take a few minutes...
Fetching vagrant-reload-0.0.1.gem
Fetching micromachine-3.0.0.gem
Fetching vagrant-vbguest-0.29.0.gem
Installed the plugin 'vagrant-reload (0.0.1)'!
The vagrant-reload plugin was successfully installed.
All requirements found. Proceeding...
Building metasploitable3-win2k8 Vagrant box...
Failed to parse file as legacy JSON template: if you are using an HCL template, check your file extensions; they should be either *.pkr.hcl or *.pkr.json; see the docs for more details: https://www.packer.io/docs/templates/hcl_templates.
Original error: Error parsing JSON: invalid character 'ÿ' looking for beginning of value
At line 1, column 1 (offset 1):
1: �
^

Error building the Vagrant box using Packer. Please check the output above for any error messages.
At C:\Users\Sachin Jung Karki\Documents\Virtual Machines\MSF3\metasploitable3\build.ps1:157 char:10

  •      throw "Error building the Vagrant box using Packer. Please c ...
    
  •      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationStopped: (Error building ...error messages.:String) [], RuntimeException
    • FullyQualifiedErrorId : Error building the Vagrant box using Packer. Please check the output above for any error
      messages.

PS C:\Users\Sachin Jung Karki\Documents\Virtual Machines\MSF3\metasploitable3>

@zwq871482439
Copy link

for the parameter please refer to the README file, as for Virtualbox just needs to change the parameter --only=<YOURVERSION>

Building metasploitable3-win2k8 Vagrant box...
Failed to parse template: Error parsing JSON: invalid character 'ÿ' looking for beginning of value
At line 1, column 1 (offset 1):
1: �
^

this error is caused by an unrecognised character, if you looking deeply at the windows_2008_r2.json file you will find it using the UNIX Line Feed called LF, if you using windows to process this file, please change the Line Feed to CR LF as it is for windows.

@IVRlabs
Copy link

IVRlabs commented Feb 12, 2023

Error: Failed to prepare build: "qemu"

1 error(s) occurred:

  • Output directory 'output-qemu' already exists. It must not exist.

@IVRlabs
Copy link

IVRlabs commented Feb 12, 2023

After the installation fails, part of the installed is still there, how to get rid of it? Grateful for any help.

@jmartin-tech
Copy link
Contributor

This is a packer error it simply did not finish cleanup on failure you can simply delete the directory and packer will recreate it during the next build attempt.

@IVRlabs
Copy link

IVRlabs commented Mar 5, 2023 via email

@fr33k3v1n0
Copy link

i have the same problem and can not find solution

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

Successfully merging a pull request may close this issue.

8 participants