hashicorp / packer-plugin-vagrant Goto Github PK
View Code? Open in Web Editor NEWPacker plugin for Vagrant
Home Page: https://packer.io
License: Mozilla Public License 2.0
Packer plugin for Vagrant
Home Page: https://packer.io
License: Mozilla Public License 2.0
This issue was originally opened by @aacebedo as hashicorp/packer#10828. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.
I am generating a vagrantfile when creating a box with packer. In this vagrantfile, I use variables defined in the packer file.
In the vagrantfile.tpl I add tags like {{ user myvariable
}}. When I use a JSON packer file, everything is ok.
I upgraded my packer json file into the HCL2 format and the syntax seems to have changed for those variables as they are not replaced anymore. I may be missing something here but the document "engine" page of the JSON section does not exist in the HCL section.
myvariable
}} syntax.1.7.0
file.pkr.hcl
[...]
locals {
mylocal = "helloworld"
}
post-processor "vagrant" {
keep_input_artifact = true
vagrantfile_template = ./vagrantfile.tpl
}
[...]
file vagrantfile.tpl
[...]
something = {{ user `mylocal` }}
[...]
Linux x86_64
N/A
When this post processor is used with artifacts from the 'artifice' post processor along with the provider_override="hyperv", the resulting .box output file does not seem to be valid.
Prerequisite:
An incomplete .box file file is generated (see attached file:packer_example_hyperv_amd64.box in the zip file ).
packer_example_hyperv_amd64.zip
No Hyper-v VM artifacts are present in the .box file. It only contains the vagrantfile and the metadata.json. Also the input
artifacts are being copied to 'c:\users' folder which was not expected behaviour.
file: vagrant_post_processor_hyperv.pkr.hcl
required_plugins {
vagrant = {
version = "~> 1"
source = "github.com/hashicorp/vagrant"
}
}
}
source "null" "example" {
communicator = "none"
}
build {
sources = [
"source.null.example"
]
post-processors {
post-processor "artifice" {
files = [
"output-windows10/Virtual Hard Disks/VnV-W10-001.vhdx",
"output-windows10/Virtual Machines/4643F645-2EDB-4DD5-8E17-18A7DE59893C.vmcx",
"output-windows10/Virtual Machines/4643F645-2EDB-4DD5-8E17-18A7DE59893C.vmgs",
"output-windows10/Virtual Machines/4643F645-2EDB-4DD5-8E17-18A7DE59893C.VMRS",
"output-windows10/Virtual Machines/box.xml"
]
}
post-processor "vagrant" {
keep_input_artifact = true
provider_override = "hyperv"
}
}
}
See attached log file from the CMD prompt ( packer_build_logt.txt) for the packer build:
I'm currently trying to build a Windows Vagrant box with packer-plugin-vagrant
without success.
First, could we used the SSH communicator with windows box ?
Second, I see errors in log but the build is mark as success, but I don't see any package.box
generated
My packer file content
packer {
required_plugins {
vagrant = {
version = "~> 1"
source = "github.com/hashicorp/vagrant"
}
}
}
source "vagrant" "gusztavvargadr" {
source_path = "gusztavvargadr/windows-10"
provider = "virtualbox"
communicator = "ssh"
}
build {
sources = [
"source.vagrant.gusztavvargadr",
]
}
The shell log
❯ PACKER_LOG=1 packer build .
2024/03/21 14:54:28 [INFO] Packer version: 1.10.2-dev [go1.22.1 linux amd64]
2024/03/21 14:54:28 [TRACE] discovering plugins in /usr/bin
2024/03/21 14:54:28 [TRACE] discovering plugins in .
2024/03/21 14:54:28 [TRACE] discovering plugins in /home/fabien/.config/packer/plugins
2024/03/21 14:54:28 [INFO] Discovered potential plugin: ansible = /home/fabien/.config/packer/plugins/github.com/hashicorp/ansible/packer-plugin-ansible_v1.1.1_x5.0_linux_amd64
2024/03/21 14:54:28 [INFO] Discovered potential plugin: vagrant = /home/fabien/.config/packer/plugins/github.com/hashicorp/vagrant/packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64
2024/03/21 14:54:28 found external [-packer-default-plugin-name- local] provisioner from ansible plugin
2024/03/21 14:54:28 [INFO] found external [-packer-default-plugin-name-] builders from vagrant plugin
2024/03/21 14:54:28 [INFO] found external [-packer-default-plugin-name- cloud] post-processors from vagrant plugin
2024/03/21 14:54:28 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2024/03/21 14:54:28 [INFO] PACKER_CONFIG env var set; attempting to open config file: /home/fabien/.packerconfig
2024/03/21 14:54:28 [WARN] Config file doesn't exist: /home/fabien/.packerconfig
2024/03/21 14:54:28 [INFO] Setting cache directory: /home/fabien/.cache/packer
2024/03/21 14:54:28 [ERR] Checkpoint error: EOF
2024/03/21 14:54:28 [TRACE] listing potential installations for "github.com/hashicorp/ansible" that match "~> 1". plugingetter.ListInstallationsOptions{FromFolders:[]string{"/usr/bin", ".", "/home/fabien/.config
/packer/plugins"}, BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"linux", ARCH:"amd64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingette
r.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc000150500)}}}}
2024/03/21 14:54:28 [TRACE] Found the following "github.com/hashicorp/ansible" installations: [{/home/fabien/.config/packer/plugins/github.com/hashicorp/ansible/packer-plugin-ansible_v1.1.1_x5.0_linux_amd64 v1.1
.1}]
2024/03/21 14:54:28 found external [-packer-default-plugin-name- local] provisioner from ansible plugin
2024/03/21 14:54:28 [TRACE] listing potential installations for "github.com/hashicorp/vagrant" that match "~> 1". plugingetter.ListInstallationsOptions{FromFolders:[]string{"/usr/bin", ".", "/home/fabien/.config
/packer/plugins"}, BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"linux", ARCH:"amd64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingette
r.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc000150500)}}}}
2024/03/21 14:54:28 [TRACE] Found the following "github.com/hashicorp/vagrant" installations: [{/home/fabien/.config/packer/plugins/github.com/hashicorp/vagrant/packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 v1.1
.2}]
2024/03/21 14:54:28 [INFO] found external [-packer-default-plugin-name-] builders from vagrant plugin
2024/03/21 14:54:28 [INFO] found external [-packer-default-plugin-name- cloud] post-processors from vagrant plugin
2024/03/21 14:54:28 [INFO] Starting external plugin /home/fabien/.config/packer/plugins/github.com/hashicorp/vagrant/packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 start builder -packer-default-plugin-name-
2024/03/21 14:54:28 Starting plugin: /home/fabien/.config/packer/plugins/github.com/hashicorp/vagrant/packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 []string{"/home/fabien/.config/packer/plugins/github.com/hashic
orp/vagrant/packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64", "start", "builder", "-packer-default-plugin-name-"}
2024/03/21 14:54:28 Waiting for RPC address for: /home/fabien/.config/packer/plugins/github.com/hashicorp/vagrant/packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64
2024/03/21 14:54:28 Received unix RPC address for /home/fabien/.config/packer/plugins/github.com/hashicorp/vagrant/packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64: addr is /tmp/packer-plugin2541122914
2024/03/21 14:54:28 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:54:28 Plugin address: unix /tmp/packer-plugin2541122914
2024/03/21 14:54:28 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:54:28 Waiting for connection...
2024/03/21 14:54:28 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:54:28 Serving a plugin connection...
2024/03/21 14:54:28 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:54:28 [TRACE] starting builder -packer-default-plugin-name-
2024/03/21 14:54:28 Build debug mode: false
2024/03/21 14:54:28 Force build: false
2024/03/21 14:54:28 On error:
2024/03/21 14:54:28 Waiting on builds to complete...
2024/03/21 14:54:28 Starting build run: vagrant.gusztavvargadr
2024/03/21 14:54:28 Running builder:
2024/03/21 14:54:28 [INFO] (telemetry) Starting builder vagrant.gusztavvargadr
vagrant.gusztavvargadr: output will be in this color.
2024/03/21 14:54:28 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:54:28 Calling Vagrant CLI: []string{"--version"}
2024/03/21 14:54:28 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:54:28 [vagrant driver] stdout: Vagrant 2.4.1
==> vagrant.gusztavvargadr: Creating a Vagrantfile in the build directory...
2024/03/21 14:54:28 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:54:28 Created vagrantfile at /home/fabien/work/ultra/devops/backend-deployment/run/ultra-windows-client/output-gusztavvargadr/Vagrantfile
==> vagrant.gusztavvargadr: Adding box using vagrant box add ...
2024/03/21 14:54:28 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:54:28 [vagrant] Calling box add with following args gusztavvargadr/windows-10 --provider virtualbox
2024/03/21 14:54:28 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:54:28 Calling Vagrant CLI: []string{"box", "add", "gusztavvargadr/windows-10", "--provider", "virtualbox"}
vagrant.gusztavvargadr: (this can take some time if we need to download the box)
2024/03/21 14:54:31 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:54:31 [vagrant driver] stdout: ==> box: Loading metadata for box 'gusztavvargadr/windows-10'
2024/03/21 14:54:31 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:54:31 [vagrant driver] stdout: box: URL: https://vagrantcloud.com/api/v2/vagrant/gusztavvargadr/windows-10
2024/03/21 14:54:31 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:54:31 [vagrant driver] stdout: ==> box: Adding box 'gusztavvargadr/windows-10' (v2202.0.2402) for provider: virtualbox (amd64)
2024/03/21 14:54:31 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:54:31 [vagrant driver] stderr: The box you're attempting to add already exists. Remove it before
2024/03/21 14:54:31 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:54:31 [vagrant driver] stderr: adding it again or add it with the `--force` flag.
2024/03/21 14:54:31 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:54:31 [vagrant driver] stderr:
2024/03/21 14:54:31 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:54:31 [vagrant driver] stderr: Name: gusztavvargadr/windows-10
2024/03/21 14:54:31 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:54:31 [vagrant driver] stderr: Provider: virtualbox
2024/03/21 14:54:31 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:54:31 [vagrant driver] stderr: Version: 2202.0.2402
==> vagrant.gusztavvargadr: Calling Vagrant Up (this can take some time)...
2024/03/21 14:54:31 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:54:31 Calling Vagrant CLI: []string{"up", "source", "--provider=virtualbox"}
2024/03/21 14:54:32 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:54:32 [vagrant driver] stdout: Bringing machine 'source' up with 'virtualbox' provider...
2024/03/21 14:54:33 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:54:33 [vagrant driver] stdout: ==> source: Importing base box 'gusztavvargadr/windows-10'...
2024/03/21 14:55:30 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:55:30 [vagrant driver] stdout:
2024/03/21 14:55:40 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:55:40 [vagrant driver] stdout: Progress: 10%
2024/03/21 14:55:45 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:55:45 [vagrant driver] stdout: Progress: 20%
2024/03/21 14:55:47 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:55:47 [vagrant driver] stdout: Progress: 90%
2024/03/21 14:55:47 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:55:47 [vagrant driver] stdout: ==> source: Matching MAC address for NAT networking...
2024/03/21 14:55:48 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:55:48 [vagrant driver] stdout: ==> source: Checking if box 'gusztavvargadr/windows-10' version '2202.0.2402' is up to date...
2024/03/21 14:55:48 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:55:48 [vagrant driver] stdout: ==> source: Setting the name of the VM: output-gusztavvargadr_source_1711029348741_75644
2024/03/21 14:55:50 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:55:50 [vagrant driver] stdout: ==> source: Clearing any previously set network interfaces...
2024/03/21 14:55:50 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:55:50 [vagrant driver] stdout: ==> source: Preparing network interfaces based on configuration...
2024/03/21 14:55:50 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:55:50 [vagrant driver] stdout: source: Adapter 1: nat
2024/03/21 14:55:50 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:55:50 [vagrant driver] stdout: ==> source: Forwarding ports...
2024/03/21 14:55:50 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:55:50 [vagrant driver] stdout: source: 3389 (guest) => 53389 (host) (adapter 1)
2024/03/21 14:55:50 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:55:50 [vagrant driver] stdout: source: 5985 (guest) => 55985 (host) (adapter 1)
2024/03/21 14:55:50 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:55:50 [vagrant driver] stdout: source: 5986 (guest) => 55986 (host) (adapter 1)
2024/03/21 14:55:50 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:55:50 [vagrant driver] stdout: source: 22 (guest) => 2222 (host) (adapter 1)
2024/03/21 14:55:51 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:55:51 [vagrant driver] stdout: ==> source: Running 'pre-boot' VM customizations...
2024/03/21 14:55:51 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:55:51 [vagrant driver] stdout: ==> source: Booting VM...
2024/03/21 14:55:51 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:55:51 [vagrant driver] stdout: ==> source: Waiting for machine to boot. This may take a few minutes...
2024/03/21 14:55:52 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:55:52 [vagrant driver] stdout: source: WinRM address: 127.0.0.1:55985
2024/03/21 14:55:52 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:55:52 [vagrant driver] stdout: source: WinRM username: vagrant
2024/03/21 14:55:52 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:55:52 [vagrant driver] stdout: source: WinRM execution_time_limit: PT2H
2024/03/21 14:55:52 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:55:52 [vagrant driver] stdout: source: WinRM transport: negotiate
2024/03/21 14:58:33 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:33 [vagrant driver] stderr: An error occurred executing a remote WinRM command.
2024/03/21 14:58:33 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:33 [vagrant driver] stderr:
2024/03/21 14:58:33 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:33 [vagrant driver] stderr: Shell: Cmd
2024/03/21 14:58:33 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:33 [vagrant driver] stderr: Command: hostname
2024/03/21 14:58:33 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:33 [vagrant driver] stderr: Message: Digest initialization failed: initialization error
2024/03/21 14:58:34 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:34 Calling Vagrant CLI: []string{"ssh-config", "source"}
2024/03/21 14:58:35 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:35 [vagrant driver] stdout: Host source
2024/03/21 14:58:35 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:35 [vagrant driver] stdout: HostName 127.0.0.1
2024/03/21 14:58:35 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:35 [vagrant driver] stdout: User vagrant
2024/03/21 14:58:35 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:35 [vagrant driver] stdout: Port 2222
2024/03/21 14:58:35 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:35 [vagrant driver] stdout: UserKnownHostsFile /dev/null
2024/03/21 14:58:35 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:35 [vagrant driver] stdout: StrictHostKeyChecking no
2024/03/21 14:58:35 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:35 [vagrant driver] stdout: PasswordAuthentication no
2024/03/21 14:58:35 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:35 [vagrant driver] stdout: IdentityFile /home/fabien/.vagrant.d/insecure_private_keys/vagrant.key.ed25519
2024/03/21 14:58:35 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:35 [vagrant driver] stdout: IdentityFile /home/fabien/.vagrant.d/insecure_private_keys/vagrant.key.rsa
2024/03/21 14:58:35 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:35 [vagrant driver] stdout: IdentitiesOnly yes
2024/03/21 14:58:35 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:35 [vagrant driver] stdout: LogLevel FATAL
2024/03/21 14:58:35 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:35 [vagrant driver] stdout: PubkeyAcceptedKeyTypes +ssh-rsa
2024/03/21 14:58:35 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:35 [vagrant driver] stdout: HostKeyAlgorithms +ssh-rsa
2024/03/21 14:58:35 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:35 [vagrant driver] stdout:
2024/03/21 14:58:36 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:36 identity file is /home/fabien/.vagrant.d/insecure_private_keys/vagrant.key.rsa
2024/03/21 14:58:36 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:36 Removing quotes from identity file
==> vagrant.gusztavvargadr: Using SSH communicator to connect: 127.0.0.1
2024/03/21 14:58:36 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:36 [INFO] Waiting for SSH, up to timeout: 10m0s
==> vagrant.gusztavvargadr: Waiting for SSH to become available...
2024/03/21 14:58:36 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:36 [INFO] Attempting SSH connection to 127.0.0.1:2222...
2024/03/21 14:58:36 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:36 [DEBUG] reconnecting to TCP connection for SSH
2024/03/21 14:58:36 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:36 [DEBUG] handshaking with SSH
2024/03/21 14:58:36 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:36 [DEBUG] handshake complete!
2024/03/21 14:58:36 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:36 [DEBUG] Opening new ssh session
2024/03/21 14:58:37 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:37 [ERROR] RequestAgentForwarding: &errors.errorString{s:"forwarding request denied"}
==> vagrant.gusztavvargadr: Connected to SSH!
2024/03/21 14:58:37 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:37 Running the provision hook
==> vagrant.gusztavvargadr: Packaging box...
2024/03/21 14:58:37 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:37 Calling Vagrant CLI: []string{"package", "source", "--output", "package.box"}
2024/03/21 14:58:40 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:40 [vagrant driver] stdout: ==> source: Attempting graceful shutdown of VM...
2024/03/21 14:58:40 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:40 [vagrant driver] stderr: An error occurred executing a remote WinRM command.
2024/03/21 14:58:40 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:40 [vagrant driver] stderr:
2024/03/21 14:58:40 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:40 [vagrant driver] stderr: Shell: Cmd
2024/03/21 14:58:40 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:40 [vagrant driver] stderr: Command: hostname
2024/03/21 14:58:40 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:40 [vagrant driver] stderr: Message: Digest initialization failed: initialization error
2024/03/21 14:58:40 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:40 Calling Vagrant CLI: []string{"destroy", "-f", "source"}
==> vagrant.gusztavvargadr: destroying Vagrant box...
2024/03/21 14:58:44 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:44 [vagrant driver] stdout: ==> source: Forcing shutdown of VM...
2024/03/21 14:58:45 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:45 [vagrant driver] stdout: ==> source: Destroying VM and associated drives...
2024/03/21 14:58:47 [INFO] (telemetry) ending vagrant.gusztavvargadr
==> Wait completed after 4 minutes 18 seconds
==> Builds finished. The artifacts of successful builds are:
2024/03/21 14:58:47 machine readable: vagrant.gusztavvargadr,artifact-count []string{"1"}
Build 'vagrant.gusztavvargadr' finished after 4 minutes 18 seconds.
==> Wait completed after 4 minutes 18 seconds
==> Builds finished. The artifacts of successful builds are:
2024/03/21 14:58:47 machine readable: vagrant.gusztavvargadr,artifact []string{"0", "builder-id", "vagrant"}
2024/03/21 14:58:47 machine readable: vagrant.gusztavvargadr,artifact []string{"0", "id", "virtualbox"}
2024/03/21 14:58:47 machine readable: vagrant.gusztavvargadr,artifact []string{"0", "string", "Vagrant box 'package.box' for 'virtualbox' provider"}
2024/03/21 14:58:47 machine readable: vagrant.gusztavvargadr,artifact []string{"0", "files-count", "1"}
2024/03/21 14:58:47 machine readable: vagrant.gusztavvargadr,artifact []string{"0", "file", "0", "output-gusztavvargadr/package.box"}
2024/03/21 14:58:47 machine readable: vagrant.gusztavvargadr,artifact []string{"0", "end"}
2024/03/21 14:58:47 [INFO] (telemetry) Finalizing.
--> vagrant.gusztavvargadr: Vagrant box 'package.box' for 'virtualbox' provider
2024/03/21 14:58:48 waiting for all plugin processes to complete...
2024/03/21 14:58:48 /home/fabien/.config/packer/plugins/github.com/hashicorp/vagrant/packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64: plugin process exited
If you take a look during ==> vagrant.gusztavvargadr: Calling Vagrant Up (this can take some time)...
, I got
2024/03/21 14:58:33 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:33 [vagrant driver] stderr: An error occurred executing a remote WinRM command.
2024/03/21 14:58:33 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:33 [vagrant driver] stderr:
2024/03/21 14:58:33 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:33 [vagrant driver] stderr: Shell: Cmd
2024/03/21 14:58:33 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:33 [vagrant driver] stderr: Command: hostname
2024/03/21 14:58:33 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: 2024/03/21 14:58:33 [vagrant driver] stderr: Message: Digest initialization failed: initialization error
https://www.packer.io/docs/builders/vagrant#template points to https://github.com/hashicorp/packer/blob/master/builder/vagrant/step_create_vagrantfile.go#L23-L37, which no longer exists in the hashicorp/packer
repo resulting in a 404 error.
The file now resides in this repo at https://github.com/hashicorp/packer-plugin-vagrant/blob/main/builder/vagrant/step_create_vagrantfile.go
Additionally, attempting use the Edit this page
link on the bottom of the page also gives a 404 error. The old link points to https://github.com/hashicorp/packer/blob/master/website/content/docs/builders/vagrant.mdx which I guess also resides here now at https://github.com/hashicorp/packer-plugin-vagrant/blob/main/docs/builders/vagrant.mdx, but I'm not really sure if that is the correct file.
here
link.Edit this page
link on the right.When using a backing file like:
source "qemu" "packer-qemu-ansible-debian-example" {
...
disk_image = true
use_backing_file = true
iso_url = "/home/rgl/.vagrant.d/boxes/debian-11-amd64/0/libvirt/box.img"
}
build {
...
post-processor "vagrant" {
output = "packer-qemu-ansible-debian-example.box"
}
}
The disk image inside the generated vagrant box is using a backing file:
$ qemu-img info ~/.vagrant.d/boxes/packer-qemu-ansible-debian-example/0/libvirt/box.img
image: /home/rgl/.vagrant.d/boxes/packer-qemu-ansible-debian-example/0/libvirt/box.img
file format: qcow2
virtual size: 60 GiB (64424509440 bytes)
disk size: 139 MiB
cluster_size: 65536
backing file: /home/rgl/.vagrant.d/boxes/debian-11-amd64/0/libvirt/box.img
Format specific information:
compat: 1.1
lazy refcounts: false
refcount bits: 16
corrupt: false
This makes the box depend on that backing file, which is not what I would expect. I was expecting an stand-alone disk inside the box file.
Creating a stand-alone disk is a matter of executing qemu-img (instead of just copying the img) with something alike:
qemu-img convert -O qcow2 with-backing-file.img standalone.img
What do you think? Would a PR with this be acceptable?
This issue was originally opened by @adriananeci as hashicorp/packer#9492. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.
When using vagrant-cloud post-processor to upload a freshly generated box into vagrant cloud, we are getting an exception if the version already exists.
==> vagrant: Running post-processor: vagrant-cloud
==> vagrant (vagrant-cloud): Verifying box is accessible: hlesey/k8s-base
vagrant (vagrant-cloud): Box accessible and matches tag
==> vagrant (vagrant-cloud): Creating version: 1.18.2.2
vagrant (vagrant-cloud): Version exists, skipping creation
==> vagrant (vagrant-cloud): Creating provider: virtualbox
==> vagrant (vagrant-cloud): Cleaning up provider
vagrant (vagrant-cloud): Provider was not created, not deleting
Build 'vagrant' errored: 1 error(s) occurred:
* Post-processor failed: Error creating provider: Metadata provider must be unique for version
With debug enabled I've got
2020/06/27 13:00:22 packer-post-processor-vagrant-cloud plugin: Post-Processor Vagrant Cloud API POST: https://vagrantcloud.com/api/v1/box/hlesey/k8s-base/version/1.18.2.1/providers.
2020/06/27 13:00:22 packer-post-processor-vagrant-cloud plugin:
2020/06/27 13:00:22 packer-post-processor-vagrant-cloud plugin: Body: {"provider":{"name":"virtualbox"}}
2020/06/27 13:00:22 packer-post-processor-vagrant-cloud plugin: Post-Processor Vagrant Cloud API Response:
2020/06/27 13:00:22 packer-post-processor-vagrant-cloud plugin:
2020/06/27 13:00:22 packer-post-processor-vagrant-cloud plugin: &{Status:422 Unprocessable Entity StatusCode:422 Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1 Header:map[Cache-Control:[no-cache] Connection:[keep-alive] Content-Type:[application/json; charset=utf-8] Date:[Sat, 27 Jun 2020 10:00:21 GMT] Referrer-Policy:[strict-origin-when-cross-origin] Server:[Cowboy] Set-Cookie:[_atlas_session_data=aFRxUkhQcnYzV2tvem5YbnJtQ0NjZ0VxanEwcHBIODNlYURYcDBkQ0pWMzZrcjlOeUdVNE0yVlB2N2l2S0VBUTlJOGQ1YThCZWhFUmpsblpSUlc0TlE9PS0tcEgwSFlFb3FYQVhXQ2Y2cVpjN0ZvUT09--0ad671fa052e76fbb10ceb6866cab4e379ad7143; path=/; expires=Mon, 27 Jul 2020 10:00:22 GMT; secure; HttpOnly] Strict-Transport-Security:[max-age=31536000; includeSubDomains; preload] Via:[1.1 vegur] X-Content-Type-Options:[nosniff] X-Download-Options:[noopen] X-Frame-Options:[SAMEORIGIN] X-Permitted-Cross-Domain-Policies:[none] X-Request-Id:[1f0a23a5-7c4c-4a2a-bdec-1902e591f57c] X-Runtime:[0.132013] X-Vagrantcloud-Rate-Limit:[98/100] X-Xss-Protection:[1; mode=block]] Body:0xc00038e4c0 ContentLength:-1 TransferEncoding:[chunked] Close:false Uncompressed:false Trailer:map[] Request:0xc0000c6600 TLS:0xc0004e3550}
One way to mitigate it is to manually remove the provider for this version from vagrantcloud UI and retry the packer build
.
Another way to avoid such exceptions is to increase the version when uploading the new box. In this case we have to announce everyone that consumes this box that a new version is available and they have to adjust their config.
It would be nice to have a new parameter for vagrant-cloud post-processor, something like replace_if_exists
defaulting to false.
Sample config
{
"variables": {
"cloud_token": "{{ env `VAGRANT_CLOUD_TOKEN` }}",
"output_path": "./output"
},
"builders": [
{
"type": "vagrant",
"source_path": "ubuntu/bionic64",
"communicator": "ssh",
"add_force": true,
"provider": "virtualbox",
"output_dir": "{{user `output_path`}}"
}
],
"post-processors": [
[
{
"type": "vagrant-cloud",
"box_tag": "hlesey/k8s-base",
"version": "{{user `version`}}",
"access_token": "{{user `cloud_token`}}",
"replace_if_exists": true
}
]
]
}
vagrant cli already support replacing existing version, vagrant cloud provider upload ORGANIZATION/BOX-NAME PROVIDER-NAME VERSION BOX-FILE
As a packer user, I want to be able to replace an existing box version when using vagrant-cloud post-processor.
When building boxes in Vagrant cloud, if the architecture is explicitly set (why wouldn't it be?) during build, the vagrant box add command fails on subsequent use. Ostensibly, this is due to a "not found" for the box in question.
Specifying the architecture during a cloud version/provider upload interferes with using that arch later.
packer
's call to vagrant box add
using provider/version to use the default arch value in Vagrant cloud without specifying architecture, but that doesn't seem to happen (see logs at bottom).source
but that does not appear to be possible.Attempt to build a box with packer and virtualbox using this source
source "vagrant" "f38ansible" {
communicator = "ssh"
source_path = "mykelalvis/fedora38base"
provider = "virtualbox"
box_version = "0.0.1"
add_force = true
}
Packer version: 1.9.4 [go1.20.7 windows amd64]
Plugin is 1.1.1_x5.0_windows_amd64 per the error below
packer {
required_plugins {
vagrant = {
source = "github.com/hashicorp/vagrant"
version = "~> 1"
}
ansible = {
version = "~> 1"
source = "github.com/hashicorp/ansible"
}
}
}
source "vagrant" "f38ansible" {
communicator = "ssh"
source_path = "mykelalvis/fedora38base"
provider = "virtualbox"
box_version = "0.0.1"
add_force = true
}
build {
sources = ["source.vagrant.f38ansible"]
}
Win 11-64 fully updated
2023/10/22 18:13:07 packer-plugin-vagrant_v1.1.1_x5.0_windows_amd64.exe plugin: 2023/10/22 18:13:07 [vagrant] Calling box add with following args mykelalvis/fedora38base --box-version 0.0.1 --force --provider virtualbox
2023/10/22 18:13:07 packer-plugin-vagrant_v1.1.1_x5.0_windows_amd64.exe plugin: 2023/10/22 18:13:07 Calling Vagrant CLI: []string{"box", "add", "mykelalvis/fedora38base", "--box-version", "0.0.1", "--force", "--provider", "virtualbox"}
2023/10/22 18:13:10 packer-plugin-vagrant_v1.1.1_x5.0_windows_amd64.exe plugin: 2023/10/22 18:13:10 [vagrant driver] stdout: ==> box: Loading metadata for box 'mykelalvis/fedora38base'
2023/10/22 18:13:10 packer-plugin-vagrant_v1.1.1_x5.0_windows_amd64.exe plugin: 2023/10/22 18:13:10 [vagrant driver] stdout: box: URL: https://vagrantcloud.com/api/v2/vagrant/mykelalvis/fedora38base
2023/10/22 18:13:10 packer-plugin-vagrant_v1.1.1_x5.0_windows_amd64.exe plugin: 2023/10/22 18:13:10 [vagrant driver] stderr: The box you're attempting to add doesn't support the provider
2023/10/22 18:13:10 packer-plugin-vagrant_v1.1.1_x5.0_windows_amd64.exe plugin: 2023/10/22 18:13:10 [vagrant driver] stderr: you requested. Please find an alternate box or use an alternate
2023/10/22 18:13:10 packer-plugin-vagrant_v1.1.1_x5.0_windows_amd64.exe plugin: 2023/10/22 18:13:10 [vagrant driver] stderr: provider. Double-check your requested provider to verify you didn't
2023/10/22 18:13:10 packer-plugin-vagrant_v1.1.1_x5.0_windows_amd64.exe plugin: 2023/10/22 18:13:10 [vagrant driver] stderr: simply misspell it.
2023/10/22 18:13:10 packer-plugin-vagrant_v1.1.1_x5.0_windows_amd64.exe plugin: 2023/10/22 18:13:10 [vagrant driver] stderr:
2023/10/22 18:13:10 packer-plugin-vagrant_v1.1.1_x5.0_windows_amd64.exe plugin: 2023/10/22 18:13:10 [vagrant driver] stderr: If you're adding a box from HashiCorp's Vagrant Cloud, make sure the box is
2023/10/22 18:13:10 packer-plugin-vagrant_v1.1.1_x5.0_windows_amd64.exe plugin: 2023/10/22 18:13:10 [vagrant driver] stderr: released.
2023/10/22 18:13:10 packer-plugin-vagrant_v1.1.1_x5.0_windows_amd64.exe plugin: 2023/10/22 18:13:10 [vagrant driver] stderr:
2023/10/22 18:13:10 packer-plugin-vagrant_v1.1.1_x5.0_windows_amd64.exe plugin: 2023/10/22 18:13:10 [vagrant driver] stderr: Name: mykelalvis/fedora38base
2023/10/22 18:13:10 packer-plugin-vagrant_v1.1.1_x5.0_windows_amd64.exe plugin: 2023/10/22 18:13:10 [vagrant driver] stderr: Address: https://vagrantcloud.com/api/v2/vagrant/mykelalvis/fedora38base
2023/10/22 18:13:10 packer-plugin-vagrant_v1.1.1_x5.0_windows_amd64.exe plugin: 2023/10/22 18:13:10 [vagrant driver] stderr: Requested provider: virtualbox (x64)
For reference, here is a series of vagrant box add
command outputs. Note that in Vagrant cloud, the amd64 VirtualBox provider is specified as the default provider.
PS C:\Users\mykel> vagrant -v
Vagrant 2.4.0
PS C:\Users\mykel> vagrant box list
There are no installed boxes! Use `vagrant box add` to add some.
PS C:\Users\mykel> vagrant box add mykelalvis/fedora38base
==> box: Loading metadata for box 'mykelalvis/fedora38base'
box: URL: https://vagrantcloud.com/api/v2/vagrant/mykelalvis/fedora38base
The box you're attempting to add has no available version that
matches the constraints you requested. Please double-check your
settings. Also verify that if you specified version constraints,
that the provider you wish to use is available for these constraints.
Box: mykelalvis/fedora38base
Address: https://vagrantcloud.com/api/v2/vagrant/mykelalvis/fedora38base
Constraints: >= 0
Available versions: 0.0.1
PS C:\Users\mykel> vagrant box add --box-version 0.0.1 mykelalvis/fedora38base
==> box: Loading metadata for box 'mykelalvis/fedora38base'
box: URL: https://vagrantcloud.com/api/v2/vagrant/mykelalvis/fedora38base
The box you're attempting to add has no available version that
matches the constraints you requested. Please double-check your
settings. Also verify that if you specified version constraints,
that the provider you wish to use is available for these constraints.
Box: mykelalvis/fedora38base
Address: https://vagrantcloud.com/api/v2/vagrant/mykelalvis/fedora38base
Constraints: 0.0.1
Available versions: 0.0.1
PS C:\Users\mykel> vagrant box add --box-version 0.0.1 --architecture amd64 mykelalvis/fedora38base
==> box: Loading metadata for box 'mykelalvis/fedora38base'
box: URL: https://vagrantcloud.com/api/v2/vagrant/mykelalvis/fedora38base
==> box: Adding box 'mykelalvis/fedora38base' (v0.0.1) for provider: virtualbox (amd64)
box: Downloading: https://vagrantcloud.com/mykelalvis/boxes/fedora38base/versions/0.0.1/providers/virtualbox/amd64/vagrant.box
box:
==> box: Successfully added box 'mykelalvis/fedora38base' (v0.0.1) for 'virtualbox (amd64)'!
PS C:\Users\mykel>
I am using the vagrant-qemu plugin to run QEMU boxes on macOS.
I'd like the ability to generate Vagrant boxes for this provider, such as the one below, but at present, qemu
is not one of the allowable values for providers.
source "file" "fedora-coreos-qemu-aarch64" {
source = "../../artifacts/fcos-images/fedora-coreos-qemu.aarch64.qcow2"
target = "fedora-coreos-qemu.aarch64.qcow2"
}
build {
sources = ["file.fedora-coreos-qemu-aarch64"]
post-processors {
post-processor "vagrant" {
vagrantfile_template = "./qemu/Vagrantfile"
include = ["fedora-coreos-qemu.aarch64.qcow2"]
keep_input_artifact = false
provider_override = "qemu"
}
}
}
This fails on packer 1.9.2 with the following message:
Error: Failed preparing post-processor-block "vagrant" ""
on packer.pkr.hcl line 10:
(source code not available)
The given provider_override qemu is not valid. Please choose from one of docker,
digitalocean, azure, scaleway, libvirt, hyperv, parallels, google, lxc,
virtualbox, aws, vmware
file located at /etd/default/grub is overwritten when vagrant post-processor is executed
If a run my VM manually (I specified to do not remove my VM) my grub settings are correct.
If a run my box into vagrant, my grub settings are not set.
I don't know if that is caused by this plugin or vagrant itself. But for now I open an issue here.
Create an VM with VMWare Workstation Pro 16.2.1 build 18811642 (debian net install 11.1.0 in my case)
VMWare specific configuration:
vmx_data = {
"firmware" = "efi"
"vhv.enable" = "TRUE"
}
VMWare Workstation is configured with default hardware compatibility set to: Workstation 16.2.x
Part of my shell script that edit /etc/default/grub
echo " * Disable wait in grub menu"
sudo sed -i 's/^GRUB_TIMEOUT=5/GRUB_TIMEOUT=0/' /etc/default/grub > /dev/null
sudo echo "GRUB_HIDDEN_TIMEOUT=0" | sudo tee -a /etc/default/grub > /dev/null
sudo echo "GRUB_HIDDEN_TIMEOUT_QUIET=true" | sudo tee -a /etc/default/grub > /dev/null
sudo update-grub
Use vagrant post-processor this way
post-processor "vagrant" {
keep_input_artifact = true
output = "path/to/boxname.box"
}
Packer v1.7.8
Vagrant v2.2.19
packer {
required_plugins {
vmware = {
version = ">= 1.0.0"
source = "github.com/hashicorp/vmware"
}
vagrant = {
version = ">= 1.0.0"
source = "github.com/hashicorp/vagrant"
}
}
}
WIndows 10 Version 21H1 Build 19043.1348 (x64)
Packer and Vagrant are executed trough powershell 5.1.19041.1320
This issue was originally opened by @fsdrw08 in hashicorp/packer#11129 and has been migrated to this repository. The original issue description is below.
Please add Hyper-V configuration versions information in box.xml during vagrant post processor.
I found that even if we specify the configuration_version (https://www.packer.io/docs/builders/hyperv/iso#configuration_version) in packer template, with vagrant post-processor to build a vagrant box (which means as expect, it should be a lower configuration version Hyper-V VM box). But Vagrant up
this box will still create a VM in hyper-V with the latest configuration version .
After investigate Vagrant's related HYPER-V VM create script, I found that Vagrant will primary use the information from box.xml (under .vagrant.d\boxes\ <vm name>
\0\hyperv\Virtual Machines) as VM parameter to create a new VM with PowerShell CMDLET New-VM
. And if we don't specify the -Version
(VM configuration version) parameter in this New-VM
command, it will create the VM with the as latest as the host support version. e.g. in Win10 21H1, this command will create a 9.0 version VM without -version parameter.
My Request:
First, in packer vagrant post processor part:
Add Hyper-V configuration versions information in box.xml during vagrant post processor.
After first part, in vagrant up process part:
Improve vagrant hyper-v plug in script module "VagrantVM.psm" to let vagrant up a hyper-v vm box with it's own configuration version.
The purpose use case is vagrant up
a Hyper-V VM box as what the box original configuration version is.
Add Hyper-V configuration versions information in box.xml during vagrant post processor. The expect result like
<configuration>
<properties>
...
<version type="string">8.0</version>
</properties>
...
</configuration>
After box.xml improve, in vagrant up
process part:
add some script snippet to detect the box xml version node in https://github.com/hashicorp/vagrant/blob/5b501a3fb05ed0ab16cf10991b3df9d231edb5cf/plugins/providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 's New-VagrantVMXML function
something like insert below code in line 241
$Version = [string]($VMConfig.configuration.properties.version."#text")
# Version parameter in PS4 so validate before using
if((Get-Command Hyper-V\New-VM).Parameters.Keys.Contains("version")) {
$NewVMConfig.Version = $Version
}
I get an error "Post-processor failed: unexpected EOF" when trying to build a box from an existing libvirt kvm image.
I prebuild a kvm image with the qemu provider.
I tried to convert it with the vagrant post-processor but it fails. I have no problem building an image in one step but it doesn't work in two steps.
I used the example from the documentation using Artifice post-processor and overrode the provider.
I used :
I used the following configuration :
packer {
required_plugins {
vagrant = {
version = ">= 1.1.1"
source = "github.com/hashicorp/vagrant"
}
}
}
source "null" "fedora" {
communicator = "none"
}
build {
sources = [
"source.null.fedora"
]
post-processors {
post-processor "artifice" {
files = [
"packer_images/fedora_workstation.qcow2"
]
}
post-processor "vagrant" {
keep_input_artifact = true
provider_override = "libvirt"
}
}
}
I build on Fedora 38
null.fedora: output will be in this color.
==> null.fedora: Running post-processor: (type artifice)
==> null.fedora (artifice): Using these artifact files: packer_images/fedora_workstation.qcow2
==> null.fedora: Running post-processor: (type vagrant)
==> null.fedora (vagrant): Creating a dummy Vagrant box to ensure the host system can create one correctly
==> null.fedora (vagrant): Creating Vagrant box for 'libvirt' provider
Build 'null.fedora' errored after 42 milliseconds 317 microseconds: 1 error(s) occurred:
==> Wait completed after 42 milliseconds 507 microseconds
==> Some builds didn't complete successfully and had errors:
--> null.fedora: 1 error(s) occurred:
==> Builds finished but no artifacts were created.
panic: interface conversion: interface {} is nil, not string
2024/03/01 10:15:03 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin:
2024/03/01 10:15:03 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: goroutine 9 [running]:
2024/03/01 10:15:03 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: github.com/hashicorp/packer-plugin-vagrant/post-processor/vagrant.(*LibVirtProvider).Process(0x11215ee?, {0x1447508, 0xc0007be6f0}, {0x1447550, 0xc0006c2720}, {0xc0006a8000, 0x15})
2024/03/01 10:15:03 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: github.com/hashicorp/packer-plugin-vagrant/post-processor/vagrant/libvirt.go:71 +0x736
2024/03/01 10:15:03 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: github.com/hashicorp/packer-plugin-vagrant/post-processor/vagrant.(*PostProcessor).PostProcessProvider(0xc0006aa968?, {0xc0006aa968, 0x7}, {0x1441010, 0x1c6d1c8}, {0x1447508, 0xc0007be6f0}, {0x1447550, 0xc0006c2720})
2024/03/01 10:15:03 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: github.com/hashicorp/packer-plugin-vagrant/post-processor/vagrant/post-processor.go:176 +0xa7a
2024/03/01 10:15:03 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: github.com/hashicorp/packer-plugin-vagrant/post-processor/vagrant.(*PostProcessor).PostProcess(0xc0001b38c0, {0xc00019c010?, 0x0?}, {0x1447508, 0xc0007be6f0}, {0x1447550?, 0xc0006c2720?})
2024/03/01 10:15:03 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: github.com/hashicorp/packer-plugin-vagrant/post-processor/vagrant/post-processor.go:251 +0x154
2024/03/01 10:15:03 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: github.com/hashicorp/packer-plugin-sdk/rpc.(*PostProcessorServer).PostProcess(0xc0003ca100, 0x19cdc8?, 0xc00079a990)
2024/03/01 10:15:03 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: github.com/hashicorp/[email protected]/rpc/post_processor.go:111 +0x197
2024/03/01 10:15:03 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: reflect.Value.call({0xc0001a0a80?, 0xc00019e728?, 0x13?}, {0x1121686, 0x4}, {0xc0000b6ef8, 0x3, 0x3?})
2024/03/01 10:15:03 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: reflect/value.go:586 +0xb07
2024/03/01 10:15:03 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: reflect.Value.Call({0xc0001a0a80?, 0xc00019e728?, 0x8000000000000000?}, {0xc0002076f8?, 0x9?, 0x0?})
2024/03/01 10:15:03 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: reflect/value.go:370 +0xbc
2024/03/01 10:15:03 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: net/rpc.(*service).call(0xc0003ca140, 0x1128408?, 0x9?, 0xc00019c0a0, 0xc0006b0300, 0x9?, {0xf55f80?, 0xc00019cdb8?, 0x0?}, {0xf23e60, ...}, ...)
2024/03/01 10:15:03 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: net/rpc/server.go:382 +0x226
2024/03/01 10:15:03 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: created by net/rpc.(*Server).ServeCodec
2024/03/01 10:15:03 packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64 plugin: net/rpc/server.go:479 +0x3fe
2024/03/01 10:15:03 /home/jorge/.config/packer/plugins/github.com/hashicorp/vagrant/packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64: plugin process exited
2024/03/01 10:15:03 [INFO] (telemetry) ending vagrant
2024/03/01 10:15:03 ui error: Build 'null.fedora' errored after 42 milliseconds 317 microseconds: 1 error(s) occurred:
Post-processor failed: unexpected EOF
2024/03/01 10:15:03 ui:
==> Wait completed after 42 milliseconds 507 microseconds
2024/03/01 10:15:03 machine readable: error-count []string{"1"}
2024/03/01 10:15:03 ui error:
==> Some builds didn't complete successfully and had errors:
2024/03/01 10:15:03 machine readable: null.fedora,error []string{"1 error(s) occurred:\n\n* Post-processor failed: unexpected EOF"}
2024/03/01 10:15:03 ui error: --> null.fedora: 1 error(s) occurred:
Post-processor failed: unexpected EOF
2024/03/01 10:15:03 ui:
==> Builds finished but no artifacts were created.
2024/03/01 10:15:03 [INFO] (telemetry) Finalizing.
2024/03/01 10:15:03 waiting for all plugin processes to complete...
2024/03/01 10:15:03 /usr/bin/packer: plugin process exited
2024/03/01 10:15:03 /usr/bin/packer: plugin process exited
!!!!!!!!!!!!!!!!!!!!!!!!!!! PACKER CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!
Packer crashed! This is always indicative of a bug within Packer.
A crash log has been placed at "crash.log" relative to your current
working directory. It would be immensely helpful if you could please
report the crash with Packer1 so that we can fix this.
!!!!!!!!!!!!!!!!!!!!!!!!!!! PACKER CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!
This issue was originally opened by @ndench as hashicorp/packer#10876. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.
Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.
When using the vagrant builder, I'd like to be able to specify something like "box_update": true
to ensure that the build is always happening on the latest version of the source box. The ways of achieving this now are:
box_version
parameter -> this requires the user to check for the latest versions before every build and update their build file.force_add
parameter -> this will cause packer to always download the box, even when there is no new versionvagrant box update
manually before running packerBento boxes built by Chef, are very common base boxes and are update relatively regularly. By ensuring your build is on the latest version you will get the latest security patches.
You may also be building multiple vagrant boxes on top of each other (instead of using a third party base box). In which case, you likely want the latest version of your base box.
{
"builders": [
{
"communicator": "ssh",
"source_path": "hashicorp/precise64",
"provider": "virtualbox",
"add_force": true,
"type": "vagrant",
"box_update": true
}
]
}
vagrant package
has a --output NAME
option that allows setting the name of the output .box file.
Currently the Vagrant plugin for Packer hard-codes this to package.box
This will simplify the amount of out-of-packer processing required, when using the vagrant builder.
{
"output_name": "my-name-{{ user `version` }}.box"
}
first run of packer build .
fails, but succeeds if run after vagrant up
macos m1
w/ homebrew installedbrew install qemu
brew install --cask vagrant
vagrant plugin install vagrant-qemu
brew install packer
➜ packer --version
1.8.4
➜ vagrant plugin list
vagrant-qemu (0.3.3, global)
➜ vagrant --version
Vagrant 2.3.2
➜ brew install qemu
Warning: qemu 7.1.0 is already installed and up-to-date.
To reinstall 7.1.0, run:
brew reinstall qemu
➜ dart_vagrant git:(setup_packer) ✗ packer build .
vagrant.this: output will be in this color.
==> vagrant.this: Creating a Vagrantfile in the build directory...
==> vagrant.this: Adding box using vagrant box add ...
vagrant.this: (this can take some time if we need to download the box)
==> vagrant.this: Calling Vagrant Up (this can take some time)...
==> vagrant.this: destroying Vagrant box...
==> vagrant.this: Deleting output directory...
Build 'vagrant.this' errored after 5 minutes 31 seconds: error: SSH Port was not properly retrieved from SSHConfig.
==> Wait completed after 5 minutes 31 seconds
==> Some builds didn't complete successfully and had errors:
--> vagrant.this: error: SSH Port was not properly retrieved from SSHConfig.
==> Builds finished but no artifacts were created.
➜ vagrant init -m perk/ubuntu-2204-arm64
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
➜ vagrant up
The provider 'qemu' could not be found, but was requested to
back the machine 'default'. Please use a provider that exists.
Vagrant knows about the following providers: docker, hyperv, virtualbox
➜ vagrant plugin install vagrant-qemu
Installing the 'vagrant-qemu' plugin. This can take a few minutes...
Fetching vagrant-qemu-0.3.3.gem
Installed the plugin 'vagrant-qemu (0.3.3)'!
➜ vagrant up
Bringing machine 'default' up with 'qemu' provider...
==> default: Box 'perk/ubuntu-2204-arm64' could not be found. Attempting to find and install...
default: Box Provider: libvirt
default: Box Version: >= 0
==> default: Loading metadata for box 'perk/ubuntu-2204-arm64'
default: URL: https://vagrantcloud.com/perk/ubuntu-2204-arm64
==> default: Adding box 'perk/ubuntu-2204-arm64' (v20221101.1) for provider: libvirt
default: Downloading: https://vagrantcloud.com/perk/boxes/ubuntu-2204-arm64/versions/20221101.1/providers/libvirt.box
default: Calculating and comparing box checksum...
==> default: Successfully added box 'perk/ubuntu-2204-arm64' (v20221101.1) for 'libvirt'!
==> default: Checking if box 'perk/ubuntu-2204-arm64' version '20221101.1' is up to date...
==> default: Importing a QEMU instance
default: Creating and registering the VM...
default: Successfully imported VM
==> default: Warning! The QEMU provider doesn't support any of the Vagrant
==> default: high-level network configurations (`config.vm.network`). They
==> default: will be silently ignored.
==> default: Starting the instance...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:50022
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
➜ vagrant ssh
Welcome to Ubuntu 22.04.1 LTS (GNU/Linux 5.15.0-52-generic aarch64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Fri Nov 11 12:09:54 UTC 2022
System load: 0.0
Usage of /: 2.4% of 61.84GB
Memory usage: 4%
Swap usage: 0%
Processes: 95
Users logged in: 0
IPv4 address for eth0: 10.0.2.15
IPv6 address for eth0: fec0::5054:ff:fe12:3456
0 updates can be applied immediately.
The list of available updates is more than a week old.
To check for new updates run: sudo apt update
vagrant@ubuntu:~$ exit
logout
➜ vagrant destroy -f
==> default: Stopping the instance...
==> default: Destroying the instance...
➜ packer build .
vagrant.this: output will be in this color.
==> vagrant.this: Creating a Vagrantfile in the build directory...
==> vagrant.this: Adding box using vagrant box add ...
vagrant.this: (this can take some time if we need to download the box)
==> vagrant.this: Calling Vagrant Up (this can take some time)...
==> vagrant.this: Using SSH communicator to connect: 127.0.0.1
==> vagrant.this: Waiting for SSH to become available...
==> vagrant.this: Connected to SSH!
==> vagrant.this: Packaging box...
==> vagrant.this: destroying Vagrant box...
Build 'vagrant.this' finished after 7 minutes 22 seconds.
==> Wait completed after 7 minutes 22 seconds
==> Builds finished. The artifacts of successful builds are:
--> vagrant.this: Vagrant box 'package.box' for 'qemu' provider
➜ packer --version
1.8.4
vagrant = {
version = ">= 1.0.2"
source = "github.com/hashicorp/vagrant"
}
packer{
required_plugins {
# see https://github.com/hashicorp/packer-plugin-vagrant
vagrant = {
version = ">= 1.0.2"
source = "github.com/hashicorp/vagrant"
}
}
}
source "vagrant" "this" {
communicator = "ssh"
# see https://app.vagrantup.com/perk/boxes/ubuntu-2204-arm64
source_path = "perk/ubuntu-2204-arm64"
provider = "qemu"
add_force = true
}
build {
sources = [
"source.vagrant.this"
]
}
'c. [email protected]
,xNMM. ---------------------------
.OMMMMo OS: macOS 13.0.1 22A400 arm64
OMMM0, Host: MacBookAir10,1
.;loddo:' loolloddol;. Kernel: 22.1.0
cKMMMMMMMMMMNWMMMMMMMMMM0: Uptime: 1 hour, 47 mins
.KMMMMMMMMMMMMMMMMMMMMMMMWd. Packages: 89 (brew)
XMMMMMMMMMMMMMMMMMMMMMMMX. Shell: zsh 5.8.1
;MMMMMMMMMMMMMMMMMMMMMMMM: Resolution: 1440x900
:MMMMMMMMMMMMMMMMMMMMMMMM: DE: Aqua
.MMMMMMMMMMMMMMMMMMMMMMMMX. WM: Quartz Compositor
kMMMMMMMMMMMMMMMMMMMMMMMMWd. WM Theme: Blue (Dark)
.XMMMMMMMMMMMMMMMMMMMMMMMMMMk Terminal: iTerm2
.XMMMMMMMMMMMMMMMMMMMMMMMMK. Terminal Font: Monaco 12
kMMMMMMMMMMMMMMMMMMMMMMd CPU: Apple M1
;KMMMMMMMWXXWMMMMMMMk. GPU: Apple M1
.cooc,. .,coo:. Memory: 1187MiB / 8192MiB
This issue was originally opened by @thetimmorland in hashicorp/packer#11334 and has been migrated to this repository. The original issue description is below.
When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.
See logs below:
$ packer build -force qvex-dev.json
vagrant: output will be in this color.
==> vagrant: Creating a Vagrantfile in the build directory...
==> vagrant: Adding box using vagrant box add ...
vagrant: (this can take some time if we need to download the box)
==> vagrant: Calling Vagrant Up (this can take some time)...
==> vagrant: Using SSH communicator to connect: 127.0.0.1
==> vagrant: Waiting for SSH to become available...
==> vagrant: Error waiting for SSH: Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
==> vagrant: destroying Vagrant box...
==> vagrant: Deleting output directory...
Build 'vagrant' errored after 2 minutes 22 seconds: Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
==> Wait completed after 2 minutes 22 seconds
==> Some builds didn't complete successfully and had errors:
--> vagrant: Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
From packer version
$ packer --version
1.7.6
$ cat qvex-dev.json
{
"builders": [
{
"communicator": "ssh",
"source_path": "archlinux/archlinux",
"provider": "virtualbox",
"add_force": true,
"type": "vagrant"
}
],
"provisioners": [
{
"type": "shell",
"script": "install.sh"
}
]
}
Windows 10 x86_64
N/A
Packer build succeeds but no output file is created
Also reported here - https://discuss.hashicorp.com/t/vagrant-builder-does-not-create-packag-box/60690
just running packer build using vagrant builder
Plugin version - packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe
From packer version
- Packer v1.10.0
OS - Windows 10
Architecture - x64
Packer log
2024/02/03 07:04:15 [INFO] Packer version: 1.10.0 [go1.20.11 windows amd64]
2024/02/03 07:04:15 [TRACE] discovering plugins in C:\Users<replaced>\AppData\Roaming\packer.d\plugins
2024/02/03 07:04:15 [INFO] Discovered potential plugin: hyperv = C:\Users<replaced>\AppData\Roaming\packer.d\plugins\github.com\hashicorp\hyperv\packer-plugin-hyperv_v1.1.1_x5.0_windows_amd64.exe
2024/02/03 07:04:15 [INFO] Discovered potential plugin: vagrant = C:\Users<replaced>\AppData\Roaming\packer.d\plugins\github.com\hashicorp\vagrant\packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe
2024/02/03 07:04:15 [INFO] found external [iso vmcx] builders from hyperv plugin
2024/02/03 07:04:15 [INFO] found external [-packer-default-plugin-name-] builders from vagrant plugin
2024/02/03 07:04:15 [INFO] found external [-packer-default-plugin-name- cloud] post-processors from vagrant plugin
2024/02/03 07:04:15 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2024/02/03 07:04:15 [INFO] PACKER_CONFIG env var set; attempting to open config file: C:\Users<replaced>\AppData\Roaming\packer.config
2024/02/03 07:04:15 [WARN] Config file doesn't exist: C:\Users<replaced>\AppData\Roaming\packer.config
2024/02/03 07:04:15 [INFO] Setting cache directory: D:\imgFactory\packer_cache
e: cannot determine if process is in background: Process background check error: not implemented yet
2024/02/03 07:04:15 [INFO] Starting external plugin C:\Users<replaced>\AppData\Roaming\packer.d\plugins\github.com\hashicorp\vagrant\packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe start builder -packer-default-plugin-name-
2024/02/03 07:04:15 Starting plugin: C:\Users<replaced>\AppData\Roaming\packer.d\plugins\github.com\hashicorp\vagrant\packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe []string{"C:\Users\\AppData\Roaming\packer.d\plugins\github.com\hashicorp\vagrant\packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe", "start", "builder", "-packer-default-plugin-name-"}
2024/02/03 07:04:15 Waiting for RPC address for: C:\Users<replaced>\AppData\Roaming\packer.d\plugins\github.com\hashicorp\vagrant\packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe
2024/02/03 07:04:15 [ERR] Checkpoint error: Get "https://checkpoint-api.hashicorp.com/v1/check/packer?arch=amd64&os=windows&signature=1ce833eb-aff5-3e31-1314-967d9ac5eb8d&version=1.10.0": dial tcp: lookup checkpoint-api.hashicorp.com: no such host
2024/02/03 07:04:16 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:16 Plugin port range: [10000,25000]
2024/02/03 07:04:16 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:16 Plugin address: tcp 127.0.0.1:10000
2024/02/03 07:04:16 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:16 Waiting for connection...
2024/02/03 07:04:16 Received tcp RPC address for C:\Users<replaced>\AppData\Roaming\packer.d\plugins\github.com\hashicorp\vagrant\packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe: addr is 127.0.0.1:10000
2024/02/03 07:04:16 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:16 Serving a plugin connection...
2024/02/03 07:04:16 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:16 [TRACE] starting builder -packer-default-plugin-name-
2024/02/03 07:04:16 [INFO] Starting internal plugin packer-provisioner-file
2024/02/03 07:04:16 Starting plugin: C:\ProgramData\chocolatey\lib\packer\tools\packer.exe []string{"C:\ProgramData\chocolatey\lib\packer\tools\packer.exe", "plugin", "packer-provisioner-file"}
2024/02/03 07:04:16 Waiting for RPC address for: C:\ProgramData\chocolatey\lib\packer\tools\packer.exe
2024/02/03 07:04:16 packer.exe plugin: [INFO] Packer version: 1.10.0 [go1.20.11 windows amd64]
2024/02/03 07:04:16 packer.exe plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2024/02/03 07:04:16 packer.exe plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: C:\Users<replaced>\AppData\Roaming\packer.config
2024/02/03 07:04:16 packer.exe plugin: [WARN] Config file doesn't exist: C:\Users<replaced>\AppData\Roaming\packer.config
2024/02/03 07:04:16 packer.exe plugin: [INFO] Setting cache directory: D:\imgFactory\packer_cache
2024/02/03 07:04:16 packer.exe plugin: args: []string{"packer-provisioner-file"}
2024/02/03 07:04:16 packer.exe plugin: Plugin port range: [10000,25000]
2024/02/03 07:04:16 packer.exe plugin: Plugin address: tcp 127.0.0.1:10000
2024/02/03 07:04:16 packer.exe plugin: Waiting for connection...
2024/02/03 07:04:16 Received tcp RPC address for C:\ProgramData\chocolatey\lib\packer\tools\packer.exe: addr is 127.0.0.1:10000
2024/02/03 07:04:16 packer.exe plugin: [ERR] Checkpoint error: Get "https://checkpoint-api.hashicorp.com/v1/check/packer?arch=amd64&os=windows&signature=1ce833eb-aff5-3e31-1314-967d9ac5eb8d&version=1.10.0": dial tcp: lookup checkpoint-api.hashicorp.com: no such host
2024/02/03 07:04:16 packer.exe plugin: Serving a plugin connection...
2024/02/03 07:04:16 [INFO] Starting internal plugin packer-provisioner-windows-shell
2024/02/03 07:04:16 Starting plugin: C:\ProgramData\chocolatey\lib\packer\tools\packer.exe []string{"C:\ProgramData\chocolatey\lib\packer\tools\packer.exe", "plugin", "packer-provisioner-windows-shell"}
2024/02/03 07:04:16 Waiting for RPC address for: C:\ProgramData\chocolatey\lib\packer\tools\packer.exe
2024/02/03 07:04:16 packer.exe plugin: [INFO] Packer version: 1.10.0 [go1.20.11 windows amd64]
2024/02/03 07:04:16 packer.exe plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2024/02/03 07:04:16 packer.exe plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: C:\Users<replaced>\AppData\Roaming\packer.config
2024/02/03 07:04:16 packer.exe plugin: [WARN] Config file doesn't exist: C:\Users<replaced>\AppData\Roaming\packer.config
2024/02/03 07:04:16 packer.exe plugin: [INFO] Setting cache directory: D:\imgFactory\packer_cache
2024/02/03 07:04:16 packer.exe plugin: args: []string{"packer-provisioner-windows-shell"}
2024/02/03 07:04:16 packer.exe plugin: Plugin port range: [10000,25000]
2024/02/03 07:04:16 packer.exe plugin: Plugin address: tcp 127.0.0.1:10000
2024/02/03 07:04:16 Received tcp RPC address for C:\ProgramData\chocolatey\lib\packer\tools\packer.exe: addr is 127.0.0.1:10000
2024/02/03 07:04:16 packer.exe plugin: Waiting for connection...
2024/02/03 07:04:16 packer.exe plugin: [ERR] Checkpoint error: Get "https://checkpoint-api.hashicorp.com/v1/check/packer?arch=amd64&os=windows&signature=1ce833eb-aff5-3e31-1314-967d9ac5eb8d&version=1.10.0": dial tcp: lookup checkpoint-api.hashicorp.com: no such host
2024/02/03 07:04:16 packer.exe plugin: Serving a plugin connection...
2024/02/03 07:04:16 [INFO] Starting internal plugin packer-provisioner-windows-restart
2024/02/03 07:04:16 Starting plugin: C:\ProgramData\chocolatey\lib\packer\tools\packer.exe []string{"C:\ProgramData\chocolatey\lib\packer\tools\packer.exe", "plugin", "packer-provisioner-windows-restart"}
2024/02/03 07:04:16 Waiting for RPC address for: C:\ProgramData\chocolatey\lib\packer\tools\packer.exe
2024/02/03 07:04:16 packer.exe plugin: [INFO] Packer version: 1.10.0 [go1.20.11 windows amd64]
2024/02/03 07:04:16 packer.exe plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2024/02/03 07:04:16 packer.exe plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: C:\Users<replaced>\AppData\Roaming\packer.config
2024/02/03 07:04:16 packer.exe plugin: [WARN] Config file doesn't exist: C:\Users<replaced>\AppData\Roaming\packer.config
2024/02/03 07:04:16 packer.exe plugin: [INFO] Setting cache directory: D:\imgFactory\packer_cache
2024/02/03 07:04:16 packer.exe plugin: args: []string{"packer-provisioner-windows-restart"}
2024/02/03 07:04:16 packer.exe plugin: Plugin port range: [10000,25000]
2024/02/03 07:04:16 packer.exe plugin: Plugin address: tcp 127.0.0.1:10000
2024/02/03 07:04:16 packer.exe plugin: Waiting for connection...
2024/02/03 07:04:16 Received tcp RPC address for C:\ProgramData\chocolatey\lib\packer\tools\packer.exe: addr is 127.0.0.1:10000
2024/02/03 07:04:16 packer.exe plugin: [ERR] Checkpoint error: Get "https://checkpoint-api.hashicorp.com/v1/check/packer?arch=amd64&os=windows&signature=1ce833eb-aff5-3e31-1314-967d9ac5eb8d&version=1.10.0": dial tcp: lookup checkpoint-api.hashicorp.com: no such host
2024/02/03 07:04:16 packer.exe plugin: Serving a plugin connection...
2024/02/03 07:04:16 ui: vagrant.vs2022: output will be in this color.
2024/02/03 07:04:16 ui:
2024/02/03 07:04:16 Build debug mode: false
2024/02/03 07:04:16 Force build: true
2024/02/03 07:04:16 On error:
2024/02/03 07:04:16 Waiting on builds to complete...
2024/02/03 07:04:16 Starting build run: vagrant.vs2022
2024/02/03 07:04:16 Running builder:
2024/02/03 07:04:16 [INFO] (telemetry) Starting builder vagrant.vs2022
2024/02/03 07:04:16 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:16 Calling Vagrant CLI: []string{"--version"}
2024/02/03 07:04:16 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:16 [vagrant driver] stdout: Vagrant 2.4.1
2024/02/03 07:04:16 ui: ==> vagrant.vs2022: Deleting previous output directory...
2024/02/03 07:04:16 ui: ==> vagrant.vs2022: Creating a Vagrantfile in the build directory...
2024/02/03 07:04:16 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:16 Created vagrantfile at D:\imgFactory\output-vs2022\Vagrantfile
2024/02/03 07:04:16 ui: ==> vagrant.vs2022: Adding box using vagrant box add ...
2024/02/03 07:04:16 ui: vagrant.vs2022: (this can take some time if we need to download the box)
2024/02/03 07:04:16 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:16 [vagrant] Calling box add with following args win10-base --force --provider hyperv
2024/02/03 07:04:16 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:16 Calling Vagrant CLI: []string{"box", "add", "win10-base", "--force", "--provider", "hyperv"}
2024/02/03 07:04:18 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:18 [vagrant driver] stdout: ==> box: Box file was not detected as metadata. Adding it directly...
2024/02/03 07:04:18 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:18 [vagrant driver] stderr: A name is required when adding a box file directly. Please pass
2024/02/03 07:04:18 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:18 [vagrant driver] stderr: the--name
parameter tovagrant box add
. See
2024/02/03 07:04:18 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:18 [vagrant driver] stderr:vagrant box add -h
for more help.
2024/02/03 07:04:19 ui: ==> vagrant.vs2022: Calling Vagrant Up (this can take some time)...
2024/02/03 07:04:19 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:19 Calling Vagrant CLI: []string{"up", "source", "--provider=hyperv"}
2024/02/03 07:04:22 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:22 [vagrant driver] stdout: Bringing machine 'source' up with 'hyperv' provider...
2024/02/03 07:04:22 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:22 [vagrant driver] stdout: ==> source: Verifying Hyper-V is enabled...
2024/02/03 07:04:22 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:22 [vagrant driver] stdout: ==> source: Verifying Hyper-V is accessible...
2024/02/03 07:04:23 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:23 [vagrant driver] stdout: ==> source: Importing a Hyper-V instance
2024/02/03 07:04:23 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:23 [vagrant driver] stdout: source: Creating and registering the VM...
2024/02/03 07:04:34 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:34 [vagrant driver] stdout: source: Successfully imported VM
2024/02/03 07:04:36 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:36 [vagrant driver] stdout: source: Configuring the VM...
2024/02/03 07:04:37 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:37 [vagrant driver] stdout: source: Setting VM Enhanced session transport type to disabled/default (VMBus)
2024/02/03 07:04:38 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:38 [vagrant driver] stdout: ==> source: Starting the machine...
2024/02/03 07:04:43 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:43 [vagrant driver] stdout: ==> source: Waiting for the machine to report its IP address...
2024/02/03 07:04:43 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:43 [vagrant driver] stdout: source: Timeout: 120 seconds
2024/02/03 07:04:44 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:44 [vagrant driver] stdout: source: IP: 192.168.0.10
2024/02/03 07:04:44 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:44 [vagrant driver] stdout: ==> source: Waiting for machine to boot. This may take a few minutes...
2024/02/03 07:04:46 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:46 [vagrant driver] stdout: source: SSH address: 192.168.0.10:22
2024/02/03 07:04:46 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:46 [vagrant driver] stdout: source: SSH username: IIF9FE
2024/02/03 07:04:46 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:46 [vagrant driver] stdout: source: SSH auth method: private key
2024/02/03 07:04:52 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:52 [vagrant driver] stderr: The configured shell (config.ssh.shell) is invalid and unable
2024/02/03 07:04:52 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:52 [vagrant driver] stderr: to properly execute commands. The most common cause for this is
2024/02/03 07:04:52 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:52 [vagrant driver] stderr: using a shell that is unavailable on the system. Please verify
2024/02/03 07:04:52 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:52 [vagrant driver] stderr: you're using the full path to the shell and that the shell is
2024/02/03 07:04:52 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:52 [vagrant driver] stderr: executable by the SSH user.
2024/02/03 07:04:52 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:52 Calling Vagrant CLI: []string{"ssh-config", "source"}
2024/02/03 07:04:59 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:59 [vagrant driver] stdout: Host source
2024/02/03 07:04:59 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:59 [vagrant driver] stdout: HostName 192.168.0.10
2024/02/03 07:04:59 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:59 [vagrant driver] stdout: User IIF9FE
2024/02/03 07:04:59 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:59 [vagrant driver] stdout: Port 22
2024/02/03 07:04:59 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:59 [vagrant driver] stdout: UserKnownHostsFile /dev/null
2024/02/03 07:04:59 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:59 [vagrant driver] stdout: StrictHostKeyChecking no
2024/02/03 07:04:59 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:59 [vagrant driver] stdout: PasswordAuthentication no
2024/02/03 07:04:59 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:59 [vagrant driver] stdout: IdentityFile C:/Users//.ssh/id_ed25519
2024/02/03 07:04:59 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:59 [vagrant driver] stdout: IdentitiesOnly yes
2024/02/03 07:04:59 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:59 [vagrant driver] stdout: LogLevel FATAL
2024/02/03 07:04:59 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:59 [vagrant driver] stdout: PubkeyAcceptedKeyTypes +ssh-rsa
2024/02/03 07:04:59 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:59 [vagrant driver] stdout: HostKeyAlgorithms +ssh-rsa
2024/02/03 07:04:59 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:04:59 [vagrant driver] stdout:
2024/02/03 07:05:00 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:00 Overriding SSH config from Vagrant with the username, password, and private key information provided to the Packer template.
2024/02/03 07:05:00 ui: ==> vagrant.vs2022: Using SSH communicator to connect: 192.168.0.10
2024/02/03 07:05:00 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:00 [INFO] Waiting for SSH, up to timeout: 6h0m0s
2024/02/03 07:05:00 ui: ==> vagrant.vs2022: Waiting for SSH to become available...
2024/02/03 07:05:00 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:00 [INFO] Attempting SSH connection to 192.168.0.10:22...
2024/02/03 07:05:00 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:00 [DEBUG] reconnecting to TCP connection for SSH
2024/02/03 07:05:00 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:00 [DEBUG] handshaking with SSH
2024/02/03 07:05:00 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:00 [DEBUG] handshake complete!
2024/02/03 07:05:00 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:00 [INFO] no local agent socket, will not connect agent
2024/02/03 07:05:00 ui: ==> vagrant.vs2022: Connected to SSH!
2024/02/03 07:05:00 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:00 Running the provision hook
2024/02/03 07:05:00 [INFO] (telemetry) Starting provisioner file
2024/02/03 07:05:00 ui: ==> vagrant.vs2022: Uploading C:\Users<replaced>\Downloads\dotnet-sdk-8.0.101-win-x64.exe => C:\Users\IIF9FE\dotnet-sdk-8.0.101-win-x64.exe
2024/02/03 07:05:00 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:00 [DEBUG] Opening new ssh session
2024/02/03 07:05:00 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:00 [DEBUG] Starting remote scp process: scp -vt C:/Users/IIF9FE
2024/02/03 07:05:00 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:00 [DEBUG] Started SCP session, beginning transfers...
2024/02/03 07:05:00 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:00 [DEBUG] scp: Uploading dotnet-sdk-8.0.101-win-x64.exe: perms=C0666 size=221616848
2024/02/03 07:05:03 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:03 [DEBUG] SCP session complete, closing stdin pipe.
2024/02/03 07:05:03 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:03 [DEBUG] Waiting for SSH session to complete.
2024/02/03 07:05:03 packer.exe plugin: [INFO] 221616848 bytes written for 'uploadData'
2024/02/03 07:05:03 [INFO] 221616848 bytes written for 'uploadData'
2024/02/03 07:05:03 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:03 [DEBUG] scp stderr (length 97): Sink: C0666 221616848 dotnet-sdk-8.0.101-win-x64.exe
2024/02/03 07:05:03 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: scp.exe: debug1: fd 0 clearing O_NONBLOCK
2024/02/03 07:05:03 packer.exe plugin: closing
2024/02/03 07:05:03 closing
2024/02/03 07:05:03 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:03 closing
2024/02/03 07:05:03 [INFO] (telemetry) ending file
2024/02/03 07:05:03 [INFO] (telemetry) Starting provisioner windows-shell
2024/02/03 07:05:03 ui: ==> vagrant.vs2022: Provisioning with windows-shell...
2024/02/03 07:05:03 packer.exe plugin: Found command: C:\Users\IIF9FE\dotnet-sdk-8.0.101-win-x64.exe /install /quiet /norestart
2024/02/03 07:05:03 ui: ==> vagrant.vs2022: Provisioning with shell script: C:\Users<replaced>\AppData\Local\Temp\windows-shell-provisioner1997105920
2024/02/03 07:05:03 packer.exe plugin: Opening C:\Users<replaced>\AppData\Local\Temp\windows-shell-provisioner1997105920 for reading
2024/02/03 07:05:03 packer.exe plugin: [INFO] 74 bytes written for 'uploadData'
2024/02/03 07:05:03 [INFO] 74 bytes written for 'uploadData'
2024/02/03 07:05:03 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:03 [DEBUG] Opening new ssh session
2024/02/03 07:05:03 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:03 [DEBUG] Starting remote scp process: scp -vt c:/Windows/Temp
2024/02/03 07:05:03 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:03 [DEBUG] Started SCP session, beginning transfers...
2024/02/03 07:05:03 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:03 [DEBUG] Copying input data into temporary file so we can read the length
2024/02/03 07:05:03 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:03 [DEBUG] scp: Uploading script.bat: perms=C0644 size=74
2024/02/03 07:05:03 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:03 [DEBUG] SCP session complete, closing stdin pipe.
2024/02/03 07:05:03 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:03 [DEBUG] Waiting for SSH session to complete.
2024/02/03 07:05:03 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:03 [DEBUG] scp stderr (length 70): Sink: C0644 74 script.bat
2024/02/03 07:05:03 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: scp.exe: debug1: fd 0 clearing O_NONBLOCK
2024/02/03 07:05:03 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:03 [DEBUG] Opening new ssh session
2024/02/03 07:05:03 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:03 [DEBUG] starting remote command: set "PACKER_BUILDER_TYPE=vagrant" && set "PACKER_BUILD_NAME=vs2022" && "c:/Windows/Temp/script.bat"
2024/02/03 07:05:03 ui: vagrant.vs2022:
2024/02/03 07:05:03 ui: vagrant.vs2022: iif9fe@VM-IMG123 C:\Users\IIF9FE>C:\Users\IIF9FE\dotnet-sdk-8.0.101-win-x64.exe /install /quiet /norestart
2024/02/03 07:05:39 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:39 [INFO] RPC endpoint: Communicator ended with: 0
2024/02/03 07:05:39 [INFO] 0 bytes written for 'stderr'
2024/02/03 07:05:39 [INFO] 111 bytes written for 'stdout'
2024/02/03 07:05:39 [INFO] RPC client: Communicator ended with: 0
2024/02/03 07:05:39 [INFO] RPC endpoint: Communicator ended with: 0
2024/02/03 07:05:39 packer.exe plugin: [INFO] 111 bytes written for 'stdout'
2024/02/03 07:05:39 packer.exe plugin: [INFO] 0 bytes written for 'stderr'
2024/02/03 07:05:39 packer.exe plugin: [INFO] RPC client: Communicator ended with: 0
2024/02/03 07:05:39 [INFO] (telemetry) ending windows-shell
2024/02/03 07:05:39 [INFO] (telemetry) Starting provisioner windows-restart
2024/02/03 07:05:39 ui: ==> vagrant.vs2022: Restarting Machine
2024/02/03 07:05:39 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:39 [DEBUG] Opening new ssh session
2024/02/03 07:05:39 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:39 [DEBUG] starting remote command: shutdown /r /f /t 0 /c "packer restart"
2024/02/03 07:05:39 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:39 [INFO] RPC endpoint: Communicator ended with: 0
2024/02/03 07:05:39 [INFO] 0 bytes written for 'stdout'
2024/02/03 07:05:39 [INFO] 0 bytes written for 'stderr'
2024/02/03 07:05:39 [INFO] RPC client: Communicator ended with: 0
2024/02/03 07:05:39 [INFO] RPC endpoint: Communicator ended with: 0
2024/02/03 07:05:39 packer.exe plugin: [INFO] 0 bytes written for 'stderr'
2024/02/03 07:05:39 packer.exe plugin: [INFO] 0 bytes written for 'stdout'
2024/02/03 07:05:39 packer.exe plugin: [INFO] RPC client: Communicator ended with: 0
2024/02/03 07:05:39 ui: ==> vagrant.vs2022: Waiting for machine to restart...
2024/02/03 07:05:39 packer.exe plugin: Check if machine is rebooting...
2024/02/03 07:05:39 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:39 [DEBUG] Opening new ssh session
2024/02/03 07:05:39 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:39 [DEBUG] starting remote command: shutdown /r /f /t 60 /c "packer restart test"
2024/02/03 07:05:39 ui error: ==> vagrant.vs2022: A system shutdown is in progress.(1115)
2024/02/03 07:05:39 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:39 [ERROR] Remote command exited with '1115': shutdown /r /f /t 60 /c "packer restart test"
2024/02/03 07:05:39 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:39 [INFO] RPC endpoint: Communicator ended with: 1115
2024/02/03 07:05:39 [INFO] 0 bytes written for 'stdout'
2024/02/03 07:05:39 [INFO] 40 bytes written for 'stderr'
2024/02/03 07:05:39 [INFO] RPC client: Communicator ended with: 1115
2024/02/03 07:05:39 [INFO] RPC endpoint: Communicator ended with: 1115
2024/02/03 07:05:39 packer.exe plugin: [INFO] 0 bytes written for 'stdout'
2024/02/03 07:05:39 packer.exe plugin: [INFO] 40 bytes written for 'stderr'
2024/02/03 07:05:39 packer.exe plugin: [INFO] RPC client: Communicator ended with: 1115
2024/02/03 07:05:39 packer.exe plugin: Reboot already in progress, waiting...
2024/02/03 07:05:49 packer.exe plugin: Check if machine is rebooting...
2024/02/03 07:05:49 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:49 [DEBUG] Opening new ssh session
2024/02/03 07:05:49 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:49 [ERROR] ssh session open error: 'read tcp 192.168.0.1:25486->192.168.0.10:22: wsarecv: An existing connection was forcibly closed by the remote host.', attempting reconnect
2024/02/03 07:05:49 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:49 [DEBUG] reconnecting to TCP connection for SSH
2024/02/03 07:05:52 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:52 [DEBUG] handshaking with SSH
2024/02/03 07:05:52 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:52 [DEBUG] handshake complete!
2024/02/03 07:05:52 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:52 [INFO] no local agent socket, will not connect agent
2024/02/03 07:05:53 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:53 [DEBUG] starting remote command: shutdown /r /f /t 60 /c "packer restart test"
2024/02/03 07:05:53 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:53 [INFO] RPC endpoint: Communicator ended with: 0
2024/02/03 07:05:53 [INFO] 0 bytes written for 'stdout'
2024/02/03 07:05:53 [INFO] 0 bytes written for 'stderr'
2024/02/03 07:05:53 [INFO] RPC client: Communicator ended with: 0
2024/02/03 07:05:53 [INFO] RPC endpoint: Communicator ended with: 0
2024/02/03 07:05:53 packer.exe plugin: [INFO] 0 bytes written for 'stderr'
2024/02/03 07:05:53 packer.exe plugin: [INFO] 0 bytes written for 'stdout'
2024/02/03 07:05:53 packer.exe plugin: [INFO] RPC client: Communicator ended with: 0
2024/02/03 07:05:53 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:53 [DEBUG] Opening new ssh session
2024/02/03 07:05:53 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:53 [DEBUG] starting remote command: shutdown /a
2024/02/03 07:05:53 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:53 [INFO] RPC endpoint: Communicator ended with: 0
2024/02/03 07:05:53 [INFO] 0 bytes written for 'stdout'
2024/02/03 07:05:53 [INFO] 0 bytes written for 'stderr'
2024/02/03 07:05:53 [INFO] RPC client: Communicator ended with: 0
2024/02/03 07:05:53 [INFO] RPC endpoint: Communicator ended with: 0
2024/02/03 07:05:53 packer.exe plugin: [INFO] 0 bytes written for 'stdout'
2024/02/03 07:05:53 packer.exe plugin: [INFO] 0 bytes written for 'stderr'
2024/02/03 07:05:53 packer.exe plugin: [INFO] RPC client: Communicator ended with: 0
2024/02/03 07:05:53 packer.exe plugin: Waiting for machine to become available...
2024/02/03 07:05:53 packer.exe plugin: Checking that communicator is connected with: 'powershell.exe -EncodedCommand JABQAHIAbwBnAHIAZQBzAHMAUAByAGUAZgBlAHIAZQBuAGMAZQAgAD0AIAAnAFMAaQBsAGUAbgB0AGwAeQBDAG8AbgB0AGkAbgB1AGUAJwA7AGUAYwBoAG8AIAAoACIAewAwAH0AIAByAGUAcwB0AGEAcgB0AGUAZAAuACIAIAAtAGYAIABbAFMAeQBzAHQAZQBtAC4ATgBlAHQALgBEAG4AcwBdADoAOgBHAGUAdABIAG8AcwB0AE4AYQBtAGUAKAApACkA'
2024/02/03 07:05:53 packer.exe plugin: Waiting for machine to reboot with timeout: 5m0s
2024/02/03 07:05:58 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:58 [DEBUG] Opening new ssh session
2024/02/03 07:05:58 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:05:58 [DEBUG] starting remote command: powershell.exe -EncodedCommand JABQAHIAbwBnAHIAZQBzAHMAUAByAGUAZgBlAHIAZQBuAGMAZQAgAD0AIAAnAFMAaQBsAGUAbgB0AGwAeQBDAG8AbgB0AGkAbgB1AGUAJwA7AGUAYwBoAG8AIAAoACIAewAwAH0AIAByAGUAcwB0AGEAcgB0AGUAZAAuACIAIAAtAGYAIABbAFMAeQBzAHQAZQBtAC4ATgBlAHQALgBEAG4AcwBdADoAOgBHAGUAdABIAG8AcwB0AE4AYQBtAGUAKAApACkA
2024/02/03 07:06:02 ui: vagrant.vs2022: VM-Img123 restarted.
2024/02/03 07:06:02 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:06:02 [INFO] RPC endpoint: Communicator ended with: 0
2024/02/03 07:06:02 [INFO] 0 bytes written for 'stderr'
2024/02/03 07:06:02 [INFO] 22 bytes written for 'stdout'
2024/02/03 07:06:02 [INFO] RPC client: Communicator ended with: 0
2024/02/03 07:06:02 [INFO] RPC endpoint: Communicator ended with: 0
2024/02/03 07:06:02 packer.exe plugin: [INFO] 22 bytes written for 'stdout'
2024/02/03 07:06:02 packer.exe plugin: [INFO] 0 bytes written for 'stderr'
2024/02/03 07:06:02 packer.exe plugin: [INFO] RPC client: Communicator ended with: 0
2024/02/03 07:06:02 ui: ==> vagrant.vs2022: Machine successfully restarted, moving on
2024/02/03 07:06:02 [INFO] (telemetry) ending windows-restart
2024/02/03 07:06:02 ui: ==> vagrant.vs2022: Packaging box...
2024/02/03 07:06:02 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:06:02 Calling Vagrant CLI: []string{"package", "source", "--output", "package.box"}
2024/02/03 07:06:07 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:06:07 [vagrant driver] stdout: ==> source: Verifying Hyper-V is enabled...
2024/02/03 07:06:09 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:06:09 [vagrant driver] stdout: ==> source: Attempting graceful shutdown of VM...
2024/02/03 07:06:11 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:06:11 [vagrant driver] stderr: The configured shell (config.ssh.shell) is invalid and unable
2024/02/03 07:06:11 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:06:11 [vagrant driver] stderr: to properly execute commands. The most common cause for this is
2024/02/03 07:06:11 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:06:11 [vagrant driver] stderr: using a shell that is unavailable on the system. Please verify
2024/02/03 07:06:11 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:06:11 [vagrant driver] stderr: you're using the full path to the shell and that the shell is
2024/02/03 07:06:11 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:06:11 [vagrant driver] stderr: executable by the SSH user.
2024/02/03 07:06:11 ui: ==> vagrant.vs2022: destroying Vagrant box...
2024/02/03 07:06:11 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:06:11 Calling Vagrant CLI: []string{"destroy", "-f", "source"}
2024/02/03 07:06:17 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:06:17 [vagrant driver] stdout: ==> source: Stopping the machine...
2024/02/03 07:06:24 packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe plugin: 2024/02/03 07:06:24 [vagrant driver] stdout: ==> source: Deleting the machine...
2024/02/03 07:06:25 [INFO] (telemetry) ending vagrant.vs2022
2024/02/03 07:06:25 ui: Build 'vagrant.vs2022' finished after 2 minutes 9 seconds.
2024/02/03 07:06:25 ui:
==> Wait completed after 2 minutes 9 seconds
2024/02/03 07:06:25 ui:
==> Builds finished. The artifacts of successful builds are:
2024/02/03 07:06:25 machine readable: vagrant.vs2022,artifact-count []string{"1"}
2024/02/03 07:06:25 machine readable: vagrant.vs2022,artifact []string{"0", "builder-id", "vagrant"}
2024/02/03 07:06:25 machine readable: vagrant.vs2022,artifact []string{"0", "id", "hyperv"}
2024/02/03 07:06:25 machine readable: vagrant.vs2022,artifact []string{"0", "string", "Vagrant box 'package.box' for 'hyperv' provider"}
2024/02/03 07:06:25 machine readable: vagrant.vs2022,artifact []string{"0", "files-count", "1"}
2024/02/03 07:06:25 machine readable: vagrant.vs2022,artifact []string{"0", "file", "0", "output-vs2022\package.box"}
2024/02/03 07:06:25 machine readable: vagrant.vs2022,artifact []string{"0", "end"}
2024/02/03 07:06:25 ui: --> vagrant.vs2022: Vagrant box 'package.box' for 'hyperv' provider
2024/02/03 07:06:25 [INFO] (telemetry) Finalizing.
2024/02/03 07:06:25 [WARN] (telemetry) Error finalizing report. This is safe to ignore. Post "https://checkpoint-api.hashicorp.com/v1/telemetry/packer": dial tcp: lookup checkpoint-api.hashicorp.com: no such host
2024/02/03 07:06:25 waiting for all plugin processes to complete...
2024/02/03 07:06:25 C:\ProgramData\chocolatey\lib\packer\tools\packer.exe: plugin process exited
2024/02/03 07:06:25 C:\ProgramData\chocolatey\lib\packer\tools\packer.exe: plugin process exited
2024/02/03 07:06:25 C:\Users<replaced>\AppData\Roaming\packer.d\plugins\github.com\hashicorp\vagrant\packer-plugin-vagrant_v1.1.2_x5.0_windows_amd64.exe: plugin process exited
2024/02/03 07:06:25 C:\ProgramData\chocolatey\lib\packer\tools\packer.exe: plugin process exited
This issue was originally opened by @Romainj1 in hashicorp/packer#11405 and has been migrated to this repository. The original issue description is below.
I am trying to use the vagrant builder. I achieve creating a new image out of an existing one in my example. But the image created seems unusable: When creating a new box out of the new image, with vagrant up
, vagrant cannot ssh: Remote connection disconnect
...
I tried generic/debian10
and generic/debian9
as base images.
Run:
cat > box.json <<EOF
{
"builders": [
{
"communicator": "ssh",
"source_path": "generic/debian10",
"provider": "libvirt",
"type": "vagrant"
}
]
}
EOF
packer validate box.json
packer build box.json
Then as the doc mentions:
vagrant box add -f new-box ./output-vagrant/package.box
vagrant init new-box
Everything works as expected, until:
vagrant up
Where i am getting:
Bringing machine 'default' up with 'libvirt' provider...
==> default: Creating image (snapshot of base box volume).
==> default: Creating domain with the following settings...
==> default: -- Name: devops-scripts_default
==> default: -- Description: Source: /home/rjacquier/dev/devops-scripts/Vagrantfile
==> default: -- Domain type: kvm
==> default: -- Cpus: 1
==> default: -- Feature: acpi
==> default: -- Feature: apic
==> default: -- Feature: pae
==> default: -- Clock offset: utc
==> default: -- Memory: 512M
==> default: -- Management MAC:
==> default: -- Loader:
==> default: -- Nvram:
==> default: -- Base box: box
==> default: -- Storage pool: default
==> default: -- Image(): /home/.libvirt_images/devops-scripts_default.img, 128G
==> default: -- Disk driver opts: cache='default'
==> default: -- Kernel:
==> default: -- Initrd:
==> default: -- Graphics Type: vnc
==> default: -- Graphics Port: -1
==> default: -- Graphics IP: 127.0.0.1
==> default: -- Graphics Password: Not defined
==> default: -- Video Type: cirrus
==> default: -- Video VRAM: 9216
==> default: -- Sound Type:
==> default: -- Keymap: en-us
==> default: -- TPM Backend: passthrough
==> default: -- TPM Path:
==> default: -- INPUT: type=mouse, bus=ps2
==> default: Creating shared folders metadata...
==> default: Starting domain.
==> default: Waiting for domain to get an IP address...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 192.168.121.13:22
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Connection reset. Retrying...
default: Warning: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...
...
until it timeouts
$ packer version
Packer v1.7.8
Json template:
{
"builders": [
{
"communicator": "ssh",
"source_path": "generic/debian10",
"provider": "libvirt",
"type": "vagrant"
}
]
}
$ uname -a
Linux rjr-port 5.10.0-9-amd64 #1 SMP Debian 5.10.70-1 (2021-09-30) x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
$ vagrant --version
Vagrant 2.2.19
$ virsh --version
7.0.0
$ libvirtd --version
libvirtd (libvirt) 7.0.0
Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.
Would be great if this plugin supported the recently-ish added support for provider checksums.
I am trying to leverage the vagrant-cloud
post-processor as part of my setup and find it a bit frustrating to perform extra steps for box upload (attaching the checksum info).
type Provider struct {
Name string `json:"name"`
Url string `json:"url,omitempty"`
HostedToken string `json:"hosted_token,omitempty"`
UploadUrl string `json:"upload_url,omitempty"`
Checksum string `json:"checksum,omitempty"`
ChecksumType string `json:"checksum_type,omitempty"`}
Please search the existing issues for relevant feature requests, and use the
reaction feature
(https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/)
to add upvotes to pre-existing requests.
Today vagrantfile_template
needs to be a file path.
Allow to specify vagrantfile_template_content
in Vagrant post processor so I can use templatefile with it.
I want to specify my own SSH to be used in Vagrant instead of the public one therefore I would like to inject a vagrant with the following:
Vagrant.configure("2") do |config|
config.ssh.private_key_path = ${my_ssh_key}
config.ssh.forward_agent = true
end
This could be applied many configurations in the Vagrantfile. This is only an example.
locals {
vagrantfile = templatefile("vagrantfile.pkrtpl.hcl", {
my_ssh_key = "~/.ssh/rsa
})
}
....
post-processor "vagrant" {
vagrantfile_template_content = local.vagrantfile
}
The synced_folder
option does not expand ~/
Set synced_folder
as ~/.aws
then execute packer build .
pakcer version v1.8.3
packer {
required_plugins {
amazon = {
version = ">= 1.1.0"
source = "github.com/hashicorp/amazon"
}
vagrant = {
version = ">= 1.0.3"
source = "github.com/hashicorp/vagrant"
}
}
}
source "vagrant" "this" {
add_force = true
communicator = "ssh"
source_path = "stakahashi/amazonlinux2"
provider = "virtualbox"
synced_folder = "~/.aws/"
#synced_folder = "$HOME/.aws/"
}
build {
name = "build_vagrant"
sources = ["source.vagrant.this"]
provisioner "shell" {
environment_vars = [
"AWS_CONFIG_FILE=/vagrant/config",
"AWS_DEFAULT_REGION=${var.aws_region}",
"AWS_PROFILE=${var.aws_profile}",
"AWS_SHARED_CREDENTIALS_FILE=/vagrant/credentials"
]
inline = [
"aws sts get-caller-identity"
]
}
}
MacOS Catalina, Intel Core i7
$ packer build test.pkr.hcl
Error: 1 error(s) occurred:
* synced_folder "/path/to/the/packer/directory/~/.aws" does not exist on the Packer host.
on test.pkr.hcl line 151:
(source code not available)
==> Wait completed after 4 microseconds
==> Builds finished but no artifacts were created.
When an underlying vagrant issue occurs (such as a plugin issue) the error message from packer can be quite obscure.
For example, an out-of-date Vagrant VMware utility caused Packer to report:
Build 'vmware' errored after 8 seconds 844 milliseconds: error: SSH Port was not properly retrieved from SSHConfig.
Have a config that will produce some vagrant error;
Run a packer build using the vagrant builder.
Packer 1.7.2
macOS 11.4 on Intel
Maybe I'm missing something obvious here, but if a different Vagrant repository is used with the builder, the generated Vagrantfile does not work. In my case, JFrog's Artifactory is used to host a local box repository.
To resolve a box, a URL with the following format: https://{Artifactory URL}/api/vagrant/{vagrantRepoKey}/{boxName}
is used and resolves to the latest version. The box is added correctly by packer. However, the created Vagrantfile looks as follows:
Vagrant.configure("2") do |config|
config.vm.define "source", autostart: false do |source|
source.vm.box = "https://<local_adress>/artifactory/api/vagrant/vagrant-repo/debian-12.5"
config.ssh.insert_key = false
end
config.vm.define "output" do |output|
output.vm.box = "debian-12.5"
output.vm.box_url = "file://package.box"
config.ssh.insert_key = false
end
config.vm.synced_folder ".", "/vagrant", disabled: true
end
This results in the following error messages:
The box you're adding has a name different from the name you
2024/03/20 10:50:52 packer-plugin-vagrant_v1.1.1_x5.0_linux_amd64 plugin: 2024/03/20 10:50:52 [vagrant driver] stderr: requested. For boxes with metadata, you cannot override the name.
2024/03/20 10:50:52 packer-plugin-vagrant_v1.1.1_x5.0_linux_amd64 plugin: 2024/03/20 10:50:52 [vagrant driver] stderr: If you're adding a box using `vagrant box add`, don't specify
2024/03/20 10:50:52 packer-plugin-vagrant_v1.1.1_x5.0_linux_amd64 plugin: 2024/03/20 10:50:52 [vagrant driver] stderr: the `--name` parameter. If the box is being added via a Vagrantfile,
2024/03/20 10:50:52 packer-plugin-vagrant_v1.1.1_x5.0_linux_amd64 plugin: 2024/03/20 10:50:52 [vagrant driver] stderr: change the `config.vm.box` value to match the name below.
2024/03/20 10:50:52 packer-plugin-vagrant_v1.1.1_x5.0_linux_amd64 plugin: 2024/03/20 10:50:52 [vagrant driver] stderr:
2024/03/20 10:50:52 packer-plugin-vagrant_v1.1.1_x5.0_linux_amd64 plugin: 2024/03/20 10:50:52 [vagrant driver] stderr: Requested name: https://<local_adress>/artifactory/api/vagrant/vagrant-repo/debian-12.5
2024/03/20 10:50:52 packer-plugin-vagrant_v1.1.1_x5.0_linux_amd64 plugin: 2024/03/20 10:50:52 [vagrant driver] stderr: Actual name: debian-12.5
Considering how the Vagrantfile is created, source.vm.box = "{{.BoxName}}"
would resolve this issue and allows a correct run.
As a temporary workaround I provided an adjusted template:
Vagrant.configure("2") do |config|
config.vm.define "source", autostart: false do |source|
source.vm.box = "{{.BoxName}}"
config.ssh.insert_key = {{.InsertKey}}
end
config.vm.define "output" do |output|
output.vm.box = "{{.BoxName}}"
output.vm.box_url = "file://package.box"
config.ssh.insert_key = {{.InsertKey}}
end
{{ if ne .SyncedFolder "" -}}
config.vm.synced_folder "{{.SyncedFolder}}", "/vagrant"
{{- else -}}
config.vm.synced_folder ".", "/vagrant", disabled: true
{{- end}}
end
PACKER_LOG=10 packer build --debug .
to see the appropriate error messages.Packer v1.9.4
Plugin: v1.1.1_x5.0_linux_amd64
packer {
required_version = ">= 1.7.0"
required_plugins {
vagrant = {
version = ">= 1.0.2"
source = "github.com/hashicorp/vagrant"
}
}
}
source "vagrant" "vm" {
communicator = "ssh"
source_path = "https://{Artifactory URL}/api/vagrant/{vagrantRepoKey}/{boxName}"
box_name = "{boxName}"
teardown_method = "destroy"
}
build {
sources = ["source.vagrant.vm"]
}
When run on a Windows host, the absolute path generated in Vagrantfile
from synced_folder
configuration property contains only single backslash characters (\
) as path separators. This is not supported because Vagrantfile
is a Ruby file and backslash is an escape character in Ruby
On a Windows host, with packer, vagrant and virtualbox installed, run packer build .\test-box.pkr.hcl
(see the content of the .pkr.hcl
file below)
packer: 1.8.5
vagrant plugin: 1.0.3
packer {
required_plugins {
vagrant = {
version = ">= 1.0.3"
source = "github.com/hashicorp/vagrant"
}
}
}
source "vagrant" "test-box" {
communicator = "ssh"
source_path = "minimal/trusty64"
provider = "virtualbox"
synced_folder = "."
}
build {
sources = ["source.vagrant.test-box"]
provisioner "file" {
source = "test-file"
destination = "C:/test-file"
}
}
Windows 10 host, 64 bits.
2023/03/24 11:03:03 [INFO] Packer version: 1.8.5 [go1.18.9 windows amd64]
2023/03/24 11:03:03 [TRACE] discovering plugins in C:\ProgramData\chocolatey\lib\packer\tools
2023/03/24 11:03:03 [TRACE] discovering plugins in C:\Users\Foo\AppData\Roaming\packer.d\plugins
2023/03/24 11:03:03 [DEBUG] Discovered plugin: vagrant = C:\Users\Foo\AppData\Roaming\packer.d\plugins\github.com\hashicorp\vagrant\packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe
2023/03/24 11:03:03 [INFO] found external [-packer-default-plugin-name-] builders from vagrant plugin
2023/03/24 11:03:03 [INFO] found external [-packer-default-plugin-name- cloud] post-processors from vagrant plugin
2023/03/24 11:03:03 [TRACE] discovering plugins in .
2023/03/24 11:03:03 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2023/03/24 11:03:03 [INFO] PACKER_CONFIG env var set; attempting to open config file: C:\Users\Foo\AppData\Roaming\packer.config
2023/03/24 11:03:03 [WARN] Config file doesn't exist: C:\Users\Foo\AppData\Roaming\packer.config
2023/03/24 11:03:03 [INFO] Setting cache directory: C:\Users\Foo\Documents\test-box\packer_cache
e: cannot determine if process is in background: Process background check error: not implemented yet
2023/03/24 11:03:03 [TRACE] listing potential installations for "github.com/hashicorp/vagrant" that match ">= 1.0.3". plugingetter.ListInstallationsOptions{FromFolders:[]string{"C:\\ProgramData\\chocolatey\\lib\\packer\\tools\\packer.exe", ".", "C:\\Users\\Foo\\AppData\\Roaming\\packer.d\\plugins"}, BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"windows", ARCH:"amd64", Ext:".exe", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc0001a1000)}}}}
2023/03/24 11:03:03 [TRACE] Found the following "github.com/hashicorp/vagrant" installations: [{C:\Users\Foo\AppData\Roaming\packer.d\plugins\github.com\hashicorp\vagrant\packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe v1.0.3}]
2023/03/24 11:03:03 [INFO] found external [-packer-default-plugin-name-] builders from vagrant plugin
2023/03/24 11:03:03 [INFO] found external [-packer-default-plugin-name- cloud] post-processors from vagrant plugin
2023/03/24 11:03:03 [TRACE] Starting external plugin C:\Users\Foo\AppData\Roaming\packer.d\plugins\github.com\hashicorp\vagrant\packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe start builder -packer-default-plugin-name-
2023/03/24 11:03:03 Starting plugin: C:\Users\Foo\AppData\Roaming\packer.d\plugins\github.com\hashicorp\vagrant\packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe []string{"C:\\Users\\Foo\\AppData\\Roaming\\packer.d\\plugins\\github.com\\hashicorp\\vagrant\\packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe", "start", "builder", "-packer-default-plugin-name-"}
2023/03/24 11:03:03 Waiting for RPC address for: C:\Users\Foo\AppData\Roaming\packer.d\plugins\github.com\hashicorp\vagrant\packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe
2023/03/24 11:03:03 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:03 Plugin port range: [10000,25000]
2023/03/24 11:03:03 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:03 Plugin address: tcp 127.0.0.1:10000
2023/03/24 11:03:03 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:03 Waiting for connection...
2023/03/24 11:03:03 Received tcp RPC address for C:\Users\Foo\AppData\Roaming\packer.d\plugins\github.com\hashicorp\vagrant\packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe: addr is 127.0.0.1:10000
2023/03/24 11:03:03 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:03 Serving a plugin connection...
2023/03/24 11:03:03 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:03 [TRACE] starting builder -packer-default-plugin-name-
2023/03/24 11:03:03 [TRACE] Starting internal plugin packer-provisioner-file
2023/03/24 11:03:03 Starting plugin: C:\ProgramData\chocolatey\lib\packer\tools\packer.exe []string{"C:\\ProgramData\\chocolatey\\lib\\packer\\tools\\packer.exe", "plugin", "packer-provisioner-file"}
2023/03/24 11:03:03 Waiting for RPC address for: C:\ProgramData\chocolatey\lib\packer\tools\packer.exe
2023/03/24 11:03:03 packer.exe plugin: [INFO] Packer version: 1.8.5 [go1.18.9 windows amd64]
2023/03/24 11:03:03 packer.exe plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2023/03/24 11:03:03 packer.exe plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: C:\Users\Foo\AppData\Roaming\packer.config
2023/03/24 11:03:03 packer.exe plugin: [WARN] Config file doesn't exist: C:\Users\Foo\AppData\Roaming\packer.config
2023/03/24 11:03:03 packer.exe plugin: [INFO] Setting cache directory: C:\Users\Foo\Documents\test-box\packer_cache
2023/03/24 11:03:03 packer.exe plugin: args: []string{"packer-provisioner-file"}
2023/03/24 11:03:03 packer.exe plugin: Plugin port range: [10000,25000]
2023/03/24 11:03:03 packer.exe plugin: Plugin address: tcp 127.0.0.1:10000
2023/03/24 11:03:03 Received tcp RPC address for C:\ProgramData\chocolatey\lib\packer\tools\packer.exe: addr is 127.0.0.1:10000
2023/03/24 11:03:03 packer.exe plugin: Waiting for connection...
2023/03/24 11:03:03 packer.exe plugin: Serving a plugin connection...
2023/03/24 11:03:03 ui: vagrant.test-box: output will be in this color.
2023/03/24 11:03:03 ui:
2023/03/24 11:03:03 Build debug mode: false
2023/03/24 11:03:03 Force build: false
2023/03/24 11:03:03 On error:
2023/03/24 11:03:03 Waiting on builds to complete...
2023/03/24 11:03:03 Starting build run: vagrant.test-box
2023/03/24 11:03:03 Running builder:
2023/03/24 11:03:03 [INFO] (telemetry) Starting builder vagrant.test-box
2023/03/24 11:03:03 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:03 Calling Vagrant CLI: []string{"--version"}
2023/03/24 11:03:03 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:03 [vagrant driver] stdout: Vagrant 2.3.4
2023/03/24 11:03:04 ui: ==> vagrant.test-box: Creating a Vagrantfile in the build directory...
2023/03/24 11:03:04 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:04 Created vagrantfile at C:\Users\Foo\Documents\test-box\output-test-box\Vagrantfile
2023/03/24 11:03:04 ui: ==> vagrant.test-box: Adding box using vagrant box add ...
2023/03/24 11:03:04 ui: vagrant.test-box: (this can take some time if we need to download the box)
2023/03/24 11:03:04 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:04 [vagrant] Calling box add with following args minimal/trusty64 --provider virtualbox
2023/03/24 11:03:04 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:04 Calling Vagrant CLI: []string{"box", "add", "minimal/trusty64", "--provider", "virtualbox"}
2023/03/24 11:03:08 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:08 [vagrant driver] stdout: ==> box: Loading metadata for box 'minimal/trusty64'
2023/03/24 11:03:08 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:08 [vagrant driver] stdout: box: URL: https://vagrantcloud.com/minimal/trusty64
2023/03/24 11:03:09 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:09 [vagrant driver] stdout: ==> box: Adding box 'minimal/trusty64' (v14.04.3) for provider: virtualbox
2023/03/24 11:03:09 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:09 [vagrant driver] stderr: The box you're attempting to add already exists. Remove it before
2023/03/24 11:03:09 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:09 [vagrant driver] stderr: adding it again or add it with the `--force` flag.
2023/03/24 11:03:09 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:09 [vagrant driver] stderr:
2023/03/24 11:03:09 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:09 [vagrant driver] stderr: Name: minimal/trusty64
2023/03/24 11:03:09 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:09 [vagrant driver] stderr: Provider: virtualbox
2023/03/24 11:03:09 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:09 [vagrant driver] stderr: Version: 14.04.3
2023/03/24 11:03:09 ui: ==> vagrant.test-box: Calling Vagrant Up (this can take some time)...
2023/03/24 11:03:09 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:09 Calling Vagrant CLI: []string{"up", "source", "--provider=virtualbox"}
2023/03/24 11:03:13 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:13 [vagrant driver] stdout: Bringing machine 'source' up with 'virtualbox' provider...
2023/03/24 11:03:15 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:15 [vagrant driver] stderr: There are errors in the configuration of this machine. Please fix
2023/03/24 11:03:15 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:15 [vagrant driver] stderr: the following errors and try again:
2023/03/24 11:03:15 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:15 [vagrant driver] stderr:
2023/03/24 11:03:15 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:15 [vagrant driver] stderr: vm:
2023/03/24 11:03:15 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:15 [vagrant driver] stderr: * The host path of the shared folder is missing: C:UsersFooDocuments est-box
2023/03/24 11:03:15 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:15 [vagrant driver] stderr:
2023/03/24 11:03:15 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:15 Calling Vagrant CLI: []string{"ssh-config", "source"}
2023/03/24 11:03:20 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:20 [vagrant driver] stderr: The provider for this Vagrant-managed machine is reporting that it
2023/03/24 11:03:20 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:20 [vagrant driver] stderr: is not yet ready for SSH. Depending on your provider this can carry
2023/03/24 11:03:20 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:20 [vagrant driver] stderr: different meanings. Make sure your machine is created and running and
2023/03/24 11:03:20 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:20 [vagrant driver] stderr: try again. Additionally, check the output of `vagrant status` to verify
2023/03/24 11:03:20 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:20 [vagrant driver] stderr: that the machine is in the state that you expect. If you continue to
2023/03/24 11:03:20 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:20 [vagrant driver] stderr: get this error message, please view the documentation for the provider
2023/03/24 11:03:20 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:20 [vagrant driver] stderr: you're using.
2023/03/24 11:03:20 ui: ==> vagrant.test-box: destroying Vagrant box...
2023/03/24 11:03:20 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:20 Calling Vagrant CLI: []string{"destroy", "-f", "source"}
2023/03/24 11:03:27 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:27 [vagrant driver] stdout: ==> source: VM not created. Moving on...
2023/03/24 11:03:27 ui: ==> vagrant.test-box: Deleting output directory...
2023/03/24 11:03:27 packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe plugin: 2023/03/24 11:03:27 Error removing output dir: remove output-test-box\Vagrantfile: Le processus ne peut pas accéder au fichier car ce fichier est utilisé par un autre processus.
2023/03/24 11:03:29 [INFO] (telemetry) ending vagrant.test-box
2023/03/24 11:03:29 ui error: Build 'vagrant.test-box' errored after 25 seconds 519 milliseconds: error: SSH Port was not properly retrieved from SSHConfig.
2023/03/24 11:03:29 ui:
==> Wait completed after 25 seconds 519 milliseconds
2023/03/24 11:03:29 machine readable: error-count []string{"1"}
2023/03/24 11:03:29 ui error:
==> Some builds didn't complete successfully and had errors:
2023/03/24 11:03:29 machine readable: vagrant.test-box,error []string{"error: SSH Port was not properly retrieved from SSHConfig."}
2023/03/24 11:03:29 ui error: --> vagrant.test-box: error: SSH Port was not properly retrieved from SSHConfig.
2023/03/24 11:03:29 ui:
==> Builds finished but no artifacts were created.
2023/03/24 11:03:29 [INFO] (telemetry) Finalizing.
2023/03/24 11:03:29 waiting for all plugin processes to complete...
2023/03/24 11:03:29 [ERR] yamux: Failed to read header: read tcp 127.0.0.1:64824->127.0.0.1:10000: wsarecv: Une connexion existante a dû être fermée par l’hôte distant.
2023/03/24 11:03:29 [ERR] yamux: Failed to read header: read tcp 127.0.0.1:64823->127.0.0.1:10000: wsarecv: Une connexion existante a dû être fermée par l’hôte distant.
2023/03/24 11:03:29 C:\ProgramData\chocolatey\lib\packer\tools\packer.exe: plugin process exited
2023/03/24 11:03:29 C:\Users\Foo\AppData\Roaming\packer.d\plugins\github.com\hashicorp\vagrant\packer-plugin-vagrant_v1.0.3_x5.0_windows_amd64.exe: plugin process exited
This issue was originally opened by @andkononykhin as hashicorp/packer#8245. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.
A patch hashicorp/packer#7957 introduced new multi-machine vagrantfile template for vagrant builder:
source_path
but not by box_name
vm.box
but also sets output package.box file as vm.box_url
which seems confusingIt leads to:
vagrant up
itself during packer build tries to add box for source machine and it might fail the build if the source path is too longbox_name
value and one by vagrant with source_path
value as a namevagrant up output
will bring up machine based on a source box instead of output one1.4.4
{
"builders": [
{
"type" : "vagrant",
"provider" : "virtualbox",
"source_path" : "{{template_dir}}/../../bla/bla/bla/long-path/package.box",
"add_force" : true,
"box_name" : "centos7-base",
"output_dir" : "{{template_dir}}/../../.boxes/centos7-with-new-dir",
"communicator" : "ssh",
...
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"mkdir -p /tmp/new"
]
}
]
}
Vagrant.configure("2") do |config|
config.vm.define "source", autostart: false do |source|
source.vm.box = "... <skipped> .../../../bla/bla/bla/long-path/package.box"
end
config.vm.define "output" do |output|
output.vm.box = "centos7-base"
output.vm.box_url = "file://package.box"
end
config.vm.synced_folder ".", "/vagrant", disabled: true
end
centos7
2019/10/18 14:46:51 packer: 2019/10/18 14:46:51 Calling Vagrant CLI: []string{"up", "source", "--provider=virtualbox"}
2019/10/18 14:46:55 packer: 2019/10/18 14:46:55 [vagrant driver] stdout: Bringing machine 'source' up with 'virtualbox' provider...
2019/10/18 14:46:55 packer: ==> source: Box '... <skipped> .../../../bla/bla/bla/long-path/package.box' could not be found. Attempting to find and install...
2019/10/18 14:46:55 packer: source: Box Provider: virtualbox
2019/10/18 14:46:55 packer: source: Box Version: >= 0
2019/10/18 14:46:55 packer: ==> source: Box file was not detected as metadata. Adding it directly...
2019/10/18 14:46:55 packer: ==> source: Adding box '... <skipped> .../../../bla/bla/bla/long-path/package.box' (v0) for provider: virtualbox
2019/10/18 14:46:55 packer: source: Unpacking necessary files from: file://... <skipped> .../../../bla/bla/bla/long-path/package.box
2019/10/18 14:46:55 packer: 2019/10/18 14:46:55 [vagrant driver] stderr: /tmp/.mount_vagran5Uh4mU/usr/lib/ruby/2.4.0/fileutils.rb:230:in `mkdir': File name too long @ dir_s_mkdir - ... <skipped> ...-VAGRANTSLASH-..-VAGRANTSLASH-..-VAGRANTSLASH-bla-VAGRANTSLASH-bla-VAGRANTSLASH-bla-VAGRANTSLASH-long-path-VAGRANTSLASH-package.box (Errno::ENAMETOOLONG)
2019/10/18 14:46:55 packer: from /tmp/.mount_vagran5Uh4mU/usr/lib/ruby/2.4.0/fileutils.rb:230:in `fu_mkdir'
2019/10/18 14:46:55 packer: from /tmp/.mount_vagran5Uh4mU/usr/lib/ruby/2.4.0/fileutils.rb:208:in `block (2 levels) in mkdir_p'
2019/10/18 14:46:55 packer: from /tmp/.mount_vagran5Uh4mU/usr/lib/ruby/2.4.0/fileutils.rb:206:in `reverse_each'
2019/10/18 14:46:55 packer: from /tmp/.mount_vagran5Uh4mU/usr/lib/ruby/2.4.0/fileutils.rb:206:in `block in mkdir_p'
2019/10/18 14:46:55 packer: from /tmp/.mount_vagran5Uh4mU/usr/lib/ruby/2.4.0/fileutils.rb:191:in `each'
2019/10/18 14:46:55 packer: from /tmp/.mount_vagran5Uh4mU/usr/lib/ruby/2.4.0/fileutils.rb:191:in `mkdir_p'
2019/10/18 14:46:55 packer: from /tmp/.mount_vagran5Uh4mU/usr/lib/ruby/2.4.0/pathname.rb:576:in `mkpath'
2019/10/18 14:46:55 packer: from /tmp/.mount_vagran5Uh4mU/usr/gembundle/gems/vagrant-2.2.5/lib/vagrant/box_collection.rb:161:in `block (3 levels) in add'
2019/10/18 14:46:55 packer: from /tmp/.mount_vagran5Uh4mU/usr/gembundle/gems/vagrant-2.2.5/lib/vagrant/box_collection.rb:470:in `with_temp_dir'
2019/10/18 14:46:55 packer: from /tmp/.mount_vagran5Uh4mU/usr/gembundle/gems/vagrant-2.2.5/lib/vagrant/box_collection.rb:134:in `block (2 levels) in add'
2019/10/18 14:46:55 packer: from /tmp/.mount_vagran5Uh4mU/usr/gembundle/gems/vagrant-2.2.5/lib/vagrant/box_collection.rb:470:in `with_temp_dir'
2019/10/18 14:46:55 packer: from /tmp/.mount_vagran5Uh4mU/usr/gembundle/gems/vagrant-2.2.5/lib/vagrant/box_collection.rb:115:in `block in add'
2019/10/18 14:46:55 packer: from /tmp/.mount_vagran5Uh4mU/usr/gembundle/gems/vagrant-2.2.5/lib/vagrant/box_collection.rb:457:in `block in with_collection_lock'
2019/10/18 14:46:55 packer: from /tmp/.mount_vagran5Uh4mU/usr/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
2019/10/18 14:46:55 packer: from /tmp/.mount_vagran5Uh4mU/usr/gembundle/gems/vagrant-2.2.5/lib/vagrant/box_collection.rb:456:in `with_collection_lock'
2019/10/18 14:46:55 packer: from /tmp/.mount_vagran5Uh4mU/usr/gembundle/gems/vagrant-2.2.5/lib/vagrant/box_collection.rb:104:in `add'
==> vagrant: destroying Vagrant box...
This issue was originally opened by @josh-m-sharpe in hashicorp/packer#11189 and has been migrated to this repository. The original issue description is below.
Documentation suggests packer should be able to build a docker container and associated vagrant box file that can be launched with vagrant up
- I cannot seem to get that to work. Steps to repro are here:
https://discuss.hashicorp.com/t/cant-get-packer-build-docker-box-to-launch-with-vagrant/27244
This issue was originally opened by @vadorovsky in hashicorp/packer#11148 and has been migrated to this repository. The original issue description is below.
I'm trying to build my own vagrant-libvirt box based on this one:
https://app.vagrantup.com/opensuse/boxes/Tumbleweed.x86_64
Here is the buildfile I'm using:
Do
packer build -force control-plane-libvirt.json
on the following buildfile: https://github.com/rancher-sandbox/enclave/blob/vagrant-workers/contrib/packer/control-plane-libvirt.json
Packer v1.7.3
openSUSE Tumbleweed
x86_64
kernel 5.13.0-1-default
libvirt 7.5.0
(Probably) the most important fragment:
2021/07/14 19:16:05 ui: �[1;32m==> vagrant (vagrant): Creating a dummy Vagrant box to ensure the host system can create one correctly�[0m
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: Turning dir into box: /tmp/packer006449265 => /tmp/box-601523484.box
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: Compressing with gzip compression level: -1
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: Skipping directory '/tmp/packer006449265' for box '/tmp/box-601523484.box'
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: Box add: '/tmp/packer006449265/metadata.json' to '/tmp/box-601523484.box'
2021/07/14 19:16:05 ui: �[1;32m==> vagrant (vagrant): Creating Vagrant box for 'libvirt' provider�[0m
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: panic: interface conversion: interface {} is nil, not string
2021/07/14 19:16:05 packer-post-processor-vagrant plugin:
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: goroutine 94 [running]:
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: github.com/hashicorp/packer-plugin-vagrant/post-processor/vagrant.(*LibVirtProvider).Process(0x8e563c0, 0x5e66138, 0xc000048090, 0x5e66180, 0xc0000fe080, 0xc0007aa408, 0x14, 0x0, 0x5, 0x100, ...)
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: /home/circleci/go/pkg/mod/github.com/hashicorp/[email protected]/post-processor/vagrant/libvirt.go:67 +0x918
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: github.com/hashicorp/packer-plugin-vagrant/post-processor/vagrant.(*PostProcessor).PostProcessProvider(0xc000e3f1e0, 0xc00053c560, 0x7, 0x5e24c90, 0x8e563c0, 0x5e66138, 0xc000048090, 0x5e66180, 0xc0000fe080, 0x0, ...)
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: /home/circleci/go/pkg/mod/github.com/hashicorp/[email protected]/post-processor/vagrant/post-processor.go:158 +0x831
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: github.com/hashicorp/packer-plugin-vagrant/post-processor/vagrant.(*PostProcessor).PostProcess(0xc000e3f1e0, 0x5e4ce20, 0xc000278100, 0x5e66138, 0xc000048090, 0x5e66180, 0xc0000fe080, 0x5e27cb0, 0x203000, 0x5dbc5c0, ...)
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: /home/circleci/go/pkg/mod/github.com/hashicorp/[email protected]/post-processor/vagrant/post-processor.go:230 +0x199
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: github.com/hashicorp/packer-plugin-sdk/rpc.(*PostProcessorServer).PostProcess(0xc00011e040, 0x1, 0xc00041a000, 0x0, 0x0)
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: /home/circleci/go/pkg/mod/github.com/hashicorp/[email protected]/rpc/post_processor.go:108 +0x19a
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: reflect.Value.call(0xc000100480, 0xc00000e3a8, 0x13, 0x56cc20d, 0x4, 0xc000041f08, 0x3, 0x3, 0xc00021e140, 0xc000219f68, ...)
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: /usr/local/go/src/reflect/value.go:476 +0x8e7
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: reflect.Value.Call(0xc000100480, 0xc00000e3a8, 0x13, 0xc000219f08, 0x3, 0x3, 0xc00021e140, 0x4aaf820, 0xc0005ae000)
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: /usr/local/go/src/reflect/value.go:337 +0xb9
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: net/rpc.(*service).call(0xc00053e2c0, 0xc0004fe190, 0xc0005ae310, 0xc0005ae320, 0xc00079a200, 0xc00047c160, 0x469d880, 0xc0005ae00c, 0x18a, 0x44d48a0, ...)
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: /usr/local/go/src/net/rpc/server.go:377 +0x189
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: created by net/rpc.(*Server).ServeCodec
2021/07/14 19:16:05 packer-post-processor-vagrant plugin: /usr/local/go/src/net/rpc/server.go:474 +0x44d
2021/07/14 19:16:05 [INFO] (telemetry) ending vagrant
2021/07/14 19:16:05 Deleting original artifact for build 'vagrant'
2021/07/14 19:16:05 /home/vadorovsky/bin/packer: plugin process exited
2021/07/14 19:16:05 ui error: �[1;31mBuild 'vagrant' errored after 3 minutes 197 milliseconds: 1 error(s) occurred:
crash.log:
https://gist.github.com/vadorovsky/797599ab4c3df4ebce6514a274dd5b6f
When using a Vagrant box as a source there is no box created and no error reported.
Just running packer build ...
:
➤ packer build motd.pkr.hcl
vagrant.motd: output will be in this color.
==> vagrant.motd: Creating a Vagrantfile in the build directory...
==> vagrant.motd: Adding box using vagrant box add ...
vagrant.motd: (this can take some time if we need to download the box)
==> vagrant.motd: Calling Vagrant Up (this can take some time)...
==> vagrant.motd: Using SSH communicator to connect: 192.168.122.106
==> vagrant.motd: Waiting for SSH to become available...
==> vagrant.motd: Connected to SSH!
==> vagrant.motd: Uploading /tmp/dkrm/pkr-file-content3981725331 => /tmp/motd
vagrant.motd: pkr-file-content3981725331 24 B / 24 B [=======================] 100.00% 0s
==> vagrant.motd: Provisioning with shell script: /tmp/dkrm/packer-shell1753401847
==> vagrant.motd: Packaging box...
==> vagrant.motd: destroying Vagrant box...
Build 'vagrant.motd' finished after 1 minute 23 seconds.
==> Wait completed after 1 minute 23 seconds
==> Builds finished. The artifacts of successful builds are:
--> vagrant.motd: Vagrant box 'package.box' for 'libvirt' provider
➤ lta
.
├── motd.pkr.hcl
└── output-motd
├── .vagrant
│ ├── bundler
│ │ └── global.sol
│ ├── machines
│ │ └── source
│ │ └── libvirt
│ └── rgloader
│ └── loader.rb
└── Vagrantfile
There is no package.box
anywhere.
source "vagrant" "motd" {
source_path = "archlinux/archlinux"
provider = "libvirt"
communicator = "ssh"
}
build {
sources = ["source.vagrant.motd"]
provisioner "file" {
destination = "/tmp/motd"
direction = "upload"
content = "Hello World from Packer."
}
provisioner "shell" {
inline = ["sudo mv /tmp/motd /etc/motd"]
}
}
Arch Linux x64
https://gist.github.com/dariuskramer/c898a223b66f2dc08a6598cf4cde4186
It seems like "here" on like 48 below should be a hyperlink, but it is not:
I would help fix it, but it is not clear what it should point to.
It should possibly be this:
packer-plugin-vagrant/post-processor/vagrant/virtualbox.go
Lines 178 to 181 in f21234f
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.