hashicorp / packer-plugin-vagrant

Packer plugin for Vagrant
https://packer.io
Mozilla Public License 2.0
13 stars 24 forks source link

Is the current plugin support Windows VM ? #118

Open flassagn opened 3 months ago

flassagn commented 3 months ago

I'm currently trying to build a Windows Vagrant box with packer-plugin-vagrant without success.

Communicators

First, could we used the SSH communicator with windows box ?

Build silent errors

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
flassagn commented 3 months ago

For the record, the underneath error is vagrant side related to the newest OpenSSL library.

The vagrant client is also not stopping the build when it shows the error. I don't know if you could do something

flassagn commented 3 months ago

Last question : the current packer builder is compatible with winssh ?

lbajolet-hashicorp commented 3 months ago

Hi @flassagn,

Lots to unpack here!

Regarding whether or not you can use SSH for communicating with a Windows instance, that depends if the instance has an sshd running or not. Seems like this box does expose one, since the plugin managed to connect with SSH (though it seems there was one issue with agent forwarding, but that didn't prevent it from working).

The WinRM error you got I'm not sure to understand where it's coming from, I failed to grep that in the sources of Packer/SDK/Vagrant plugin, so it's hard to say what produces it. The fact that the build succeeds and doesn't produce a box though looks like a bug, I'll need to check that.

For the record, the underneath error is vagrant side related to the newest OpenSSL library.

To be clear, the "underneath error" you mention is the WinRM failed to execute error with the initialisation error message?

Regarding winssh, I'm not sure I know what that is, could you elaborate a bit on that? Is this Microsoft's fork of OpenSSH that they embed with Windows these days?

flassagn commented 3 months ago

For the record, the underneath error is vagrant side related to the newest OpenSSL library.

To be clear, the "underneath error" you mention is the WinRM failed to execute error with the initialisation error message? Regarding winssh, I'm not sure I know what that is, could you elaborate a bit on that? Is this Microsoft's fork of OpenSSH that they embed with Windows these days?

Exactly, the error seems related to the newest distribution (I'm using archlinux) which has OpenSSL 3 and WinRM.

You could find additionals info at https://github.com/hashicorp/vagrant/issues/13076#issuecomment-1439313674. Another issue is opened directly at https://github.com/WinRb/WinRM/issues/340